serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
2,001 | #include<stdio.h>
__global__ void parallel_vector_add(int *d_a, int *d_b, int *d_c, int *d_n){
int i = (blockIdx.x*blockDim.x)+threadIdx.x ;
printf("I am thread #%d\n", i) ;
if(i < *d_n){
printf("T am about to compute c[%d].\n", i) ;
d_c[i] = d_a[i] + d_b[i] ;
}
else{
printf("I am doing nothing.\n") ;
}
}
... |
2,002 | /*
Non-separable 2D, 3D and 4D Filtering with CUDA
Copyright (C) <2013> Anders Eklund, andek034@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the Licens... |
2,003 | #include <cuda.h>
#include <cuda_runtime.h>
#include <thrust/device_vector.h>
#include <thrust/generate.h>
#include <thrust/host_vector.h>
#include <algorithm>
#include <cstdio>
#include "a.cuh"
void test(int offset) {
printf("start\n");
thrust::device_vector<int> X(2 << offset);
std::generate(X.begin(),... |
2,004 | /*
#include "KernelDependencies.h"
// TODO: teste collecting cells first and intersecting later. reduces registers,
// but without mem coalescing it is actually 1/3 original performance (300fps for 1 triangle)
// Kernel dependencies
#include "KernelDependencies.h"
// Global constants
static __device__ const float... |
2,005 |
#include <stdio.h>
#include <assert.h>
#include <iostream>
#include <cuda.h>
#include <cuda_runtime.h>
#include <limits>
#ifndef MAX
#define MAX(a,b) (a > b ? a : b)
#endif
__global__ void vectorAddGPU(float *a, float *b, float *c, int N, int offset)
{
int idx = blockIdx.x*blockDim.x + threadIdx.x;
if (... |
2,006 | #include <iostream>
#include <stdio.h>
#include <cuda_runtime.h>
#include <chrono>
__global__ void warmingup(float *c) {
int tid = blockIdx.x*blockDim.x + threadIdx.x;
float a, b;
a=b=0.0f;
if (tid%2==0){
a=100.0f;
} else {
b=200.0f;
}
c[tid] = a+b;
}
__global__ void mathKernel1(float *c) {
in... |
2,007 | #include <stdio.h>
#include <stdlib.h>
#include <cuda_runtime.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include "assert.h"
using namespace std;
std::vector<int> readFile(string filename)
{
ifstream infile (filename);
vector<int> vnum;
string line;
int index = 0;
... |
2,008 | #include "cuda_runtime.h"
#include <iostream>
__global__ void empty() {}
int main() {
int device_id = 0;
cudaSetDevice(device_id);
cudaStream_t stream;
cudaStreamCreate(&stream);
cudaEvent_t start, end;
cudaEventCreate(&start);
cudaEventCreate(&end);
int repeat = 1000;
cudaEventRecord(start, str... |
2,009 | __device__ float fracf(float x) {
return x - floorf(x);
}
__device__ float random (float s, float t, float *rSeed) {
return fracf(sinf(s*12.98123198*rSeed[0] + t*78.231233*rSeed[1])*43758.5453123);
}
__device__ float fitness(
float p1x, float p1y, float p2x, float p2y, float p3x, float p3y,
float *obs,... |
2,010 | // Matrix addition, CPU version
// gcc matrix_cpu.c -o matrix_cpu -std=c99
#include <stdio.h>
#include <math.h>
void printDeviceProperties(){
cudaDeviceProp prop;
cudaGetDeviceProperties(&prop, 0);
printf(" Device name: %s\n", prop.name);
printf(" Memory Clock Rate (KHz): %d\n",
prop.memoryClockRate);
pri... |
2,011 | /*
* Module : Twine
* Copyright : [2016..2017] Trevor L. McDonell
* License : BSD3
*
* Maintainer : Trevor L. McDonell <tmcdonell@cse.unsw.edu.au>
* Stability : experimental
* Portability : non-portable (GHC extensions)
*
* Convert between Accelerate's Struct-of-Array representation of complex
*... |
2,012 | #include <iostream>
#include "../include/gdeque.h"
#include <thrust/device_vector.h>
#define def_dvec(t) thrust::device_vector<t>
#define to_ptr(x) thrust::raw_pointer_cast(&x[0])
using namespace std;
__global__ void test(float *output){
gpu_stl::deque<float> deque;
int idx = 0;
output[idx++] = deque.empt... |
2,013 | #include "includes.h"
__global__ void doNothing() {} |
2,014 | #include <stdio.h>
#include <cuda.h>
// size of array
#define N 4096
//vector addition kernel
__global__ void vectorAddKernel(int *a, int *b, int *c)
{
int tdx = blockIdx.x * blockDim.x + threadIdx.x;
if(tdx < N)
{
c[tdx] = a[tdx] + b[tdx];
}
}
int main(void)
{
cudaSetDevice(3);
// grid and block sizes
dim... |
2,015 | #include "includes.h"
__global__ void kernel ( void ) {
} |
2,016 | #include<iostream>
#define SECTION_SIZE 32
using namespace std;
__global__ void Prefix_sum_oneblock_kernel(float *X, float *Y, int InputSize, float *S) {
__shared__ float XY[SECTION_SIZE];
int i = blockIdx.x*blockDim.x+ threadIdx.x;
XY[threadIdx.x] = X[i];
/*if (i < InputSize && threadIdx.x != 0) {
... |
2,017 | #include <stdio.h>
#include <cuda.h>
const int MAX_THREAD_NUMBER = 1000000;
__device__ long long counterArray[MAX_THREAD_NUMBER] = {0};
extern "C" __device__ void bambooProfile(long bambooIndex)
{
int blockId = blockIdx.x
+ blockIdx.y * gridDim.x
+ gridDim.x * gridDim.y * blockIdx.z;
long long index = blockI... |
2,018 | /*
Implementing parallell plus reduce in CUDA.
*/
#include <stdio.h>
#define NUM_THREADS 16
#define NUM_BLOCKS 8
unsigned int serial_reduce(unsigned int* array, const unsigned int size){
unsigned int sum = 0;
for(int i = 0; i < size; i++){
sum += array[i];
}
return sum;
}
__global__ void re... |
2,019 | // Corresponding header file: /include/mirror_ops.h
#include <cuda_runtime.h>
#include <stdio.h>
/* Mirror operations */
__global__
void mirror(const uchar4* const inputChannel, uchar4* outputChannel, int numRows, int numCols, bool vertical)
{
int col = blockIdx.x * blockDim.x + threadIdx.x;
int row = blockI... |
2,020 |
__global__ void vecAdd(float *in1, float *in2, float *out, int len) {
int i = threadIdx.x + blockDim.x * blockIdx.x;
if (i < len)
out[i] = in1[i] + in2[i];
}
int main(int argc, char **argv) {
int inputLength = 1<<28;
float *hostInput1;
float *hostInput2;
float *hostOutput;
/*hostInput1 = (float*... |
2,021 | //
// Created by heidies on 7/8/18.
//
#include <cuda_runtime.h>
#include <iostream>
#include <sys/time.h>
using namespace std;
#define CHECK(call) \
{ \
const cudaError... |
2,022 | #include <stdio.h>
#define CUCHK(call) { \
cudaError_t err = call; \
if( cudaSuccess != err) { \
fprintf(stderr, "Cuda error in file '%s' in line %i : %s.\n", \
... |
2,023 | #include "includes.h"
__global__ void Dx_Forward_Kernel(float* output, const float* input, const int width, const int height, const int nChannels)
{
int x = threadIdx.x + blockIdx.x * blockDim.x;
int y = threadIdx.y + blockIdx.y * blockDim.y;
if (x >= width || y >= height)
return;
int offset = y*width + x;
if (x == w... |
2,024 | #include <cuda.h>
__global__ void deviceburst(float *x, float *initsums, int n, int k, float *bigmaxs, int *startend) {
int partition = (n - k + 1) / (blockDim.x * gridDim.x) + 1;
int me = blockIdx.x * blockDim.x + threadIdx.x;
int left = me * partition;
int left_limit = left + partition;
int length = k;
... |
2,025 | #include <cuda_runtime.h>
#include <cstdio>
__global__ void my_kernel() {
int tid = threadIdx.x;
printf("Hello CUDA %d.\n", tid);
}
int main() {
my_kernel<<<1, 8>>>();
cudaDeviceSynchronize();
}
|
2,026 | #include <stdio.h>
#include <cuda_runtime.h>
#include <cufft.h>
#include <device_launch_parameters.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <ctime>
#include <string>
#include <fstream>
#include <math.h>
using namespace std;
#define rawR 7
#define rawC 840
#define rawL (rawR*rawC)
#define L... |
2,027 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cuda_runtime.h>
#include <cuda.h>
#define TW 16
__global__ void matrix_sum(int *C, int *A, int *B, int rows, int cols, int dim) {
// Get col
int col = blockDim.x * blockIdx.x + threadIdx.x;
// Get row
int row = blockDim.y * blockIdx.y ... |
2,028 | //
/*// Created by sergio on 13/02/19.
//
#include <iostream>
#include <stdint.h> // Para medir el clock
#include <cstdlib> // std
#include <iomanip> // Formateo de datos
#include <string>
#define CWIDTHLEFT 40
#define CWIDTHRIGHT 30
#include <cuda.h>
#include <cuda_runtime.h>
#include <device_l... |
2,029 | // RUN: %clangxx -ccc-print-phases --sysroot=%S/Inputs/SYCL -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=nvptx64-nvidia-cuda -Xsycl-target-backend --cuda-gpu-arch=sm_80 --cuda-gpu-arch=sm_80 -c %s 2>&1 | FileCheck %s --check-prefix=DEFAULT-PHASES
// Test the correct placement of the offloading actions for... |
2,030 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Tomás Oliveira e Silva, November 2017
//
// ACA 2017/2018
//
// modify_sector CUDA kernel (each thread deals with one sector)
//
extern "C" __global__
void modify_sector_cuda_kern... |
2,031 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
__global__ void imageblur( int* inputImage, int* outputImage, int filterSize, double* filter, int imageRow, int imageCol){
int pixelx = blockIdx.x * blockDim.x + threadIdx.x;
int pixely = blockIdx.y * blockDim.y + threadIdx.y;
double... |
2,032 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <sys/time.h>
#include <algorithm>
#include <unistd.h>
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
// Max threadsize is 1024 32*32
typedef unsigned char ubyte;
void... |
2,033 | #include <cuda_runtime.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef PRINT_SUFFIX
#define PRINT_SUFFIX "<find_cudadevices>"
#endif
#define MY_CUDA_VER (__CUDACC_VER_MAJOR__ * 100 + __CUDACC_VER_MINOR__)
inline void check(cudaError_t result)
{
if (result)
{
fprintf(stderr, PRINT_SUFFIX "%s (%s)", ... |
2,034 | #include <vector>
#include <stdint.h>
#include <stddef.h>
__device__ bool NV12ToRGB(uint8_t * pData, int Height, int Width, int bitdepth, void * pOut)
{
} |
2,035 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define I(ix,iz) (ix)+nx*(iz)
# define PI 3.141592653589793
__global__ void propagator_U(float *Ux, float *Uz, float *Txx, float *Txz, float *Tzz, float *P, int nx, int nz, float dt, float dh)
{
int ix = threadIdx.x + blockDim.x * blockIdx.x;
int iz = threadI... |
2,036 | #include <iostream>
#include <numeric>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <cuda.h>
#include <curand.h>
#include <math.h>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <ctime>
static void CheckCudaErrorAux (const char *, unsigned, const char *, cudaError_t);
void sequen... |
2,037 | #include<stdio.h>
#include<stdlib.h>
__global__ void mykernel(int* a,int* b,int* c){
//no code is here
*c=*a+*b;
}
int main(){
int a=1;
int b=9;
int c;
int* d_a;
int* d_b;
int* d_c;
cudaMalloc((void**)&d_a,sizeof(int));
cudaMalloc((void**)&d_b,sizeof(int));
cudaMalloc((void*... |
2,038 | __global__ void JacobiSVD(int* S, int* V, int m, int n)
{
const int iterations = 30;
int tid_x = threadIdx.x;
int bsz_x = blockDim.x;
int tid_y = threadIdx.y;
int gid_y = blockIdx.y * blockDim.y + tid_y;
__shared__ int acc[512];
int* acc1 = acc;
int* acc2 = acc + 256;
__shared__ i... |
2,039 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <ctime>
#include <algorithm>
#define Color uchar4
float4 Sum(float4 a, Color b, float coef)
{
return { a.x + (float)b.x * coef,
a.y + (float)b.y * coef,
a.z + (float)b.z * coef,
... |
2,040 | #include <thrust/sort.h>
struct t
{
int j,k,l;
};
int main()
{
const int N = 6;
int i;
int keys[N] = { 1, 4, 2, 8, 5, 7};
struct t values[N]= { {3,4,5},{5,6,7},{8,9,10},{11,12,13},{14,15,16},{17,18,19}};
//int *values2[N]= { {13,14,15},{15,16,17},{18,19,110},{111,112,113},{114,15,16},{17,18,19... |
2,041 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
#define NUM_DATA 512
__global__ void vecAdd(int *a,int *b,int *c)
{
int tid = threadIdx.x;
c[tid] = a[tid] + b[tid];
}
int main()
{
int *a,*b,*c;
int *d_a,*d_b... |
2,042 | #include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include <cuda_runtime.h>
#define CHECK(cmnd) { \
cudaError_t ierr = cmnd; \
if (ierr != cudaSuccess) { \
printf("Error: %s:%d: ", __FILE__, __LINE__, cudaGetErrorString(ierr)); \
exit(ierr); ... |
2,043 | #include "includes.h"
__global__ void cube(float * d_out, float * d_in){
// Todo: Fill in this function
int index = threadIdx.x;
float f = d_in[index];
d_out[index] = f*f*f;
} |
2,044 | #include <stdio.h>
#define T 16 // As Threads
#define array_size 64
__global__ void vecMultiplyReverse(int *A, int *B, int *C)
{
int i = blockIdx.x * blockDim.x + threadIdx.x;
if(i%2 == 0)
{
C[i] = A[i] + B[i];
}
else if(i%2 != 0)
{
C[i] = A[i] - B[i];
}
}
int main (int ar... |
2,045 | #include <cuda.h>
#include <cuda_runtime.h>
#include <math.h>
#include <math_constants.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/generate.h>
#include <thrust/sort.h>
#include <thrust/copy.h>
#include <cstdlib>
#def... |
2,046 | #include "includes.h"
__global__ void sga_up_forward (const int n, const float *filters, const int height, const int width, const int depth, const int wsize, float *top_data){
int index = blockIdx.x * blockDim.x + threadIdx.x;
if (index >= n)
{
return;
}
int step = height * width;
// int wsize=radius+1;
int base =... |
2,047 | #include <stdio.h>
void create_diagonal_matrix(float *Dmatrix, float matrix[3], int array_length)
{
for(int i=0;i<array_length;i++)
{
for(int j=0;j<array_length;j++)
{
if(i==j)
Dmatrix[j*array_length+i]=matrix[i];
else
Dmatrix[j*array_leng... |
2,048 | #include "includes.h"
__global__ void init_one_vec(float* d_one_vec, size_t length)
{
int i = blockIdx.x * blockDim.x + threadIdx.x;
if (i >= length) return;
d_one_vec[i] = 1.f;
} |
2,049 | #include "includes.h"
//Macros
#define min(a, b) ( (a)<(b)? (a): (b) )
#define max(a, b) ( (a)>(b)? (a): (b) )
//Constants
#define MAX_VECTOR_COUNT 5
//Vector structure
typedef struct {
float e[3];
}Vec3f;
//Global array
Vec3f vecArray[MAX_VECTOR_COUNT];
Vec3f newvecArray[MAX_VECTOR_COUNT];
//forward declarations
... |
2,050 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <string.h>
#define NUM_ELEMENTS 7
#define MAX_ELEMENTS_BLOCK 2048
struct Point
{
unsigned int X;
unsigned int Y;
unsigned int leftID; // counter-clockwise neighbor
unsigned int rightID; // clockwise neighbor
};
extern _... |
2,051 |
/* This is a automatically generated test. Do not modify */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
__global__
void compute(float comp, int var_1,int var_2,float var_3,float var_4,float var_5,float var_6,float var_7,float var_8,float var_9,float var_10,float var_11,float var_12,float var_13,float va... |
2,052 | #include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/transform.h>
struct saxpy_functor
{
const float a;
saxpy_functor(float _a) : a(_a) {}
__host__ __device__
float operator()(float x, float y) {
return a*x+y;
}
};
void saxpy(float a, thrust::device_vector<float>& x,
thrust::devi... |
2,053 | __global__ void convolution(int filterWidth,float *filter,int imageHeight,int imageWidth,float *inputImage,float *outputImage)
{
int i= blockIdx.x * blockDim.x + threadIdx.x;
int j= blockIdx.y * blockDim.y + threadIdx.y;
// Iterate over the rows of the source image
int halffilterSize = filterWidth >> 1 ;
float su... |
2,054 | #include "includes.h"
//Udacity HW 4
//Radix Sorting
__global__ void histogram(unsigned int* in, unsigned int* hist, int n,unsigned int nBins, unsigned int mask, unsigned int current_bits)
{
extern __shared__ unsigned int s_local_hist[];
for(int j = threadIdx.x; j < nBins; j += blockDim.x)
s_local_hist[j] = 0;
_... |
2,055 | #include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <cuda_runtime.h>
__global__ void simpleKernel(float *dst, float *src1, float *src2)
{
const int idx = blockIdx.x * blockDim.x + threadIdx.x;
//float temp = src[idx];
dst[idx] = src1[idx] + src2[idx];
}
int execute_uva(bool copy=false, bool prin... |
2,056 | // to use CUDA, uncomment the following line
#define USE_CUDA
#include <stdio.h>
#include <time.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cuComplex.h>
#define COLOR_DEPTH 256
#define DEFAULT_WIDTH 3840
#define DEFAULT_HEIGHT 2160
#define MAX_THREAD 65536
#ifndef USE_CUDA
void computePixelNoGPU(cuDoub... |
2,057 | #define uint unsigned int
#define HX(i,j,n) Hx[i+IHx*(j)+IHx*JHx*n]
#define BX(i,j,n) Bx[i+IHx*(j)+IHx*JHx*n]
#define HY(i,j,n) Hy[i+IHy*(j)+IHy*JHy*n]
#define BY(i,j,n) By[i+IHy*(j)+IHy*JHy*n]
#define EZ(i,j,n) Ez[i+IEz*(j)+IEz*JEz*n]
#define DZ(i,j,n) Dz[i+IEz*(j)+IEz*JEz*n]
#define DZX(i,j,n) Dzx[i+IEz*(j)+IEz*JEz*n... |
2,058 | #include "includes.h"
using namespace std;
int threads;
__global__ void gcd_vector(int * d_out, int integer_m){
int idx = threadIdx.x;
for(int i = idx; i<integer_m; i+=blockDim.x){
int u = i, v = integer_m;
while ( v != 0) {
int r = u % v;
u = v;
v = r;
}
if(u == 1){
d_out[idx]++;
}
}
} |
2,059 | #include "includes.h"
__global__ void FilmGradeKernelA( float* p_Input, int p_Width, int p_Height, float p_Exp) {
const int x = blockIdx.x * blockDim.x + threadIdx.x;
const int y = blockIdx.y * blockDim.y + threadIdx.y;
if(x < p_Width && y < p_Height) {
const int index = (y * p_Width + x) * 4;
p_Input[index] = p_Input[... |
2,060 | //pass
//--blockDim=512 --gridDim=1 --warp-sync=32 --no-inline
#include <cuda.h>
#include <stdio.h>
#define N 32
__global__ void scan (int* A)
{
int tid = threadIdx.x;
unsigned int lane = tid & 31;
if (lane >= 1) A[tid] = A[tid - 1] + A[tid];
if (lane >= 2) A[tid] = A[tid - 2] + A[tid];
if (lane >= 4) A[tid]... |
2,061 | #include "includes.h"
__global__ void VecAdd(int n, const float *A, const float *B, float* C) {
//DEVICE(GPU)CODE
/********************************************************************
*
* Compute C = A + B
* where A is a (1 * n) vector
* where B is a (1 * n) vector
* where C is a (1 * n) vector
*
****************... |
2,062 | //#include <stdlib.h>
//#include <stdio.h>
//#include <cuda_runtime.h>
//#include <helper_functions.h>
//#include <curand_kernel.h>
//#include "device_launch_parameters.h"
//#include "../../common/book.h"
//#include "../../common/cpu_anim.h"
//#include "../../common/Utils.h"
//#include "../../common/BlockUtils.h"
//#in... |
2,063 | #include <iostream>
#include <cmath>
#include <cstdlib>
#include <climits>
#include <cuda.h>
#include <cuda_runtime.h>
using namespace std;
#define SIZE 14*14
#define X_SIZE 14
#define NUM_EXAMPLES 3
#define BLOCK_SIZE 3
//Function prototype
//int SAT(int, int, int, int, int);
//Global variable
//Create big ass ar... |
2,064 | #include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <math.h>
#include <limits.h>
#include <float.h>
#include <iostream>
#include <sys/time.h>
#include <stack>
#define G 6.67408E-11 //Gravitational constant
#define lvl 9 //depth of quad tree till which we'll divide plane
using namespace std;
struct ve... |
2,065 | #include <stdio.h>
#include <ctime>
#include <cassert>
#include <cmath>
#include <utility>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <memory>
#include <iostream>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
float __device__ rad2deg(float radians)
{
return radians * 180.... |
2,066 | #include<iostream>
#include<time.h>
#include<climits>
#include<stdlib.h>
using namespace std;
__global__ void minimum(int *a, int *b, int n) {
int tid = threadIdx.x;
int min_limit = INT_MAX;
for(int i=tid; i<min(tid+256, n); i++) {
if(min_limit > a[i])
min_limit = a[i];
}
b[tid]... |
2,067 | #include <iostream>
#include <time.h>
#define N 50000
#define BLK_SIZE 256
using namespace std;
struct Atom
{
int x;
int y;
int z;
int a, b, c, d, e, f;
};
__global__ void AtomKernel(Atom *atoms, int *sum);
__global__ void CoalescedKernel(int *x, int *y, int *z, int *sum);
int main()
{
int i;
//host
Atom ... |
2,068 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <array>
#include <iomanip>
#include <chrono>
#include <fstream>
typedef std::chrono::high_resolution_clock Clock;
#define pi 3.14159265358979323846264338327950288419716... |
2,069 | /*
* makeProjection()
* Forms E and E^T matrices from eigenvectors
* float** eT: E^T, populated by function
* float** e: E, populated by function
* float** eigenvec: matrix of eigenvectors, unsorted
* int* indices: indices to accept from eigenvectors
* int N: degrees of freedom
*/
__global__ void makeProjection(... |
2,070 | #include <stdio.h>
#include <cuda.h>
#include <cuda_runtime.h>
struct Target
{
int2 min;
int2 max;
__device__ bool contains(int2 pos) const
{
return pos.x >= min.x && pos.x <= max.x
&& pos.y >= min.y && pos.y <= max.y;
}
};
__device__ bool simulate(Target target, int2 init_vel)
{
int2 vel = init_vel;
in... |
2,071 | #include <stdio.h>
__device__ int x;
__global__ void unaligned_kernel(void) {
*(int*) ((char*)&x + 1) = 42;
}
__device__ void out_of_bounds_function(void) {
*(int*) 0x87654320 = 42;
}
__global__ void out_of_bounds_kernel(void) {
out_of_bounds_function();
}
void run_unaligned(void) {
printf("Running... |
2,072 | #include "includes.h"
__global__ void HydroUpdatePrim_CUDA3_kernel(float *Rho, float *Vx, float *Vy, float *Vz, float *Etot, float *dUD, float *dUS1, float *dUS2, float *dUS3, float *dUTau, float dt, int size)
{
// get thread and block index
const long tx = threadIdx.x;
const long bx = blockIdx.x;
const long by = block... |
2,073 | //Based on the work of Andrew Krepps
#include <stdio.h>
#include <math.h>
#include <chrono>
/*
* Used for multiplying two square matrices of the same size.
* Uses shared memory to store matrix c until it is time to copy
* the final array out to the CPU.
*/
__host__ cudaEvent_t get_time(void)
{
cudaEvent_t time;
cuda... |
2,074 | #include "includes.h"
__global__ void NmDistanceKernel(int b,int n,const float * xyz,int m,const float * xyz2,float * result,int * result_i){
const int batch=2048;
__shared__ float buf[batch*5];
for (int i=blockIdx.x;i<b;i+=gridDim.x){
for (int k2=0;k2<m;k2+=batch){
int end_k=min(m,k2+batch)-k2;
for (int j=threadIdx.x;... |
2,075 | #include <assert.h>
#include <math.h>
#include <stdio.h>
#include <time.h>
#include <vector>
#include <cuda.h>
const int A = 1920;
const int B = 132;
const int C = 396;
std::vector<float> TakeNaive(const std::vector<float>& x,
const std::vector<int>& indices) {
std::vector<float> y(... |
2,076 |
/*****************************************************************************
Example : cuda-matrix-matrix-multiplication.cu
Objective : Write a CUDA Program to perform Matrix Matrix multiplication.
Input : None
Output : Execution time in seconds , Gflops achieved
... |
2,077 | #include "user_device.cuh"
__device__ float global_cache[GLOBAL_CACHE_SIZE];
/**
* function name: atomicMax_float
* Return Type: float
* Description:
* "atomicMax" for float.
* Compare old value (*maxVal) and new value (value).
* If new value is larger than old value, than new value will overwri... |
2,078 | #include "includes.h"
__global__ void CudaPermuteWeightsPVToCudnn( float *dest, float *src, int numArbors, int outFeatures, int ny, int nx, int inFeatures) {
// Parameter dimensions are PV source dimensions
int kSrc = (blockIdx.x * blockDim.x) + threadIdx.x;
if (kSrc < outFeatures * ny * nx * inFeatures) {
int kA = kS... |
2,079 | #include "Utils.cuh"
#include <curand.h>
#include <algorithm>
#include <cuda_profiler_api.h>
size_t Shape3d::size()const { return depth * height * width; }
Shape3d::Shape3d() : Shape3d(1) {}
Shape3d::Shape3d(size_t width) : Shape3d(1, width) {}
Shape3d::Shape3d(size_t height, size_t width) : Shape3d(1, height, width) ... |
2,080 | #include <iostream>
#include <cuda_runtime.h>
using namespace std;
#define N 20
#define BLOCK_DIM 10
void random_inits(int a[N][N]){
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
a[i][j] = rand() % 10;
}
}
}
__global__ void add(int a[N][N], int b[N][N], int c[N][N]){
int i = threadIdx.x;
int j... |
2,081 | #include <iostream>
#include <cuda_runtime.h>
using namespace std;
// Derived class
class Rectangle
{
public:
//don't use constructor
Rectangle()
{
// width = (int *)malloc(sizeof(int));
// height = (int *)malloc(sizeof(int));
// *width = 10;
... |
2,082 | #include<iostream>
__constant__ float M[10];
int main(){
float h_M[]={1,2,3,4,5,7,8,9,0};
cudaMemcpyToSymbol(M,h_M,10*sizeof(float));
std::cout<< "yo"<<std::endl;
}
|
2,083 | __device__ int evalDirt() {
return 4;
}
|
2,084 | #include "includes.h"
__global__ void conv2genericrev(float *input, float *kernel, float *output, int input_n, int input_h, int input_w, int kernel_n, int kernel_h, int kernel_w, float alpha, int stride_h, int stride_w)
{
// output dimensions
int output_h = input_h - (kernel_h - 1) * stride_h;
int output_w = input_w - ... |
2,085 | #include "includes.h"
__global__ void _bcnn_vadd_kernel(int n, float *a, float *b, float *y)
{
int i = (blockIdx.x + blockIdx.y * gridDim.x) * blockDim.x + threadIdx.x;
if (i < n)
y[i] = a[i] + b[i];
} |
2,086 | //This is simple naive programme(brute force)
//which runs in O(N^2)
#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <math.h>
#include <sys/time.h>
#define G 6.67408E-11
struct vector
{
float x, y;
};
//This function calculate the gravitational force
//between two bodies or particals
vector gravit... |
2,087 | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
__global__ void Babis_Kernel(double const *A, double *B, double const *G, int n, int m, int patchSize_x, int patchSize_y, double filtSigma)
{
int x,y,area_x,area_y;
double norm,w_temp,diff=0,W=0,Products=0;
// Set pixel coordinates
int i = blockIdx... |
2,088 | #include <stdio.h>
#define N 512
__global__ void add(int *a, int *b, int *c){
c[blockIdx.x] = a[blockIdx.x]+b[blockIdx.x];
}
void random_ints(int *a, int n){
for(int i=0; i<n; i++){
a[i] = rand()%10+1;
}
}
int main(void){
int *a,*b,*c;
int *d_a,*d_b,*d_c;
int size = N*sizeof(int);
cudaMalloc((void**)&d_a,... |
2,089 | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
#include <cuda.h>
void Algorithm2(int m, int n, int l);
// Block size used in algorithm 2 of GEMM
#define BLOCK_SIZE_x 32
#define BLOCK_SIZE_y 16
__device__ unsigned long long totThr = 0;
__global__ void device_Matrix_multi(const double* co... |
2,090 | #include <stdlib.h>
#include <stdio.h>
extern int HI; // the total number of point patterns
extern int HN; // the total number of points
extern int HK_star; // the total number of covariates
extern int Hd; // the dimensionality of the problem
extern int HV; // the total number of elements in the gr... |
2,091 | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
__global__ void vectAdd(int *a, int *b, int *c, int len)
{
int i;
i = blockIdx.x * blockDim.x + threadIdx.x;
if (i < len)
{
c[i] = a[i] + b[i];
}
}
/* Function computing the final string to print */
void vector_add(int *c... |
2,092 | #include <stdio.h>
#include <time.h>
#define MIN(a,b) (a < b ? a : b)
#define PRINT 0
static const int N = 50000;
__global__ void bubble_sort(int *array, int iteracio)
{
int id = threadIdx.x + blockIdx.x * blockDim.x;
if(iteracio%2 == 0 ){
if(array[2*id] > array[2*id+1])
{
int aux = array[2*id];
array[2*i... |
2,093 | #define MAX_THREADS 1024
#define MULT_TILE_WIDTH 16
__global__ void matrixMultiplyShared(float *A, float *B, float *C,
int numARows, int numAColumns,
int numBRows, int numBColumns,
int numCRows, int numCColum... |
2,094 | #include <stdio.h>
#include <stdlib.h>
#define CSC(call) \
do { \
cudaError_t res = call; \
if (res != cudaSuccess) { \
fprintf(stderr, "ERROR in %s:%d. Message: %s\n", \
__FILE__, __LINE__, cudaGetErrorStr... |
2,095 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include<stdio.h>
__global__ void star(char *a, int *n)
{ int i, j, t;
int k = *n;
int tid=threadIdx.x;
j = k - tid - 1;
t = (tid + 1) * 2 - 1;
for(i = 0; i < t; i++){
a[tid * (k * 2 - 1) + j + i] = '*';
}
}
int main(void)
{
int i, N, j;
s... |
2,096 | __global__ void set_one(float *array, int i) {
int id = threadIdx.x + blockIdx.x * blockDim.x;
if (id == 0) {
array[i] = 1.0f;
}
}
__device__ float gpu_logistic(float x) {
return 1 / (1 + expf(-x));
}
__global__ void activation_function(float x[], int n) {
int id = threadIdx.x + blockIdx.x... |
2,097 | __global__ void apply_blue(unsigned char *red_channel,unsigned char *green_channel,
const unsigned int width, const unsigned int height) {
const unsigned int row = threadIdx.y + blockIdx.y * blockDim.y;
const unsigned int col = threadIdx.x + blockIdx.x * blockDim.x;
if(row < height && col < width) {
... |
2,098 | /*
* Copyright 2015 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 ... |
2,099 | #include "includes.h"
__global__ void var(float * M1, float * M2, float * X, int b, size_t nele) {
int idx = blockIdx.x*blockDim.x + threadIdx.x;
if (idx<nele) {
float delta = X[idx] - M1[idx];
M1[idx] += delta / (b + 1);
M2[idx] += delta*(X[idx] - M1[idx]);
}
} |
2,100 | #include "file_reader.cuh"
#include "reader.cuh"
template<class T>
FileReader<T>::FileReader(std::string &filename, Probe &probe)
: Reader<T>(probe), filename_(filename), file_size_(0) {
set_filename(filename);
}
/**
* @brief Acquire samples_ from the file, so many frames at a time.
* @tparam T The type of sa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.