serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
21,201 | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <time.h>
#define NV 5 // number of vertices
void createGraph(float *arr, int N) {
time_t t; // used for randomizing values
int col;
int row;
int maxWeight... |
21,202 | //
// main.cpp
// Parallel Degree of Separation
//
// Created by Cary on 11/16/14.
// Copyright (c) 2014 Cary. All rights reserved.
//
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <map>
#include <vector>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <... |
21,203 | #ifndef _PRESCAN_CU_
#define _PRESCAN_CU_
// includes, kernels
#include <assert.h>
#define NUM_BANKS 16
#define LOG_NUM_BANKS 4
#define TILE_SIZE 1024
// You can use any other block size you wish.
#define BLOCK_SIZE 256
// Host Helper Functions (allocate your own data structure...)
// Device Functions
// Ker... |
21,204 | /*
============================================================================
Name : add_vector_with_streams.cu
Author :
Version :
Copyright : Your copyright notice
Description : CUDA compute reciprocals
============================================================================
*/
#inclu... |
21,205 | #include <iostream>
#include <cmath>
#include <chrono>
#include <random>
#include <limits>
#include <cuda.h>
typedef std::chrono::high_resolution_clock Clock;
#define NUM_TEST 10000000
#define NUM_BLOCKS 1
#define NUM_THREADS 256
#define K 100
using namespace std;
// Helper function for modular exponentiation.
//... |
21,206 | #include <algorithm>
#include <cstdio>
#include <math.h>
#include <utility>
#include <vector>
#include <ctime>
#include <stdexcept>
#include <random>
#include <curand_kernel.h>
#include <chrono>
// for file writing
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <unistd.h>
using namespace std;
unsi... |
21,207 | #include <cuda_runtime.h>
#define WARPS 2
#define WARP_SIZE 32
#define THREADS (WARPS * WARP_SIZE)
__shared__ int smem_first[THREADS];
__shared__ int smem_second[WARPS];
__global__ void sumKernel(int *data_in, int *sum_out) {
int tx = threadIdx.x;
smem_first[tx] = data_in[tx] + tx;
if (tx % WARP_SIZE == 0)... |
21,208 | #include <stdio.h>
#include <stdlib.h>
__global__ void max_val(int* d_max, int* arr, int n) {
int base = threadIdx.x * n;
int max = *(arr + base);
printf("In thread %d\n", threadIdx.x);
for(int i = base + 1; i < base + n; i++) {
if(*(arr + i) > max) {
max = *(arr + i);
}
}
*(d_max + threadIdx.x) = max;... |
21,209 | #include "includes.h"
__global__ void preScan(unsigned int* deviceInput, unsigned int* deviceOutput, int cnt, unsigned int* deviceSum)
{
extern __shared__ unsigned int temp[];
int cntInB = blockDim.x * 2;
int idxInG = cntInB * blockIdx.x + threadIdx.x;
int idxInB = threadIdx.x;
temp[2 * idxInB] = 0;
temp[2 * idxInB +... |
21,210 | #include "includes.h"
/*This file is part of quantumsim. (https://github.com/brianzi/quantumsim)*/
/*(c) 2016 Brian Tarasinski*/
/*Distributed under the GNU GPLv3. See LICENSE.txt or https://www.gnu.org/licenses/gpl.txt*/
//kernel to transform to pauli basis (up, x, y, down)
//to be run on a complete complex density ... |
21,211 | // cudaHW.cu
//
// driver and kernel call
#include <stdio.h>
#define THREADS_PER_BLOCK 256
__global__ void vDotProd_d (int *force, int *distance, int *result, int n)
{
int x = blockIdx.x * blockDim.x + threadIdx.x;
int i = n / 2;
if (x < n) {
if (x < i) {
force[x] = x + 1;
} ... |
21,212 | #include<stdio.h>
#include<stdlib.h>
#include <stdint.h>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <time.h>
#include <iomanip>
#include <iostream>
using namespace std;
struct BITMAPFILEHEADER{
uint8_t type[2];
uint32_t size;
uint16_t reserved1;
uint16_t reserved2;
uint32_... |
21,213 | #include "includes.h"
__global__ void add(int *a, int *r, int *g, int *b, float *gc)
{
int i = (blockIdx.x*blockDim.x) + threadIdx.x;
gc[5120 * 6 + i * 6 ] = b[i] * 0.00390625;
//gc[5120 * 6 + i * 6 ] = float(b[i]) / 256;
gc[5120 * 6 + i * 6 + 1] = g[i] * 0.00390625;
//gc[5120 * 6 + i * 6 + 1] = float(g[i]) / 2... |
21,214 | /*
source /opt/cuda6/cuda6.5/cudavars
source /opt/gcc/gccvars-4.8.4.sh
#CARD="-gencode arch=compute_20,code=compute_20" #compatability back to Fermi (GTX 480); optimisation and immediate-launch for none (gives fastest compile times for development)
CARD="-gencode arch=compute_20,code=compute_20 -gencode arch=compute_30... |
21,215 | #include <cuda.h>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
#include <chrono>
#include <cstdlib>
#include <iostream>
void displayMatrix(int* A, size_t M, size_t N);
__global__ void transposeKernel(int* A, int* B, int M, int N) {
int i_A = N * (blockDim.y * blockIdx.y + threadIdx.y) +
... |
21,216 | /*
* dijkstras-test.cu
*
* Created on: Apr 20, 2015
* Author: luke
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <climits>
#include <stdint.h>
#include <ctime>
void CudaMallocErrorCheck(void** ptr, int size);
void DijkstrasSetupCuda(int *V, int *E, int *We, int *sigma, int *F, int... |
21,217 | //#define DEBUG
#include <cuda.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef DEBUG
cudaError_t status;
void checkCuda(cudaError_t& status) {
status = cudaGetLastError();
if (status == cudaSuccess) {
fprintf(stderr, "Success!\n");
} else {
fprintf(stderr, "CUDA error: %s\n", cudaGetError... |
21,218 | // put a kernel here!
|
21,219 | #include <cstdio>
int main() {
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, 0);
printf("Device name: %s\n", deviceProp.name);
printf("Total global memory: %ld\n", deviceProp.totalGlobalMem);
printf("Shared memory per block: %ld\n", deviceProp.sharedMemPerBlock);
printf("Registers per block: %l... |
21,220 | #include "includes.h"
__global__ void transpose(double *in_d, double * out_d, int row, int col)
{
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
out_d[y+col*x] = in_d[x+row*y];
} |
21,221 | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <malloc.h>
// Estructura que contiene datos de la imagen
typedef struct image{
char *data;
int cols;
int rows;
int depth;
} image;
// Funcion ejecutada en la GPU
__global__ void negativo(char *input_image, char *output_image, int nRows, int nCo... |
21,222 | #include "includes.h"
__global__ void sqrt_kernel_large(float* x, unsigned int len, unsigned int rowsz) {
unsigned int idx = threadIdx.x + blockIdx.x * blockDim.x + blockIdx.y * rowsz;
if (idx < len) x[idx] = sqrt(x[idx]);
} |
21,223 | #include "includes.h"
int row = 0;
int col = 0;
using namespace std;
__global__
__global__ void gpu_transpose(float *dst, float *A, int col, int row) {
int idx = threadIdx.x + blockIdx.x*blockDim.x;
if(idx<col){
for (int j=0; j<row; j++){
dst[j*col+idx] = A[idx*row+j];
}
}
} |
21,224 | #include <iostream>
#include <cuda_runtime.h>
using namespace std;
int get_GPU_Rate()
{
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp,0);
return deviceProp.clockRate;
}
__global__ void Xor(int a,int b,int *result_device,clock_t* time){
clock_t start = clock();
int c;
*result_device+=a^b;
*ti... |
21,225 | #include "FeedForward.cuh"
// The feedforward algorithm propogates the inputs given forward.
// Because these are dependant on the layer before it, the threads must be called
// layer by layer. Furthermore, this can only be parallelized with one thread per
// output because it is an nx1 input and has a race condition... |
21,226 | const double LATTICE_SPEED = 0.1;
const double TAU = 0.9;
const int DIRECTIONS = 9;
const int DIMENSIONS = 2;
#define KERNEL_HEADER(xvar, yvar, wvar, hvar) \
const int x = blockIdx.x;\
const int y = blockIdx.y;\
const int width = gridDim.x;\
const int height = gridDim.y
__global__ void stream(double *out... |
21,227 | #include "includes.h"
__global__ void naive_bias_add(float *in, int size, float *bias, int bias_size)
{
int bid = blockIdx.x * blockDim.x + threadIdx.x;
if (!(bid < size)) return;
int bias_offset = bid - (bid / bias_size) * bias_size;
in[bid] += bias[bias_offset];
} |
21,228 | #include "includes.h"
__global__ void UpdateCC_XY( float *CCXY, int id_CC, float *XY_tofill, int dim_XY ){
int id = blockDim.x*blockIdx.y*gridDim.x + blockDim.x*blockIdx.x + threadIdx.x;
if(id < dim_XY)
CCXY[id_CC*dim_XY + id] = XY_tofill[id];
} |
21,229 | #include <cuda.h>
#include <cuda_runtime_api.h>
#include <stdio.h>
#include <random>
#include <cstdint>
#include <iostream>
#include <cstring>
#define BLOCK_SIZE 32
void fill_matrix(float* matrix, uint64_t n);
void print_matrix(float* matrix, uint64_t n);
void run_basic(int blocks, int threads, uint64_t n);
void run_... |
21,230 | //TO BE DONE LATER
//#include "Prerequisites.cuh"
//#include "CTF.cuh"
//#include "FFT.cuh"
//#include "Generics.cuh"
//#include "Helper.cuh"
//#include "Optimization.cuh"
//#include "Transformation.cuh"
//
//
//__global__ void LocalMinMax1DKernel(tfloat* d_input, int dim, int extent, tfloat2* d_min, tfloat2* d_max, u... |
21,231 | #include <stdio.h>
#include <time.h>
#include <stdlib.h>
enum {
grid_count=16
};
__global__ void vectorAdditionKernel(float * A , float * B , float * C ,int dataCount){
int index = blockIdx.x *blockDim.x + threadIdx.x;
if(index < dataCount)
C[index] = A[index] + B[index];
}
int main(){
int da... |
21,232 | /*
*
* saxpy.cu
*
* Part of the microdemo to illustrate how to initialize the driver API.
* Compile this into ptx with:
*
* Build with: nvcc --ptx saxpy.cu
*
* The resulting .ptx file is needed by the sample saxpyDrv.cpp.
*
* Copyright (c) 2012, Archaea Software, LLC.
* All rights reserved.
*
* Redistribu... |
21,233 | #include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <thrust/extrema.h>
#include <thrust/device_vector.h>
typedef signed char schar;
typedef unsigned char uchar;
typedef short shrt;
typedef unsigned short ushrt;
typedef unsigned uint;
typedef u... |
21,234 | extern "C"
{
__global__ void tx1mx(const int lengthX, const double *t, const double *x, double *z)
{
int i = threadIdx.x + blockIdx.x * blockDim.x;
if (i<lengthX)
{
z[i] += t[i]*x[i]*(1.0-x[i]);
}
}
} |
21,235 | /**
* Author: Zachaiah Bryant
* Description: Generates the average of two polykov loops across
* distances 1-16 for various SU(2) lattice configurations.
*/
// *******************
// * Headers *
// *******************
#include <sys/stat.h> //For checking file existance
#include <iostream>
... |
21,236 | /*----------------------------------------------------------------------------*/
/**
* This confidential and proprietary software may be used only as
* authorised by a licensing agreement from ARM Limited
* (C) COPYRIGHT 2011-2012 ARM Limited
* ALL RIGHTS RESERVED
*
* The entire notice above must be reproduced ... |
21,237 | #include <stdio.h>
__global__ void hello()
{
printf("hello world, Im thread %d on block %d\n", threadIdx.x, blockIdx.x);
}
int main(int argc, char *argv[]) {
int deviceId, nDevices, taskID;
cudaError_t err;
cudaDeviceProp prop;
if( argc == 3 ) {
printf("The argument supplied are devic... |
21,238 | //#include "simple_particle.cuh"
//#include "device_launch_parameters.h"
//#include "device_functions.h"
//#include "math_functions.h"
//#include "cuda_runtime.h"
//#include <stdio.h>
//
//__constant__ simpleParticleSystem d_sps[1];
//
//__global__ void generateParticles();
//
//__global__ void renderParticles(uchar4* ... |
21,239 | #include <stdio.h> // for printf
#define N 64 // constant, threads per block
#define TPB 32 // constant, threads per block
// converts int to evenly spaced floats
// ie) .1, .2, ..., .5, ..., .9
float scale(int i, int n)
{
return ((float) i) / (n - 1);
}
// Computes distance between 2 points ... |
21,240 | #include <stdio.h>
#include <stdlib.h>
int loadFileIntoMemory( char **memory, const char *filename ) {
size_t file_size;
char pad;
int i;
// Opens the file
FILE *fp = fopen(filename, "rb");
// Makes sure the file was really opened
if (fp == NULL) {
*memory = NULL;
return -1;
}
// Determines file siz... |
21,241 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <cuda.h>
#include <cuda_runtime.h>
#define N 512
#define MAX_ERR 1e-6
//__global__ void vector_add(float *out, float *a, float *b, int n) {
// int stride = 1;
// int tid = blockIdx.x * blockDim.x + threadIdx.x;
// 0... |
21,242 | /*
* gpuMerge.cu
*
* Created on: Dec 16, 2018
* Author: Orai Dezso Gergely
*/
#include "gpuMerge.cuh"
#include <iostream>
#include <stdio.h>
static void CheckCudaErrorAux (const char *, unsigned, const char *, cudaError_t);
#define CUDA_CHECK_RETURN(value) CheckCudaErrorAux(__FILE__,__LINE__, #value, value)... |
21,243 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
// #include <cuda.h>
// #include <curand_kernel.h>
// #include <cuda_runtime.h>
// #include <cuda_runtime_api.h>
// #include <helper_cuda.h>
#include <iostream>
#include <time.h>
#include <sys/time.h>
#define checkCudaErrors(val) check( (val), #val, __FILE__, __... |
21,244 | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<time.h>
#include<cuda.h>
#include<cufft.h>
#include<cuda_runtime.h>
//#include <cutil_inline.h>
//#include <cutil.h>
int main()
{
int nx,nt,i,ix,it;
int NX,BATCH;
float **a_input;
float *input;
float *amp;
cufftHandle plan;
cufft... |
21,245 | #include "includes.h"
/**
* Nathan Dunn
* CS-4370-90 Par. Prog. Many-Core GPUs
* Professor Liu
* 10-24-19
* Tiled Matrix Multiplication
*/
#define N 8 // size of the matrices to be multiplied
#define TILE_WIDTH 4 // size of the tiles
/**
* Computes the matrix multiplication on the CPU
* m - First matrix to be multip... |
21,246 | #include "includes.h"
__global__ void Evolve( int *val, int *aux, int n ) {
int up, upright, right, rightdown, down, downleft, left, leftup;
int sum = 0, estado;
const int tx = threadIdx.x + 1, ty = threadIdx.y + 1;
const int i = blockIdx.y * blockDim.y + threadIdx.y;
const int j = blockIdx.x * blockDim.x + threadIdx.x... |
21,247 | #include "kernel_shared.cuh"
#include "kernel_compute.cuh"
#include "cuda_globals.cuh"
#include "globals.cuh"
#include "const.cuh"
#include <stdio.h>
#include <chrono>
#define FIELD_AT_IS_HEAD(O) (field[O] == CELL_ELECTRON_HEAD)
__global__ void computeCell(const int width, const char* field, char* outfield)
{
co... |
21,248 | /******************************************************************************
*cr
*cr (C) Copyright 2010 The Board of Trustees of the
*cr University of Illinois
*cr All Rights Reserved
*cr
*****************************************************************... |
21,249 | #include <cuda.h>
#include <cmath>
#include <iostream>
#include <random>
#include <ctime>
/**
* generate random double with range: @fMin ~ @fMax
*/
double fRand(double fMin, double fMax)
{
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_real_distribution<> dis(fMin, fMax);
double a = di... |
21,250 | #include <stdio.h>
#include <cuda.h>
#include <iostream>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
using namespace std;
// New
#define gpuErrCheck( err ) (gpuAssert( err, __FILE__, __LINE__ ))
static void gpuAssert(cudaError_t err, const char *file, int line) {
if (err != cudaSuccess) {
pri... |
21,251 | #include <cstdio>
#include <ctime>
/* we need these includes for CUDA's random number stuff */
#include <curand.h>
#include <curand_kernel.h>
#include <iostream>
#include <random>
#include <chrono>
#include "cuda_runtime_api.h"
#define N 8
#define MAX 20
#define PERCENTAGEINTERVAL 5
/* this GPU kernel function is us... |
21,252 | /*
* Author:
* Yixin Li, Email: liyixin@mit.edu
* convert the image from LAB to RGB
*/
__global__ void lab_to_rgb( double * img, const int nPts) {
// getting the index of the pixel
const int t = threadIdx.x + blockIdx.x * blockDim.x;
if (t>=nPts) return;
double L = img[3*t];
double La = img[3*t+1];
doub... |
21,253 | #include <iostream>
#include <stdio.h>
#include <malloc.h>
#include <cuda.h>
#include <sys/time.h>
// helper for main()
long readList(long**);
// data[], size, threads, blocks,
void mergesort(long*, long, dim3, dim3);
// A[]. B[], size, width, slices, nThreads
__global__ void gpu_mergesort(long*, long*, long, long, l... |
21,254 | #include <stdio.h>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
int n;
__global__ void BSearch(int* da,int num,int n) // kernel function definition
{
const int tid = blockIdx.x*blockDim.x + threadIdx.x;
if(da[tid]==num)
... |
21,255 | #include "array.cuh"
double * malloc_2d(int num_cols, int num_rows) {
int size = num_cols * num_rows;
double * data;
cudaMallocManaged(&data, size * sizeof(double));
return data;
}
double * calloc_2d(int num_cols, int num_rows) {
int size = num_cols * num_rows;
double * data;
cudaMallocManaged(&data, size * si... |
21,256 | #include "includes.h"
__global__ void set_value(float value, float *array, unsigned int size) {
int index = blockIdx.x * blockDim.x + threadIdx.x;
if (index < size)
array[index] = value;
} |
21,257 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
float* make_matrix(const int blurKernelWidth);
int main(int argc, char ** argv) {
float simple_matrix[] = {0.0f, 0.2f, 0.0f, 0.2f, 0.2f, 0.2f, 0.0f, 0.2f, 0.0f};
make_matrix(3);
printf("\n");
make_matrix(9);
}
float* make_matrix(const int blurKernel... |
21,258 | /*
* How to compile (assume cuda is installed at /usr/local/cuda/)
* nvcc add.cu
* ./a.out
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <time.h>
#include <cuda_runtime.h>
#define N 2048
__global__ void add_kernel(int* a, int* b, int*c){
c[blockIdx.x] = a[blockIdx.x] + b[blockIdx.... |
21,259 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <cstdio>
#include <iostream>
const int N = 1024;
const int BLOCKSIZE = 16;
dim3 dimBlock(BLOCKSIZE, BLOCKSIZE);
// N / bs + ((N % bs) != 0);
dim3 dimGrid((N / dimBlock.x) + 1, (N / dimBlock.y) + 1);
__global__ void addMatrix(const float* a... |
21,260 | #include "includes.h"
/*
* This code is released into the public domain.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LI... |
21,261 | #include "includes.h"
__global__ void conv_vertical_naive_gradParam(const int n, float *dw, const float *x, const float *dy, const int kL, const int oH, const int oW)
{
for (int i = blockIdx.x*blockDim.x+threadIdx.x; i < n; i += blockDim.x*gridDim.x) {
int dy_offset = (i/kL)*oH*oW;
int x_offset = (i/kL)*oH*oW + (i%kL)*... |
21,262 | #include "includes.h"
__global__ void kernel_2(float *d_data_in, float *d_data_out, int data_size)
{
__shared__ float s_data[BLKSIZE];
int tid = threadIdx.x;
int index = tid + blockIdx.x*blockDim.x;
s_data[tid] = 0.0;
if (index < data_size){
s_data[tid] = d_data_in[index];
}
__syncthreads();
for (int s = 2; s <= block... |
21,263 | #include <stdio.h>
#include <stdlib.h>
#include <string>
#include <math.h>
#include <assert.h>
#include <unistd.h>
#include "cuda_runtime.h"
void checkCUDAerror(const char *msg);
// kernel to make the calculation.
__global__ void calc(float* a1, float* b1, float* c1,float* a2, float* b2, float* c2, float* a3, f... |
21,264 |
// Number of threads per block.
#define NT 1024
// Structure for a 3-D point.
typedef struct {
double x;
double y;
double z;
}point_t;
// Structure for a solution.
typedef struct {
int a;
int b;
double d;
}solution_t;
// Variables in global memory.
__device__ int devBestSol;
// Per-thread variables in ... |
21,265 | /*
makematrix.cu
Constructs matrix equation A x = b for local minimization problem
Exports matrix A and vector b into plain text
Written by Hee Sok Chung at ANL
July 10, 2016
Modified by Ran Hong for cuda compatibility
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// For the CUDA runtime routines ... |
21,266 | #include <cstdio>
__global__ void cuda_hello(){
printf("Hello World from GPU!\n");
}
int main() {
int cnt{0};
cudaGetDeviceCount(&cnt);
printf("Number of GPUs: %d\n", cnt);
int version;
cudaRuntimeGetVersion(&version);
cudaDeviceProp prop;
cudaGetDeviceProperties(&prop, 0);
print... |
21,267 | #include "util.cuh"
__device__
int
datacmp(const unsigned char *l_dat, const unsigned char *r_dat, uint32_t len) {
int match = 0;
uint32_t i = 0;
uint32_t done = 0;
while ( i < len && match == 0 && !done ) {
if ( l_dat[i] != r_dat[i] ) {
match = i + 1;
if ( (int)l_dat[i... |
21,268 | #include "includes.h"
#ifdef __CUDACC__
#define KERNEL_ARGS2(grid, block) <<< grid, block >>>
#define KERNEL_ARGS3(grid, block, sh_mem) <<< grid, block, sh_mem >>>
#define KERNEL_ARGS4(grid, block, sh_mem, stream) <<< grid, block, sh_mem, stream >>>
#else
#define KERNEL_ARGS2(grid, block)
#define KERNEL_ARGS3(grid, blo... |
21,269 | #include "includes.h"
__global__ void transposeSmemUnrollPadDyn (float *out, float *in, const int nx, const int ny)
{
// dynamic shared memory
extern __shared__ float tile[];
unsigned int ix = blockDim.x * blockIdx.x * 2 + threadIdx.x;
unsigned int iy = blockDim.y * blockIdx.y + threadIdx.y;
unsigned int ti = iy * nx... |
21,270 |
//Calculo de la FFT 2D utilizando la funcion cufftPlan2D();
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <stdlib.h>
#include <cufft.h>
#define RENGLONES 3
#define COLUMNAS 3
int main()
{
int i,j;
cuFloatComplex *h_xn;
cuFloatComplex *h_Xk;
cufftComplex *in,*out;... |
21,271 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
int A[5] = { 1, 2, 3, 4, 5 };
__device__ int d_A[5];
__global__ void multiply()
{
int i = threadIdx.x;
d_A[i] = d_A[i] * 2;
}
int main()
{
cudaMemcpyToSymbol(d_A, A, 5 * sizeof(int));
multiply <<< 1, 5 >>> ();
cudaMemcpyFromSy... |
21,272 | #include <stdio.h>
#include <iostream>
#include <vector>
#include <time.h>
#include <math.h>
#define CUDA_CHECK(condition) \
/* Code block avoids redefinition of cudaError_t error */ \
do { \
cudaError_t error = condition; \
if (error != cudaSuccess) { \
std::cout << cudaGetErrorString(error) << std:... |
21,273 | #include "includes.h"
__global__ void query_ball_point_gpu(int b, int n, int m, const float *radius, int nsample, const float *xyz1, const float *xyz2, int *idx, int *pts_cnt) {
int batch_index = blockIdx.x;
xyz1 += n*3*batch_index;
xyz2 += m*3*batch_index;
idx += m*nsample*batch_index;
pts_cnt += m*batch_index; // cou... |
21,274 | #include <stdio.h>
__global__ void add(int *a, int *b, int *c) {
*c = *a + *b;
}
int main(void) {
int *d_a, *d_b, *d_c; // device copies of a, b, c
int size = sizeof(int);
// Allocate space for device copies of a, b, c
cudaMallocManaged(&d_a, size);
cudaMallocManaged (&d_b, size);
cudaMa... |
21,275 | #include <iostream>
//Keyword __global__ is used to indicate the function will be run on the GPU
__global__ void kernel(int *a, int *b, int *c){
//This function is compiled by nvcc where as the other functions are handled by g++ or gcc
*c = *a + *b;
}
int main(int argc, char const *argv[]) {
/* code */
int a,b... |
21,276 | /*
Matt Dean - 1422434 - mxd434
Goals implemented:
- Block scan for arbitrary length small vectors - 'blockscan' function
- Full scan for arbitrary length large vectors - 'scan' function
This function decides whether to perform a small (one block) scan or a full (n-level) scan depending on the length of the ... |
21,277 | #include "includes.h"
__global__ void neighbor_kernel(double *cellStatePtr, double *cellVDendPtr) {
} |
21,278 | #include<stdio.h>
int main(void){
printf("Hello world!");
return 0;
}
|
21,279 | /*
* Copyright 2014 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law ... |
21,280 | #include "includes.h"
__global__ void pod_racing(unsigned int *d_rand, unsigned int *win, unsigned int *loss, unsigned int size, int *iter) {
int index = threadIdx.x + blockDim.x*blockIdx.x;
const unsigned int flips[] = { 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1 };
if (index < size) {
//printf("%d ", iter[0]);
if... |
21,281 | #include "cuda.h"
#include "stdio.h"
#include "stdlib.h"
// for cuda profiler
#include "cuda_profiler_api.h"
#define M_s 1.f // Solar mass
#define G 39.5f// Gravitational constant Solar mass, AU
// single precision CUDA function to be called on GPU
__device__ float potential_thingy(float x, float y) {
return G *... |
21,282 | #include<stdio.h>
#define N 2000000
#define BLOCK_SIZE 1024
//using namespace std;
__global__ void ReduceMin(int n, int *input, int *output){
__shared__ int sh[BLOCK_SIZE];
int tid = threadIdx.x;
int myId = threadIdx.x + blockIdx.x*blockDim.x;
if(tid<BLOCK_SIZE)
sh[tid] = input[myId];
else
sh[tid] = INT_MAX;
__syncthr... |
21,283 | #include "../include/encoding.cuh"
__device__ float* get2df(float* p, const int x, int y, const int stride) {
return (float*)((char*)p + x*stride) + y;
}
__global__ void encodeLevelId(
float* level_hvs, float* id_hvs, float* feature_matrix, float* hv_matrix,
int level_stride, int id_stride, int fm_stride... |
21,284 | #include <cuda.h>
#include <device_launch_parameters.h>
#define PIXEL_COLOR 0xFF585858;
extern "C"
{
__constant__ int D_SIZE;
__constant__ float D_ALPHA;
__constant__ float D_BETA;
//__constant__ float D_SCALE;
__constant__ float D_XSCALE;
__constant__ float D_YSCALE;
__constant__ float D_XMIN;
__constant__... |
21,285 | // includes
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <cuda_runtime.h>
//-------------Funcion sumar velocidad
__global__ void densidad_suma_doble_if(float * pdist,float * psum, int node) {
int ndist=9; //numero de funcion de distribucion
int x = threadIdx.x + blockIdx.x * blockDim.x;
int y ... |
21,286 | #include "includes.h"
__global__ void markValidIndexMapPixelKernel( cudaTextureObject_t index_map, int validity_halfsize, unsigned img_rows, unsigned img_cols, unsigned char* flatten_validity_indicator ) {
const auto x_center = threadIdx.x + blockDim.x * blockIdx.x;
const auto y_center = threadIdx.y + blockDim.y * bloc... |
21,287 | // This code produces segmentation fault.
// I have intentionally written the code to print out GPU array element directly, which is NOT possible
#include <stdio.h>
__global__ void cube(float *d_out, float *d_in) {
int idx = threadIdx.x;
float f = d_in[idx];
d_out[idx] = f * f * f;
return;
}
int main(... |
21,288 | /******************************************************************************
*cr
*cr (C) Copyright 2010 The Board of Trustees of the
*cr University of Illinois
*cr All Rights Reserved
*cr
*****************************************************************... |
21,289 | #include<cstdlib>
#include<stdio.h>
void initialize(float* mtx, int const nx, int const ny){
int tmp = nx*ny;
for(int i=0; i<tmp; i++){
mtx[i] = rand()/(float)RAND_MAX;
}
};
__global__ void sumMatrix2D2D(float* d_a, float* d_b, float* d_c, int const nx, int const ny){
int i = blockIdx.x*bloc... |
21,290 | #include <cuda.h>
#include <vector>
#include <cstdio>
#include <cstdlib>
template <typename T, std::size_t capacity>
struct queue {
int size = 0;
T data[capacity];
__device__ bool insert(const T& value) {
int result = atomicAdd(&size, 1);
if (result >= capacity) {
// Queue is overflowing. Do not... |
21,291 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <sys/timeb.h>
void Multiplication(float *__restrict__ c, float * a, float * b, int N)
{
#pragma acc parallel loop present(c, a, b)
for (int n = 0; n < N; n++)
{
for (i... |
21,292 | #include <stdio.h>
#include <math.h>
#define N 1000000
// function to add the elements of two arrays
__global__ void add(int n, float *x, float *y)
{
int index = threadIdx.x ;
int stride = blockDim.x ;
for (int i=index;i<=n;i+=stride)
y[i] = x[i] + y[i];
}
int main(void)
{
int i;
float maxError = 0.0f;
... |
21,293 | #include "includes.h"
const int Nthreads = 1024, maxFR = 5000, NrankMax = 6;
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////... |
21,294 | #include <stdio.h>
// Reduce
__global__
void reduce_kernel(float * d_out, const float * d_in, int n, int op)
{
// sdata is allocated in the kernel call: 3rd arg to <<<b, t, shmem>>>
extern __shared__ float sdata[];
int myId = threadIdx.x + blockDim.x * blockIdx.x;
int tid = threadIdx.x;
// load... |
21,295 | #include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <time.h>
#include <cassert>
#define ITERATIONS 1
#define FINDS 10000
#define M 1046527
#define LINEAR 1
#define BINARY 2
using namespace std;
int main(int argc, char ** argv){
long total_time = 0;
struct timespec start, stop... |
21,296 | #include <stdio.h>
#include <math.h>
__global__ void
MatAdd(const float *A, const float *B, float *C, int N)
{
int i = blockDim.x * blockIdx.x + threadIdx.x;
int j = blockDim.y * blockIdx.y + threadIdx.y;
if (i < N && j < N)
{
int indx = i + j*N;
C[indx] = A[indx] + B[indx];
}
}
/**... |
21,297 | #include "includes.h"
__global__ void NormalizePositionKernel( float *input, float *normalized, float xMax, float yMax )
{
int threadId = blockDim.x*blockIdx.y*gridDim.x //rows preceeding current row in grid
+ blockDim.x*blockIdx.x //blocks preceeding current block
+ threadIdx.x;
if(threadId < 1)
{
normalized[0] = ... |
21,298 | /*
* SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the Lic... |
21,299 | #include "includes.h"
__device__ unsigned int Rand(unsigned int randx)
{
randx = randx*1103515245+12345;
return randx&2147483647;
}
__global__ void setRandom(float *gpu_array, int N, int maxval )
{
int id = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;
if( id < N ){
gpu_array[id] = 1.0f / maxval * Ran... |
21,300 | #include <float.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#define BLOCK_SIZE 50
//Um teste comparando a eficiência de uma
//multiplicação de matrizes por CPU ou GPU
//utilizando memória compartilhada ou global
typedef struct {
int width;
int height;
int s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.