serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
5,901 |
/* 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,float 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... |
5,902 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <cstdio>
#include <cstdlib>
__global__ void kernelDeduct(double *a, double* b, double* c, size_t n) {
size_t i = blockDim.x*blockIdx.x + threadIdx.x;
size_t offset = gridDim.x*blockDim.x;
for (; i < n; i+= offset){
c[i] = a[i] - b[i]... |
5,903 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include "cufft.h"
using namespace std;
#define TILE_X 16
#define TILE_Y 16
#define MARGIN 35
//ڴ洢˲ϵijڴ
__constant__ double c_lpFilter[MARGIN];
__constant__ double c_hpFilter[MARGIN];
__constant__... |
5,904 | #include "includes.h"
// Possible weight coefficients for tracking cost evaluation :
// Gaussian discretisation
/*
* 1 4 6 4 1
* 4 16 24 16 4
* 6 24 36 24 6
* 4 16 24 16 4
* 1 4 6 4 1
*/
// Compute spatial derivatives using Scharr operator - Naive implementation..
// Compu... |
5,905 | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#define BLOCK_WIDTH 256
__global__ void histogram(char *d_array_in, int *d_array_out, int n)
{
__shared__ int shared_bin[128];
int i, index, blocks, iterations;
blocks = (n - 1) / BLOCK_WIDTH + 1;
iterations = 127 / (blocks * BLOCK_WIDTH) +... |
5,906 | extern "C"
{
__global__ void vmuldiv_dp(const double *a, const double *b, double *c)
{
int idx = threadIdx.x + blockIdx.x * blockDim.x;
c[idx] *= a[idx] / b[idx];
}
__global__ void vmuldiv_sp(const float *a, const float *b, float *c)
{
int idx = threadIdx.x + blockIdx.x * blockDim.x;
c[idx] *= a[idx] / b[idx]... |
5,907 | #include <stdio.h>
#include <cuda.h>
#define BLOCKSIZE 26
__global__ void dkernel() {
__shared__ char str[BLOCKSIZE+1];
str[threadIdx.x] = 'A' + (threadIdx.x + blockIdx.x) % BLOCKSIZE;
if (threadIdx.x == 0) {
str[BLOCKSIZE] = '\0';
}
//__syncthreads();
if (threadIdx.x == 0) {
printf("%d: %s\n", blockIdx.x, ... |
5,908 | #include "includes.h"
__global__ void ExpProbPolynomProbsImpl( const float* features, int batchSize, const int* splits, const float* conditions, const int* polynomOffsets, int polynomCount, float lambda, float* probs) {
if (threadIdx.x < batchSize) {
int polynomId = blockIdx.x;
features += threadIdx.x;
probs += threa... |
5,909 | // Name: Nishanth Baskaran
// Student ID: 19M15017
// HPSC Assignment-L5
#include <cstdio>
#include <cstdlib>
#include <vector>
__global__ void init(int *bucket) {
int i= blockIdx.x * blockDim.x + threadIdx.x;
bucket[i]=0;
}
__global__ void add(int *key,int *bucket){
int i= blockIdx.x * blockDim.x + threadIdx.x... |
5,910 | // Multiply two matrices A * B = C
// Original source: http://gpgpu-computing4.blogspot.co.id/2009/08/matrix-multiplication-1.html
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
// #include <matrixMul_kernel.cu>
// Thread block size
// #define BLOCK_SIZE 16
// #define TILE_SIZE 16
//
// #... |
5,911 | //pass
//--blockDim=1024 --gridDim=128
#include <cuda.h>
//--------------------------------------------------------------------------------------
// File: ComputeEngine.h
//
// This is an AMPC++ implementation of a compute shader. It transforms a shape with a
// rotation of an angle THETA.
//
// Copyright (c) Micros... |
5,912 | #include "includes.h"
#define SIZE 16
__global__ void compare(int *in_d, int* out_d)
{
if (in_d[blockIdx.x] == 6)
{
out_d[blockIdx.x] = 1;
}
else
out_d[blockIdx.x] = 0;
} |
5,913 | #include "includes.h"
__global__ void updateHiddenWeights(float* d_weights, float error, float lr, int keyPress, float* d_outputweights, int screenSize, int numHiddenNeurons, float* d_bias, float* firstFire){
int id = threadIdx.x + blockDim.x * blockIdx.x;
float totalChange = 0.0f;
for (int i = 0; i < screenSize; ++i)... |
5,914 | __global__ void vecadd(float *a, float *b, float* c)
{
// Get our global thread ID
int id = blockIdx.x;
// Make sure we do not go out of bounds
c[id] = a[id] + b[id];
}
|
5,915 | #include <stdio.h>
#include <cuda.h>
#include <string.h>
//testing commit
//ensure that your code is safeguarded against segmentstion faults etc...
__global__ void cypher_thread(char * t_input, char * t_output, int length){
int idx = threadIdx.x;
if(idx < length){
char c = t_input[idx];
t_out... |
5,916 | #include<cuda.h>
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
__global__ void extrapolKernel(
double* const rs, //RS
const double* const extVal,//Var extrapol
const double* c... |
5,917 | #include <iostream>
__global__ void add(int a, int b, int *c){
*c = a + b;
}
int main(void){
int c;
int *dev_c;
cudaMalloc((void**)&dev_c,sizeof(int));
add<<<1,1>>> (6, 9,dev_c);
cudaMemcpy(&c,dev_c,sizeof(int),cudaMemcpyDeviceToHost);
printf("6+9=%d\n",c);
cudaFree(dev_c);
return 0;
}
|
5,918 | #include "includes.h"
__global__ void ComputeDerivativesKernel(int width, int height, int stride, float* Ix, float* Iy, float* Iz, cudaTextureObject_t texSource, cudaTextureObject_t texTarget)
{
const int ix = threadIdx.x + blockIdx.x * blockDim.x;
const int iy = threadIdx.y + blockIdx.y * blockDim.y;
if (ix >= width... |
5,919 | #include <cuda_runtime.h>
#include <stdio.h>
// debug 模式启动
int main(){
int dev = 0;
cudaSetDevice(dev);
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp,dev);
printf("Device %d: %s \n",dev,deviceProp.name);
printf("Total amount of global memory %2.f Mbytes\n",deviceProp.totalGlob... |
5,920 | #include "includes.h"
__global__ void AddIntsCUDA(int* a, int* b) {
for (int i = 0; i < 1000005; i++) {
a[0] += b[0];
}
} |
5,921 | #include <iostream>
__global__ void axpy() {
}
int main(int argc, char* argv[]) {
// Launch the kernel.
axpy<<<1, 10>>>();
cudaDeviceReset();
return 0;
}
|
5,922 | #include <iostream>
#include "../ginkgo/GLevelOrderList.h"
#include <thrust/device_vector.h>
#define def_dvec(t) thrust::device_vector<t>
using namespace std;
typedef gpu_ginkgo::LevelOrderList<5> gglol;
__global__ void test(){
gglol *p;
p = new gglol(1024, true);
printf("p = new gglol(1024);");
p->sh... |
5,923 | #include "includes.h"
__global__ void fillPartitionLabelKernel(int size, int *coarseAggregate, int *fineAggregateSort, int *partitionLabel)
{
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if(idx < size)
{
partitionLabel[idx] = coarseAggregate[ fineAggregateSort[idx] ];
}
} |
5,924 | #include <thrust/device_vector.h>
#include <thrust/count.h>
#include <thrust/sequence.h>
#include <thrust/copy.h>
struct is_equal_count
{
int *tid_data;
int *count;
is_equal_count(int *tid, int *c) : tid_data(tid), count(c) {}
__host__ __device__
void operator() (const int & i)
{
if (tid_data[i] != t... |
5,925 | #include "prefix_sum_cuda.cuh"
__global__ void prefix_sum_cuda(int *a, size_t N) {
int tid = threadIdx.x;
int i = 0;
for (i = 2; i <= N; i *= 2) {
if (((i - tid % i) == 1) && tid != 0) {
a[tid] = a[tid] + a[tid - i / 2];
}
__syncthreads();
}
if (tid == N - 1) {
... |
5,926 | #include <stdio.h>
#include <cuda.h>
#include <cuda_runtime_api.h>
__global__ void axpy(float a, float *xVec, float *yVec){
int idx = blockIdx.x * blockDim.x + threadIdx.x;
yVec[idx] = a*xVec[idx] + yVec[idx];
}
int main(int argc, char** argv){
int N = atoi(argv[1]);
float a = 0.5;
float *x_host = (float *)mal... |
5,927 | /*https://cdac.in/index.aspx?id=ev_hpc_gpu-comp-nvidia-cuda-streams#hetr-cuda-prog-cuda-streams*/
#include <stdio.h>
#include <time.h>
#include <cuda.h>
//#define sizeOfArray 1024*1024
// 1. Execute Everything synchronously
// 2. Execute Everything asynchronously
// 3. Execute Memcpy Synchronously and kernel laun... |
5,928 | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#define LY 9460730472580800 // Light-year
#define G 6.67408e-11
#define BLOCK_Z 1
#define BLOCK_Y 1
#define BLOCK_X 1024
#define GRID_Z 1
#define GRID_Y 1
#define GRID_X 1024
#define TotalPoint BLOCK_X * BLOCK_Y * BLOCK_Z * GRID_X * GRID_Y * ... |
5,929 | #include "includes.h"
__global__ void Float(float * x, bool* y, size_t idxf, size_t idxb, size_t N)
{
for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < N; i += blockDim.x * gridDim.x)
x[(idxf)*N + i] = float(y[(idxb-1)*N + i]);
return;
} |
5,930 | #include "includes.h"
__global__ void profileLevelZero_kernel() {} |
5,931 | #include <iostream>
#include <math.h>
//__global__声明该函数为需要在GPU上计算的核函数
__global__ void add(int n, float *x, float *y)
{
for (int i=0;i<n;i++)
y[i] = x[i] + y[i];
}
int main()
{
int N = 1<<20;
float *x,*y;
//在GPU上开辟内存
cudaMallocManaged(&x,N*sizeof(float));
cudaMallocManaged(&y,N*sizeof(... |
5,932 | #include <thrust/host_vector.h>
#include <thrust/device_vector.h>
struct saxpy_functor {
const float m_a;
saxpy_functor(float a) : m_a(a) {}
__host__ __device__
float operator()(const float& x, const float& y) const {
return m_a * x + y;
}
};
struct offset_functor {
const float m_offset;
of... |
5,933 | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
#define Filas 5
#define Columnas 7
#define NbloquesX 3
#define NbloquesY 3
#define NhebrasX 3
#define NhebrasY 2
__global__ void
trasponer(int *dev_a, int *dev_b)
{
int position_x = blockIdx.x *... |
5,934 | #include<stdio.h>
#include<stdlib.h>
#define RADIUS 3
#define N (2048*2048)
#define THREADS_PER_BLOCK 512
__global__ void stencil_1d(int *in, int *out) {
__shared__ int temp[THREADS_PER_BLOCK + 2 * RADIUS];
int gindex = threadIdx.x + blockIdx.x * blockDim.x;
int lindex = threadIdx.x + RADIUS;
temp[lindex] = in[gin... |
5,935 | #include<bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846264;
const double L = 550;
const double Diff = 1.;
const int MAX_BLOCK_WIDTH = 32;
// In this method, we use squre cells of threads, but we need to specify the size of the square.
/*
| coordinate system:
-|---------------y
| ... |
5,936 | #include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define BLOCK_W 16
#define BLOCK_H 16
//--------------------------------------------------------------------------------------------------------------------
__global__ void median_filter(const unsigned char *in, unsigned char *out, const u... |
5,937 | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <cuda.h>
#include <cufft.h>
#include <iostream>
// #include <complex>
#include <cuda_runtime.h>
#define imin(a,b) (a<b?a:b)
/*--------- function called from main fortran programn ---------------*/
// ------------- Onli... |
5,938 | /*
* ABC.cpp
*
* Created on: 19 янв. 2016 г.
* Author: aleksandr
*/
#include "ABCTM.h"
#include <iostream>
ABCTM::ABCTM(GridTM* _grid) : EzLeft(_grid->sizeY*6, 0),
EzRight(_grid->sizeY*6, 0),
EzTop(_grid->sizeX*6, 0),
EzBottom(_grid->sizeX*6, 0),
coeff0(0),
coeff1(0... |
5,939 | #include "stdio.h"
int main(void){
cudaDeviceProp prop;
int count;
cudaGetDeviceCount(&count);
for(int i = 0 ; i < count ; i++){
cudaGetDeviceProperties(&prop, i);
printf("Name: %s\n", prop.name);
printf("Compute capability: %d.%d\n", prop.major, prop.minor);
printf("Clock rate: %d\n",... |
5,940 | // https://github.com/AlexDWong/dijkstra-CUDA
// REFER THE PROGRAM FROM HERE
|
5,941 | #include <stdio.h>
#define N 256
#define TPB 256
__global__ void cuda_hello(){
printf("Hello World! My threadId is %d\n", threadIdx.x);
}
int main() {
cuda_hello<<<N/TPB,TPB>>>();
cudaDeviceSynchronize();
return 0;
}
|
5,942 | #include "includes.h"
__global__ void add(int N, double *a,double *b, double *c)
{
int tid = blockIdx.x*blockDim.x + threadIdx.x;
if(tid < N)
{
c[tid] = a[tid]+b[tid];
}
} |
5,943 | //
// include files
//
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
//
// kernel routine
//
__global__ void my_first_kernel(float *x)
{
int tid = threadIdx.x + blockDim.x*blockIdx.x;
x[tid] = threadIdx.x;
}
//
// C... |
5,944 | #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"
void __global__ point2gridmap(float* point, int* x_vec, int* y_vec,... |
5,945 | #include "includes.h"
__global__ void square(float* d_out, float* d_in)
{
int idx = threadIdx.x; // here depends on the <<<block, threadPerBlock>>>, build-in variable: threadIdx
float f = d_in[idx];
d_out[idx] = f * f;
} |
5,946 | #include <cuda_runtime_api.h>
#include <iostream>
/*
Before you use your GPU to do work, you should know the
most essential things about its capabilities.
*/
int main()
{
// Count CUDA-capable devices on the system
int numDevices;
cudaGetDeviceCount(&numDevices);
if (numDevices == 0)
{
std::cout << "You have ... |
5,947 | #include "includes.h"
__global__ void cuda_standarization(float *data, int rows, int columns) {
int total_threads_count = blockDim.x * gridDim.x;
int tid = threadIdx.x + blockIdx.x * blockDim.x;
float var, ave, amo;
for (int i = tid+1; i < columns; i=i+total_threads_count) {
amo = 0, var = 0;
for (int j = 0; j < rows;... |
5,948 | #include "includes.h"
__global__ void convolution_global_memory_gray(unsigned char *N,float *M,unsigned char* g,std::size_t cols, std::size_t rows,std::size_t mask_size){
int paddingSize = ( mask_size-1 )/2;
unsigned int paddedH = cols + 2 * paddingSize;
unsigned int paddedW = rows + 2 * paddingSize;
int i = blockIdx.... |
5,949 | #include <iostream>
#include <math.h>
#include <time.h>
using namespace std;
// Kernel function to add the elements of two arrays
__global__
void dijkstra(int N, int *hasil_gabung, int *graph)
{
int index = blockIdx.x * blockDim.x + threadIdx.x;
int stride = blockDim.x * gridDim.x;
for (int src = index; src < N... |
5,950 | #include <stdio.h>
#include <stdlib.h>
#include <cuda_runtime.h>
#include <iostream>
__global__ void globalMem_reduce_kernel(float *d_out, float *d_in) {
int myId = threadIdx.x + blockDim.x * blockIdx.x;
int thrId = threadIdx.x;
// reduction in global memory
// loop gives 50, 25, 12, 6, 3, 1 for blockDim.x = ... |
5,951 | //PROGRAMA QUE SUMA DOS VECTORES (a y b) Y ALMACENA EL RESULTADO EN EL VECTOR (c)
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#define N 1000
__global__ void add(int *a, int *b, int *c)
{
//int tid = blockIdx.x;
int tid = threadIdx.x;
if(tid < N)
{
c[tid] = a[tid] + b[tid]... |
5,952 | #include "includes.h"
__global__ void BackwardSoftmax(float *A, float *dA, int nColsdZ, float *dZ)
{
int row = threadIdx.x;
int col = blockIdx.x;
dZ[row * nColsdZ + col] = dA[row * nColsdZ + col] * A[row * nColsdZ + col] *
(1 - A[row * nColsdZ + col]);
} |
5,953 | #include "includes.h"
__global__ void cuda_radiation_kernel() {} |
5,954 | #include "includes.h"
__global__ static void ConnectPointsStatus(int* PointType_BestN, int* ConnectStatus, int size, int rows, int ChooseBestN, int ConnectRadius)
{
int id = blockIdx.x * blockDim.x + threadIdx.x;
if (id >= size * rows * ChooseBestN) // 判斷是否超出大小
return;
// 算 Index
int sizeIndex = id / (rows * Choo... |
5,955 | #include<stdio.h>
#include<iostream>
using namespace std;
int main(int argc, char* argv[]){
cudaDeviceProp property;
cudaGetDeviceProperties(&property, 0);
cout << property.name << endl;
cout << property.major << endl;
cout << property.minor << endl;
cout << property.totalGlobalMem << endl;... |
5,956 | #include "includes.h"
__global__ void sga_right_weight_backward (const int n, const float *bottom_data, const float *top_data, const float *temp_diff, const int height, const int width, const int depth, const int wsize, float *filters_diff){
int index = blockIdx.x * blockDim.x + threadIdx.x;
if (index >= n)
{
return;
... |
5,957 | __global__
void velocityMagnitude(float * blockMags,
const float * d_levelset,
const float * d_velIn_x,
const float * d_velIn_y)
{
}
void velocityMagnitude(dim3 blocks, dim3 threads, float * blockMags,
const float * d_levelset... |
5,958 | #include "median_tree.cuh" |
5,959 | #include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/times.h>
#include <time.h>
#include <math.h>
#include <cuda_runtime.h>
#define PI 3.14159265358979323846
#define FactorArcosegRad 0.00000484814
#define BLOQUESIZE 4
clock_t timestart, timeend;
/**
@brief Función que transforma... |
5,960 | // reference: https://devblogs.nvidia.com/parallelforall/even-easier-introduction-cuda/
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <iostream>
#include <math.h>
// __global__ specifies a kernel in CUDA. It specifies that
// this function runs on the GPU but can be calle... |
5,961 | #include "includes.h"
__global__ void non_max_supp_kernel(unsigned char *data, unsigned char *out, unsigned char *theta, int rows, int cols) {
extern __shared__ int l_mem[];
int* l_data = l_mem;
// These variables are offset by one to avoid seg. fault errors
// As such, this kernel ignores the outside ring of pixels
... |
5,962 | /*
* Author: Kasjan Siwek
*
* Application simulates NxN masses connected by springs. At time 0 we place
* M charges in the system. Each charge causes nearby masses (those that
* are in radius R_m from the charge) to instantly travel to the middle
* of said charge. Those masses then stay there infinetely. We then... |
5,963 | #include<stdio.h>
#include<stdlib.h>
#include<curand_kernel.h>
#include<curand.h>
#include<sys/time.h>
#include<math.h>
unsigned int NUM_ITER = 1000000000;
unsigned int NUM_ITERATIONS = 1000;
unsigned int BLOCK_SIZE = 192;
unsigned int GRID_SIZE = (NUM_ITER/(NUM_ITERATIONS*BLOCK_SIZE));
__global__ void gpu_random(c... |
5,964 | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <chrono>
using namespace std::chrono;
template<unsigned int blockSize>
__device__ void warpReduce(volatile float *sdata, int tid) {
if (blockSize >= 64) sdata[tid] += sdata[tid + 32];
if (blockSize >= 32) sdata[tid] += sdata[tid + 16];
if... |
5,965 | #include <cuda.h>
#include <cstdio>
#include <cstdlib>
__global__ void kernel(size_t n_to_print) {
size_t tid = threadIdx.x + blockIdx.x*blockDim.x;
if (tid < n_to_print) {
printf("Hello from thread %lu!\n", tid);
}
}
int main(int argc, char** argv) {
size_t grid_size = 1000;
size_t block_size = 256;... |
5,966 | #include <stdio.h>
int main(void) {
cudaDeviceProp prop;
int dev;
cudaGetDevice (&dev);
printf ("ID of current CUDA device: %d\n", dev);
memset (&prop, 0, sizeof(cudaDeviceProp));
prop.major = 1;
prop.minor = 3;
cudaChooseDevice (&dev, &prop);
printf ("ID of CUDA device closest to revision 1.3: %d\n", d... |
5,967 | #include "includes.h"
__global__ void kernel(unsigned char *ptr, int ticks) {
int x = threadIdx.x + blockIdx.x * blockDim.x;
int y = threadIdx.y + blockIdx.y * blockDim.y;
int offset = x + y*blockDim.x*gridDim.x;
float fx = x - DIM / 2;
float fy = y - DIM / 2;
float d = sqrtf(fx*fx + fy*fy);
unsigned char grey = (uns... |
5,968 | #include <stdio.h>
// TMC Faster
__constant__ int mapping[20] = {0, -1, 3, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1};
// Thread i will score genome[i*seqlength] to genome[i*seqlength+(seqlength-1)]
__global__ void scoreReads(char* genome, int seqLength, int order, float* model, float* scores) ... |
5,969 | #include <iostream>
#include <fstream>
#include <chrono>
#include <iomanip>
#include <math.h>
#include <stdint.h>
#include <float.h>
#include <limits.h>
#include <stdlib.h>
#include <cuda_runtime.h>
struct Pixel {
unsigned char r, g, b;
};
struct Vec {
float x,y,z;
__forceinline__ __device__ Vec(float v = 0) {x... |
5,970 | #include<stdio.h>
#include<iostream>
#include <stdlib.h>
#include <algorithm>
#define MAX_BLOCK_DIM_SIZE 65535
using namespace std;
__global__ void reduce(int *g_idata, int *g_odata, int num_bytes) {
// create shared memory array
extern __shared__ int sdata[];
// each thread loads one element from global to s... |
5,971 | #include "includes.h"
__global__ void norm_components(float* N, int npix, float* norm) {
int i = blockIdx.x*blockDim.x + threadIdx.x;
if (i < npix) {
norm[i] = fmaxf(1e-10, sqrtf(N[i] * N[i] + N[npix + i] * N[npix + i] + N[npix * 2 + i] * N[npix * 2 + i]));
}
} |
5,972 | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cuda.h>
#define THREADS 16
#define BLOCKS 2
__global__ void add(int *array) {
int temp = 0;
int before = (blockIdx.x * blockDim.x + threadIdx.x + 1) % (THREADS * BLOCKS);
int after = (blockIdx.x * blockDim.x + threadIdx.x - 1) % (... |
5,973 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
//__global__ void hello_kernel()
//{
// printf("Hello cuda world \n");
//}
//int main()
//{
// printf("hello from main \n");
//
// dim3 block();
//
// hello_kernel <<< 1, 1 >>> ();
//
// cudaDeviceSynchronize();
// cudaDeviceReset();
... |
5,974 | extern "C"
__global__ void exec(int iterations, int size,
float* inputR, float* inputI, // Real/Imaginary input
int* output // Output image in one dimension
) {
int i = blockIdx.x * blockDim.x + threadIdx.x;
float cR = inputR[i];
float c... |
5,975 |
/*!
* This file provides structure and function definitions for the Vector2 and
* Matrix2x2 types, which are vector and matrix types with fixed dimensions.
* The operations defined for these types compute outputs directly without the
* use of loops. These types are useful for any algorithm that operates on
* pair... |
5,976 |
#ifdef __NVCC__
//K in parallel
template < class U >
__global__ void extractMin(unsigned int* PQ, unsigned int* PQ_size, int* expandNodes,int* expandNodes_size,U* Cx,int* openList,int N,int K){
int id = blockIdx.x*blockDim.x+threadIdx.x;
if(id<K && PQ_size[id]>0){
//extract min from PQ
... |
5,977 | /*
Based on the hello-world created by Ingemar Ragnemalm 2010
(http://computer-graphics.se/hello-world-for-cuda.html)
and the book "CUDA by Example"
This example code detects CUDA devices, print their information
and tests the parallel programing using CUDA
Author: João Ribeiro
nvcc check-cuda.cu -L /usr/local/cuda/... |
5,978 | #include "includes.h"
__global__ void cuda_cosineDistance(double *x, double* y, int64_t len, double *dot_product, double *norm_x, double*norm_y)
{
int64_t idx = threadIdx.x + blockIdx.x * blockDim.x;
int64_t cacheIdx = threadIdx.x;
__shared__ double dot_cache[threadsPerBlock];
__shared__ double norm_x_cache[threadsPe... |
5,979 | #include "includes.h"
/////////////////////////////////////////////////////////
// Computes the 1-stencil using GPUs.
// We don't check for error here for brevity.
// In your implementation - you must do it!
#define BLOCK_SIZE 1024
#define WARP_SIZE 32
#ifndef k
#define k 3
#endif
#ifndef OUTPUT_PER_THREAD
#define O... |
5,980 | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <iostream>
__global__ void mykernel(int *a, int *b, int *c, int n)
{
int index = blockIdx.x*blockDim.x + threadIdx.x;
if (index < n)
{
c[index] = a[index] + b[index];
}
}
int* genVector(int *p, int n)
{
std::cout << " Vector : " ;
for (... |
5,981 | /*
EE 451
Course Project: Raytracer
Serial Version
Names: James Lee, Darwin Mendyke, Ahsan Zaman
*/
#include <stdlib.h>
#include <cmath>
#include <iostream>
#include <fstream>
#include <vector>
#include <string.h>
#include <time.h>
using namespace std;
#define MAX_TRIANGLES 2000
#define MAX_SPHERES 10
#define MAX_L... |
5,982 | #include <stdio.h>
#include <sys/time.h>
#include <cuda.h>
#include <cfloat>
//VERSION 0.8 MODIFIED 10/25/16 12:34 by Jack
// The number of threads per blocks in the kernel
// (if we define it here, then we can use its value in the kernel,
// for example to statically declare an array in shared memory)
const int thr... |
5,983 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#define BLOCK_SIZE 1024
__global__ void addKernel(int *c, const int *a, const int *b)
{
int i = threadIdx.x;
c[i]... |
5,984 | #include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <stdint.h>
__device__ uint8_t merge_colors(uint8_t a, uint8_t b, uint8_t c){
return (a+b+c)/3;
}
__device__ float blur_effect(size_t x, size_t y) {
float xp = 1920/2;
float yp = 1080/2;
float v = ((x-xp)*(x-xp) + (y-yp)*(y-yp)) / (800*... |
5,985 | #include "includes.h"
__global__ void conductance_calculate_postsynaptic_current_injection_kernel(int * d_presynaptic_neuron_indices, int* d_postsynaptic_neuron_indices, float* d_reversal_potentials_Vhat, float* d_neurons_current_injections, size_t total_number_of_synapses, float * d_membrane_potentials_v, float * d_sy... |
5,986 | # include <stdio.h>
# include <stdint.h>
# include "cuda_runtime.h"
//compile nvcc -arch=sm_35 *.cu -o test
__global__ void global_latency (const unsigned int * __restrict__ my_array, int array_length, int iterations, unsigned int * duration, unsigned int *index);
void parametric_measure_global(int N, int iterati... |
5,987 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <iostream>
#include <iomanip>
#include <cmath>
#include <stdio.h>
using namespace std;
const double eps = 1e-12; // staa przyblienia zera
__global__ void addAndMulGauss(double *bj, double *ai, double m)
{
int i = threadIdx.x;
bj[i] += ... |
5,988 | #include <stdio.h>
#include <cuda_runtime_api.h>
#include <time.h>
/********************************************************************************
This CUDA program demonstrates how to crack an encrypted password using a simple
"brute force" algorithm. In this program. In this program a password consisting
of ... |
5,989 | #include <stdio.h>
#include <cuda.h>
__global__ void helloKernel() {
printf("Hello from thread %d of block %d\n!", threadIdx.x, blockIdx.x);
}
int main() {
printf("Hello from the CPU\n");
helloKernel <<<2, 4>>> ();
cudaDeviceSynchronize();
cudaError_t error = cudaGetLastError();
if(error != c... |
5,990 | //#define REARRANGED_DOMAIN
__global__ void get_absolute(
int N,
double xllcorner,
double yllcorner,
double * points)
{
const int k =
threadIdx.x+threadIdx.y*blockDim.x+
(blockIdx.x+blockIdx.y*gridDim.x)*blockDim.x*blockDim.y;
if (k >= N )
return;
#ifndef REARRA... |
5,991 | #include "includes.h"
__global__ void takeLog(float* input, float* env, int nhalf) {
int i = threadIdx.x + blockDim.x*blockIdx.x;
int j = i<<1;
if (i < nhalf) {
env[i] = log(input[j] > 0.0 ? input[j] : 1e-20); // take the log of the amplitudes
}
} |
5,992 | #include "includes.h"
__global__ void reduce6(const float* g_idata, float* g_odata, float* g_omask, unsigned int n) {
extern __shared__ float sharedData[];
float* sdata = &sharedData[0];
float* smask = &sharedData[blockDim.x];
// perform first level of reduction,
// reading from global memory, writing to shared memory... |
5,993 | #include "cuda.h"
#include <stdio.h>
#define imin(a,b) (a<b?a:b)
// const int N = 33 * 1024;
const int N = 100;
const int threadsPerBlock = 256;
const int blocksPerGrid = imin( 32, (N+threadsPerBlock-1) / threadsPerBlock );
__global__ void reduction( float *in, float *out, int n ) {
__shared__ float cache[thr... |
5,994 | #include <thrust/complex.h>
using namespace thrust;
extern "C"
{
__global__ void CUDAlogkernel(const double a, const double b, const int nu, const double *u, double *x, double *y, double *ret)
{
int i = threadIdx.x + blockIdx.x * blockDim.x;
int n = sizeof(x)/sizeof(x[0]);
const double pi = M_PI;
co... |
5,995 | #include <ctime>
#include <cuda.h>
#include <iomanip>
#include <iostream>
using namespace std;
#define MASK_WIDTH 5
#define WIDTH 7
// Secuencial
void convolution_1D(double *v, double *mask, double *result) {
for (int i = 0; i < WIDTH; i++) {
double Pvalue = 0;
int N_start_point = i - (MASK_WIDTH / 2);
... |
5,996 | #include "includes.h"
__global__ void accumulateColsInplaceKernel(float *input, int channels, int h, int w) {
// in-place.
// input is already a `channels * (h+1) x (w+1)` array
// global column index (of all `channels * w` columns in this image)
int colIdx = BLOCK_SIZE * BLOCK_SIZE * blockIdx.x + threadIdx.x;
if (co... |
5,997 | #include <stdio.h>
#include <stdlib.h>
__global__ void print_from_device(void){
printf("Hello World! from device\n");
}
__global__ void print_from_device_w_id(void){
printf("Hello World! from device (block : %d, threads : %d)\n",blockIdx.x,threadIdx.x);
}
int main(void){
printf("Hello World From host!\n");
int... |
5,998 | #include <stdio.h>
#include <stdlib.h>
#include <cuda_runtime.h>
#include <cuda.h>
const static int N = 11;
// kernel funtion
__global__
void calcColumn(int* row, const int rowNmb) {
//global index
int i = blockIdx.x * blockDim.x + threadIdx.x;
int tmp;
// calculate i-th element for increasing rows
... |
5,999 | #include <stdio.h>
#include "cuda.h"
#define max(x,y) ((x) > (y)? (x) : (y))
#define min(x,y) ((x) < (y)? (x) : (y))
#define ceil(a,b) ((a) % (b) == 0 ? (a) / (b) : ((a) / (b)) + 1)
void check_error (const char* message) {
cudaError_t error = cudaGetLastError ();
if (error != cudaSuccess) {
printf ("CUDA error :... |
6,000 | #include <math.h>
#include <stdio.h>
#include <cuda_runtime.h>
#define WARP_SIZE 32
#define MAX_THREADS_X 1024
#define MAX_THREADS_Y 1024
#define MAX_THREADS_Z 64
#define MAX_BLOCKS_X 2147483647
#define MAX_BLOCKS_Y 65535
#define MAX_BLOCKS_Z 65535
#define THREADS_PER_BLOCK 128
//3.0, 16 blocks, 2048 threads
//MIN THR... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.