serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
21,801 | #include <cstdio>
int main() {
printf("Several Days of Cuda\n");
}
|
21,802 | #include "includes.h"
__global__ void add(int *a, int *b, int *sum)
{
*sum = *a + *b;
} |
21,803 | #include <cuda_runtime.h>
#include <vector>
#include <iostream>
#include <algorithm>
__inline__
__device__ int push(int* array, int* num, const int& element)
{
int oldvalue = atomicAdd(num, 1);
array[oldvalue] = element;
}
__global__ void Find3(int* a, int* results, int* N)
{
__shared__ int s_threes[1024];
__sha... |
21,804 | __global__ void test(float *A){
int i = threadIdx.x;
for(int j = 0; j < 5; j++){
A[i] = A[i+1];
}
}
|
21,805 | __device__ void body_body_interaction(float4 point1, float4 point2, float3 *acceleration) {
float4 difference;
difference.x = point2.x - point1.x;
difference.y = point2.y - point1.y;
difference.z = point2.z - point1.z;
difference.w = 1.0f;
float distSqr = difference.x * difference.x + differen... |
21,806 | #include <stdio.h>
#include <stdlib.h>
#include <cuda_runtime.h>
#define N 1024
__global__ void stencil(float *d_a, float *d_b) {
int tid = blockIdx.x * blockDim.x + threadIdx.x;
if (tid > 0 && tid < N - 1) {
d_b[tid] = 0.3333f * d_a[tid - 1] * d_a[tid] * d_a[tid + 1];
}
}
int main() {
float ... |
21,807 | /*
Implementing inclusive Hillis & Steele plus scan in CUDA.
*/
#include <stdio.h>
#define NUM_THREADS 16
void serial_scan(unsigned int* in_array, unsigned int* out_array, const unsigned int size){
for(unsigned int i = 0; i < size; i++){
unsigned int sum = 0;
for(unsigned int j = 0; j <= i; j++)... |
21,808 |
/*
* This file is developed by Xuanzhi LIU (Walker LAU).
*
* If you want to get the latest version of this project or met any problems,
* please go to <https://github.com/WalkerLau/GPU-CNN> ,
* I will try to help as much as I can.
*
* You can redistribute this source codes and/or modify it under the terms... |
21,809 | #include <cuda.h>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
__global__ void test()
{
}
extern "C"
void cutest()
{
} |
21,810 | __global__ void get_w_combo(float *a,float*b, float *w, const unsigned int r, const unsigned int Y ,const unsigned int c )
{
int col = blockDim.x * blockIdx.x + threadIdx.x;
int row = blockDim.y * blockIdx.y + threadIdx.y;
if(row < r && col <c) {
float temp = 0;
for (int k = 0... |
21,811 | #include <pthread.h>
#include <stdio.h>
#include <iostream>
//const int N = 1 << 20;
const int N = 10;
__global__ void kernel(float *x, int n)
{
int tid = threadIdx.x + blockIdx.x * blockDim.x;
for (int i = tid; i < n; i += blockDim.x * gridDim.x) {
x[i] = sqrt(pow(3.14159,i));
}
}
__global__ voi... |
21,812 | #include "includes.h"
/* Program Parameters */
#define MAXN 8000 /* Max value of N */
int N; /* Matrix size */
// Thread block size
#define BLOCK_SIZE 16
/* Matrices */
float A[MAXN][MAXN], B[MAXN][MAXN];
/* junk */
#define randm() 4|2[uid]&3
/* Prototype */
/* ------------------ Cuda Code --------------------- ... |
21,813 | #include "includes.h"
/*
* CCL3D.cu
*/
#define CCL_BLOCK_SIZE_X 8
#define CCL_BLOCK_SIZE_Y 8
#define CCL_BLOCK_SIZE_Z 8
__device__ int d_isNotDone;
__global__ void analyseLabels(int* labels, int w, int h, int d) {
const int x = blockIdx.x * CCL_BLOCK_SIZE_X + threadIdx.x;
const int y = blockIdx.y * CCL_BLOCK_SIZ... |
21,814 | #include "includes.h"
__global__ void rgb2yuvKernel(int *imgr,int *imgg,int *imgb,int *imgy,int *imgcb,int *imgcr, int n) {
int r, g, b;
int y, cb, cr;
int index;
index = threadIdx.x + blockIdx.x * blockDim.x;
if (index < n){
r = imgr[index];
g = imgg[index];
b = imgb[index];
y = (int)( 0.299*r + 0.587*g + 0.114*... |
21,815 | __global__ void local_averages_kernel(float * A, float * B, int size_B)
{
int index = (blockIdx.x * blockDim.x) + threadIdx.x;
if ( index < size_B )
{
float temp = 0.0;
for ( int j = 0; j < 4; j++ )
{
temp = temp + A[(index * 4) + j];
}
B[ind... |
21,816 | #include <math.h>
__global__ void calcGradientGPU(int *image, int *gradientMag, int *gradientDir, int width, int height, int threshold){
int mask[9] = { -width - 1, -width, -width + 1,
-1, 0, 1,
width -1, width, width + 1 };
int GxMask[9] = { -1, 0, 1,
-2, 0, ... |
21,817 | #include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;
__device__ float atomicMaxFloat(float* addr, float val) {
int *addrAsInt = (int *) addr;
int old = *addrAsInt ;
while(val > __int_as_float(old)) {
old = atomicCAS(addrAsInt, old, __float_as_int(val));
}
... |
21,818 | #include <stdio.h>
#define N 16
#define BLOCK_SIZE 4
__global__ void transpose(int *input,int *output){
__shared__ int sharedMemory[BLOCK_SIZE][BLOCK_SIZE + 1];
//global index
int indexX = threadIdx.x + blockIdx.x*blockDim.x;
int indexY = threadIdx.y + blockIdx.y*blockDim.y;
//transposed index
int tindexX = threa... |
21,819 | #include <stdlib.h>
#include <stdio.h>
#include <cuda.h>
#include <math.h>
#include <time.h>
#include <curand_kernel.h>
#define ROUNDS 1000000
#define BLOCKS 512
#define GRIDS 1
double uniform(double a, double b){
return rand() / (RAND_MAX + 1.0) * (b - a) + a;
}
__global__ void gpu_monte_carlo(float *pi, curandSta... |
21,820 | #include <stdlib.h>
#include <stdio.h>
void init_matrix(int m, int n, double *mat, double value)
{
int i, j;
for (i = 0; i < m; i++)
for (j = 0; j < n; j++)
mat[i * m + j] = value;
}
void init_vector(int m, double *v, double value)
{
int i;
for (i = 0; i < m; i++)
v[i] = va... |
21,821 | #include "includes.h"
# define MAX(a, b) ((a) > (b) ? (a) : (b))
# define GAUSSIAN_KERNEL_SIZE 3
# define SOBEL_KERNEL_SIZE 5
# define TILE_WIDTH 32
# define SMEM_SIZE 128
__global__ void lowHysterisis(int width, int height, float *d_nonMax, float* d_highThreshHyst, float lowThreshold, float *d_lowThreshHyst) {
int i... |
21,822 | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#define N 10000
int main()
{
int sum = 0;
double x, y;
double start, end;
start = clock();
for (int i = 0; i < N; i++)
{
x = (double) rand() / RAND_MAX;
y = (double) rand() / RAND_MAX;
if(x*x + y*y < 1)
sum++;
}
end = clock();... |
21,823 | #include <stdio.h>
__global__ void hello(){
printf("Hey there! from block %d, (Threads in block: %d, Blocks: %d)\n",
blockIdx.x, blockDim.x, gridDim.x);
}
int main(int argc, char ** argv) {
// lunch kernel with 16 blocks and 1 thread each block
hello<<<16, 1>>>();
// force printf's to flush
cudaDeviceSynch... |
21,824 | #include "includes.h"
__global__ void stencil(int *in, int *out)
{
int globIdx = blockIdx.x * blockDim.x + threadIdx.x;
int value = 0;
for(int offset = -RADIUS; offset <= RADIUS; offset++)
value += in[globIdx + offset];
out[globIdx] = value;
} |
21,825 |
#include <stdio.h>
#define SIZE 2050
#define DIVUP(a,b) (a % b) == 0 ? (a / b) : (a / b) + 1
__global__ void VectorAddKernel(float * Vector1, float * Vector2, float * Output, int size)
{
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if(idx < size)
Output[idx] = Vector1[idx] + Vector2[idx];
}... |
21,826 | /*
** Projeto de Algoritmos Paralelos
** Multiplicação de Matrizes
*/
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <cuda_profiler_api.h>
#define TAM_BLOCO 16
__global__ void cuda_multiplicarmatriz(float* M, float* N, float* R, int tamM, int tamN) {
//... |
21,827 | /**
* Nearest neighbor search
* マップ内に店ゾーンが20%の確率で配備されている時、
* 住宅ゾーンから直近の店ゾーンまでのマンハッタン距離を計算する。
* Kd-treeなどのアルゴリズムだと、各住宅ゾーンから直近の店までの距離の計算にO(log M)。
* 従って、全ての住宅ゾーンについて調べると、O(N log M)。
* 一方、本実装では、各店ゾーンから周辺ゾーンに再帰的に距離を更新していくので、O(N)で済む。
* しかも、GPUで並列化することで、さらに計算時間を短縮できる。
*/
#include <stdio.h>
#include <stdlib.h>
#incl... |
21,828 | #include <stdio.h>
#include "multigrid_kernel.cu"
#define N_MALLAS 12
#define BLOCK_SIZE 16
void gpu_imprime(Grid g, const char *);
void gpu_muestra(Grid g, const char *);
void multigrid(Grid *u,
Grid *f,
Grid *v,
Grid *d,
int m,
double *max,
double *def,
... |
21,829 | #include <stdio.h>
#define N 16
#define BLOCK_SIZE 32 < N ? 32 : N
void matrixMultCPU(int a[N][N], int b[N][N], int c[N][N]) {
int n,m;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
int sum = 0;
for (int k = 0; k < N; k++) {
m = a[i][k];
n = b[k][j];
sum += m * n;
}
c[i][j] = s... |
21,830 | #include <cuda.h>
#include <float.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#define N 64
#define K 3
#define THPERBLOCK 32
#define ITER 100
typedef struct Data {
float* x;
float* y;
} data;
data* read_data(const char* file) {
data* d = NULL;
FILE* f = fopen (file, "r... |
21,831 | #include <stdio.h>
#include <unistd.h>
#define CUDA_CHECK_RETURN( value ) { \
cudaError_t _m_cudaStat = value; \
if ( _m_cudaStat != cudaSuccess ) { \
fprintf( stderr, "Error '%s' at line %d in file %s\n", \
cudaGetErrorString( _m_cudaStat ), __LINE__, __FILE__ ); \
exit( 1 )... |
21,832 | #include<stdio.h>
#include<stdlib.h>
//#include<string.h>
#include<math.h>
#include<cuda_runtime.h>
#define INF (64 * 64 * 128 * 2)
#define N_FEATURE (128)
typedef float fv[N_FEATURE];
static void HandleError( cudaError_t err,
const char *file,
int line ) {
if (err != cudaSuccess) {
printf... |
21,833 | #include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <time.h>
#define BLOCK_WIDTH 16
#define TILE_WIDTH 16
#define width 2
//GlobalMem - From Kirk and Hwu, 2012,
__global__ void matrixMulKernel(float* d_M, float* d_N, float* d_P, int Width) {
// Calculate the row index of the d_Pelement and d_M
... |
21,834 | #include <stdio.h>
#include <assert.h>
#define ARRAY_SIZE 5
const int ARRAY_BYTES = ARRAY_SIZE * sizeof(int);
// Kernel definition
__global__ void addKernel(int* d_a, int* d_b, int* d_c)
{
int i = threadIdx.x;
d_c[i] = d_a[i] + d_b[i];
}
void onDevice(int* h_a, int* h_b, int* h_c){
int *d_c;
//allocat... |
21,835 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
using namespace std;
#define block_size 32
#define pl_end_number 1000000
#define vector_size 1000
__global__ void prime( int *a, int *b, int *c ) {
int tid = (blockIdx.x*blockDim.x) + threadIdx.x; // this thread handles the data at... |
21,836 | //pass
//--blockDim=[8,8] --gridDim=[1,1] --no-inline
#include <cuda.h>
#define _2D_ACCESS(A, y, x, X_DIM) A[(y)*(X_DIM)+(x)]
#define X_DIMENSION 0
#define Y_DIMENSION 1
#define BLOCK_DIM (1 << 3)
#define num_vertices (1 << 6)
#define _U 0
#define _I 2
__global__ void transitive_closure_stage1_kernel(unsigned ... |
21,837 | #include <stdio.h>
__global__ void helloFromGPU(void) {
printf("Hello World from GPU, blockIdx: %d threadIdx: %d\n", blockIdx.x, threadIdx.x);
}
int main(void) {
printf("Hello World from CPU1\n");
helloFromGPU<<<1024, 10>>>();
//cudaDeviceSynchronize();
printf("Hello World from CPU2\n");
cuda... |
21,838 | #include "includes.h"
__global__ void profileLevelUp_kernel() {} |
21,839 |
#include "GPUTSPSolverKernel.cuh"
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <curand.h>
#include <curand_kernel.h>
#include <stdio.h>
#include <math.h>
void safeCuda(cudaError work, const char *msg) { if (work != cudaSuccess) { printf("CUDA ERROR at (%s) with code %d\n", msg, work); ... |
21,840 | #include "includes.h"
__global__ void make_bins(float *vec, int *bin, const int num_bins, const int n, const float slope, const float intercept)
{
unsigned int xIndex = blockDim.x * blockIdx.x + threadIdx.x;
if ( xIndex < n ){
int bin_new_val;
float temp = abs(vec[xIndex]);
if ( temp > (intercept *.000001) ){
bin_new_... |
21,841 | #include <stdio.h>
#include <sys/time.h>
double CpuSecond() {
struct timeval tp;
gettimeofday(&tp, NULL);
return ((double)tp.tv_sec + (double)tp.tv_usec*1.e-6);
}
int CpuNormalCal(int* data, const int size) {
int sum = 0;
for (int i = 0; i < size; ++i) {
sum += data[i];
}
return s... |
21,842 | //pass
//--gridDim=[6,10] --blockDim=[13,13]
__constant__ int kernelTemplate[25] = {
0, 1, 2, 3, 4,
29, 30, 31, 32, 33,
58, 59, 60, 61, 62,
87, 88, 89, 90, 91,
116,117,118,119,120 };
__global__ void executeFirstLayer(float *Layer1_Neurons_GPU,float *Layer1_Weights_GPU,float... |
21,843 | // execute by typing nvcc que1.cu
// ./a.out
#include <stdio.h>
#include <cuda.h>
#define N 32
__global__ void initArray(int *arr)
{
int tidx = threadIdx.x + blockDim.x * blockIdx.x;
arr[tidx] = tidx;
}
__global__ void square (int *matrix, int *result, int matrixsize) {
int id = blockIdx.x * blockDim.x +... |
21,844 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <stdlib.h>
__device__ void idxToCoords(const int idx, int *row, int *col, int rows, int cols)
{
*row = idx / rows;
*col = idx % cols;
return;
}
__device__ void coordsToIdx(const int row, const int col, int *idx, int ro... |
21,845 | /* ECGR 6090 Heterogeneous Computing Homework0
Problem 2- 1D stencil using GPU
Written by Bhavin Thakar - 801151488
*/
// To execute the program type: ./1DstencilGPU
#include<stdio.h>
#include <sys/time.h>
#include<stdlib.h>
struct timeval stop, start,start1,stop1,start2, stop2;
#define R 16 // Define Radius
#de... |
21,846 | #include <stdio.h>
__global__
void revert(int n, float* a, float *b) {
*b = - (*a);
*b = 1.05;
}
__global__
void getmax(int n, float* a, float* b) {
*b = 1.5;
}
int main() {
float* a, *b, *a_d, *b_d;
a = (float*)malloc(sizeof(float));
b = (float*)malloc(sizeof(float));
*a = 5.2;
print... |
21,847 | #include "includes.h"
__device__ unsigned char clip_rgb_gpu(int x)
{
if(x > 255)
return 255;
if(x < 0)
return 0;
return (unsigned char)x;
}
__global__ void yuv2rgb_gpu_son(unsigned char * d_y , unsigned char * d_u ,unsigned char * d_v , unsigned char * d_r, unsigned char * d_g, unsigned char * d_b, int size)
{
int x... |
21,848 | #include <stdio.h>
#include<stdlib.h>
#include<math.h>
#include<time.h>
#define N 10000
#define M 10000
#define K 10000
__global__ void matrix_mul_coal(float *a, float *b, float *c) {
int row = blockIdx.y* blockDim.y+ threadIdx.y;
int col = blockIdx.x* blockDim.x+ threadIdx.x;
float temp = 0.0; //calculate su... |
21,849 | #include<stdio.h>
#include<stdlib.h>
#include<cuda_runtime.h>
__global__ void histo_kernel(int* d_out, int* d_in, int out_size)
{
int idx = blockDim.x * blockIdx.x + threadIdx.x;
int id_temp = d_in[idx];
int my_idx = id_temp % out_size;
atomicAdd(&(d_out[my_idx]), 1);
}
int main(int argc, char** argv)... |
21,850 | #include<stdio.h>
#include<math.h>
// #include<omp.h>
#define SIZE 1024
__global__ void min(int * A, int * C)
{
int i=blockIdx.x*blockDim.x+threadIdx.x;
A[2*i]<A[2*i+1]?C[i]=A[2*i]:C[i]=A[2*i+1];
}
int main()
{
int A[SIZE];
int *devA,*devC;
//double start,end;
for(int j=0;j<SIZE;j++)
{
A[j]=SIZE-j;
}
cud... |
21,851 | #include "includes.h"
__device__ void finish(unsigned int* counter) {
__syncthreads();
__threadfence();
if (threadIdx.x == 0) { atomicAdd(counter, 1); }
}
__global__ void GRUPrepare(unsigned int* finished, const int round) {
for (int i = 0; i < round; i++) { finished[i] = 0; }
} |
21,852 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
cudaError_t addWithCuda(int *c, const int *a, const int *b, unsigned int size);
__global__ void addKernel(int *c, const int *a, const int *b)
{
int i = threadIdx.x;
c[i] = a[i] + b[i];
... |
21,853 | #include "includes.h"
__global__ void g_getSmrWgrad(float* wgrad, float* weight, float lambda, int len, int batch)
{
for(int i = 0; i < len; i += blockDim.x)
{
int id = i + threadIdx.x;
if(id < len)
{
wgrad[id] = lambda * weight[id] + wgrad[id] / batch;
}
}
} |
21,854 | // TODO: Implement FriedelMixed, other 2 are done (Friedel and noFriedel)
#include <stdio.h>
#include <sys/time.h>
#include <stdint.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#define RealType double
// conversions constants
#define deg2rad 0.0174532925199433
#define rad2deg 57.2957795130823
#def... |
21,855 | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
__global__ void cuda_vector_add(int *a, int *b)
{
__shared__ int results[64]; // Actually we don't need this, just for illustration
int global_thread_id = blockIdx.x * blockDim.x + threadIdx.x;
int local_thread_id = threadIdx.x;
r... |
21,856 | #include "includes.h"
__global__ void addVectors(const int entries, const float *a, const float *b, float *ab){
const int N = threadIdx.x + (16 * blockIdx.x);
if(N < entries)
ab[N] = a[N] + b[N];
} |
21,857 | /* Memocode design
* hash-align.cu
* Uses a static hash table sructure stored in hash_table1.bin and
* hash_table2.bin, based on 24-bit binary strings from the supplied
* genome_file, and performs alignment on the sequence file.
* Sample usage:
*
* ./align human_g1k_v37.bin ERR050082.filt.bin 100 machine_numbe... |
21,858 | #include <cuda.h>
#include <stdio.h>
#define THREADS 16
#define BLOCKS 8
__global__ void __add__(int *array, int *size) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx > *size) return;
int temp = 0;
int before = (idx + 1) % *size;
int after = idx - 1;
if (after < 0) af... |
21,859 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
cudaError_t addWithCuda(int *c, const int *a, const int *b, unsigned int size);
__global__ void addKernel(int *c, const int *a, const int *b)
{
int i = threadIdx.x;//ʹ1blocḳ߳Ҫʹthredid οp31ҳ
c[i] = a[i] + b[i];
}
int main() ... |
21,860 | #include <stdio.h>
#include <stdlib.h>
#define n 4
__device__
void dekomposisi(double A[][n], double D[][n]) {
int i, j, k, p, q, stop = 0;
double sum = 0;
for (p = 0; p < n; p++) {
for (j = p; j < n; j++) {
sum = 0;
for (k = 0; k < p; k++) {
sum += D[p][k]... |
21,861 | typedef double svm_precision;
#define thread_group_size 64
struct constantBuffer{
svm_precision cb_kernelParam1;
svm_precision cb_kernelParam2;
unsigned int cb_instanceLength;
unsigned int cb_instanceCount;
unsigned int cb_classIndex;
// Run flags
unsigned int cb_kernel;
svm_precision cb_param1;
svm_precisio... |
21,862 | #include <stdio.h>
__global__ void add(int *a, int *b, int *c, int num)
{
int i = threadIdx.x;
if (i < num)
{
c[i] = b[i] + a[i];
}
}
int main(int argc, char const *argv[])
{
// init data
const int num = 10;
int a[num], b[num], c[num];
int *a_gpu, *b_gpu, *c_gpu;
for (auto ... |
21,863 | #include "includes.h"
__global__ void gpu_reduce(int *c, int size)
{
/*Identificaciones necesarios*/
int IDX_Thread = threadIdx.x;
int IDY_Thread = threadIdx.y;
int IDX_block = blockIdx.x;
int IDY_block = blockIdx.y;
int shapeGrid_X = gridDim.x;
int threads_per_block = blockDim.x * blockDim.y;
int position = threads_pe... |
21,864 | #include <iostream>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <random>
#include <vector>
#include <chrono>
#include <deque>
#include <algorithm>
#include <iterator>
#include <set>
#define BLOCK_SIZE 1024
struct bstree {
int *left_child;
int *right_child;
int *parent;
bool *flag;... |
21,865 |
/* 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,floa... |
21,866 | #include "includes.h"
__device__ void add_gpu(int *device_var, int val) {
atomicAdd(device_var, val);
}
__global__ void add_gpu(int *device_arr, int device_idx, int val) {
device_arr[device_idx] += val;
//atomicAdd(&(device_arr[*device_idx]), val);
} |
21,867 | #include<stdio.h>
#include<stdbool.h>
typedef unsigned long long int ull;
__device__ bool getval(int v, ull id, ull ie){
if (v<0) v=-v;
if (v<=30) return (id & (1llu<<v)) ? true : false;
return (ie & (1llu<<(v-31))) ? true : false;
}
__device__ bool test(int n, int* raw, ull id, ull ie){
bool ret = t... |
21,868 | #include <cuda.h>
#include <stdio.h>
__global__ void GetWeightKernel(float *input, int input_len, float *addr,
float *exclusive_weight, int num_of_exclusive_weight,
int *page_table_addr, int page_size, int num_of_weight_page, int start, int end)
{
int idx, page_num, page, offset;
for (int i = blockIdx.x * block... |
21,869 | #include "includes.h"
__global__ void calculateMatrixFormulaSharedDynamic(int *a, int *b, int *res, int n)
{
int tidx = blockDim.x * blockIdx.x + threadIdx.x;
int tidy = blockDim.y * blockIdx.y + threadIdx.y;
if (tidx >= n || tidy >= n) {
return;
}
int tid = tidx * n + tidy;
extern __shared__ int arrays[];
int *s_a... |
21,870 | // Reference Reduction scan - Author: Jeiru Hu
#ifdef _WIN32
# define NOMINMAX
#endif
// includes, system
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <float.h>
#include <assert.h>
#define BLOCK_SIZE 1024
__device__ void warpreduce(volatile float *s_in, int threadId)
{
s... |
21,871 | #include <cstdlib>
#include <iostream>
#include "cuda_runtime.h"
#include <ctime>
using namespace std;
#define NUM_ELEMENTS 512 * 1000
__global__ void vecAddDevice(float * A, float * B, float * C) {
int i = blockDim.x * blockIdx.x + threadIdx.x;
C[i] = A[i] + B[i];
}
int main() {
float * hA, * hB, * hC;
float... |
21,872 | #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <fstream>
using namespace std;
void Linspace(double*, double, double, int);
void Uniform(double*, double, int);
__global__ void RungeKuttaStepOriginal(double* __restrict__, const double* __restrict__, int);
__global__ void RungeKutta... |
21,873 | #include "includes.h"
__global__ void _dev_saxpy()
{
return;
} |
21,874 | #include <time.h>
#include <cuda.h>
#include <stdio.h>
#define STOP 0
#define START 1
#define BLOCKSIZE 256
extern "C" void chrono (int kind, float *time);
__global__ void kconvol (float *gpu_a, float *gpu_b, int n) {
int i, j, l;
// TO DO : evaluate the global 1D index l of the current thread,
// using block... |
21,875 | #include "includes.h"
__global__ void getRow_IntId_naive(const float * A, int row_id, float * out, int Acols) {
int id = blockDim.x*blockIdx.y*gridDim.x + blockDim.x*blockIdx.x + threadIdx.x;
if (id < Acols) {
out[id] = A[id + row_id*Acols];
}
} |
21,876 | //pass
//--blockDim=2 --gridDim=1
__global__ void foo(char **argument)
{
}
|
21,877 | #include <cuda.h>
#include <stdio.h>
#define N 32
// função executada na GPU
__global__ void vecAdd (int *Da, int *Db, int *Dc) {
int i = threadIdx.x;
Dc[i] = Da[i] + Db[i];
}
// função executada na CPU
__host__ void initvet(int *host_a, int *host_b) {
// Inicialização dos vetores a e b
for (int i=0; i < N... |
21,878 | #include "includes.h"
__device__ float step_function(float v) //Sigmoid function::Activation Function
{
return 1 / (1 + exp(-v));
}
__global__ void apply_step_function(float *input, float *output, const int N)
{
const int pos = blockIdx.x * blockDim.x + threadIdx.x;
const int size = blockDim.x * gridDim.x;
for (int id... |
21,879 | /*
============================================================================
Name : cuda_lock.cu
Author : vuongp
Version :
Copyright : Your copyright notice
Description : CUDA thread wide lock, this code works well at the moment but
there is no guarantee that it will work with all GPU archit... |
21,880 | #include <iostream>
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <thrust/sort.h>
#include <thrust/reduce.h>
#include <stdlib.h>
#include <ctime>
int main ()
{
srand(time(NULL));
thrust::device_vector<int> dv(0);
thrust::host_vector<int> hv(0);
for (int i = 0; i < 5; ++i) {
hv.pu... |
21,881 | /******************************************************************************
*cr
*cr (C) Copyright 2010 The Board of Trustees of the
*cr University of Illinois
*cr All Rights Reserved
*cr
*****************************************************************... |
21,882 | #include<stdio.h>
#include<cuda.h>
#include <cuda_runtime.h>
#define N (1024*1024)
#define M (1000000)
__global__ void cudakernel(float *buf)
{
int i = threadIdx.x + blockIdx.x * blockDim.x;
buf[i] = 1.0f * i / N;
for(int j = 0; j < M; j++)
buf[i] = buf[i] * buf[i] - 0.25f;
}
int main()
{
float data[N]; int count = ... |
21,883 | # include <cuda.h>
# include <cuda_runtime.h>
extern "C"
unsigned char * RGB2HSV(unsigned char * data, int npixels);
__global__ void RGB2HSVcuda(unsigned char * dataRGBdev, unsigned char * dataHSVdev, int npixels){
int posThread = blockIdx.x*blockDim.x + threadIdx.x;
// ** Size, just consider the number of pi... |
21,884 | #include <stdio.h>
__global__
void hello(int k) {
printf("my thread number: %d %d\n", threadIdx.x, blockIdx.x);
printf("Argument: %d\n", k);
}
int main() {
hello<<<2,16>>>(5);
cudaDeviceSynchronize();
}
|
21,885 | #include <stdio.h>
using namespace std;
#define BLOCK_SIZE 16
#define GRID_SIZE 1
__global__
void GScale(float* img, float* res, int iRow, int iCol, int id){
int col = blockIdx.x*blockDim.x + threadIdx.x;
int row = blockIdx.y*blockDim.y + threadIdx.y;
int a = blockIdx.z*blockDim.z + threadIdx.z;
if (col < iCol... |
21,886 | #include "includes.h"
__global__ void permuteInitialAdjacencyKernel(int size, int *adjIndexesIn, int *adjacencyIn, int *permutedAdjIndexesIn, int *permutedAdjacencyIn, int *ipermutation, int *fineAggregate)
{
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if(idx < size)
{
int oldBegin = adjIndexesIn[ipermutation[idx]... |
21,887 | /***
This script is an example of usign CUDA Thrust library.
***/
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <iostream>
using namespace std;
int main(void)
{
thrust::host_vector<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
v.push_back(4);
for (int i... |
21,888 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cuda_runtime_api.h>
#include <curand.h>
#include "curand_kernel.h"
#include <assert.h>
// L should be (multiple of (THR_NUMBER - 2) ) + 2
const int THR_NUMBER = 30;
#define SETBLOCKNUM 5
// #define L 122
const int L = (THR_NUMBER -2)* SETBLOCKNUM +2;... |
21,889 | #include "includes.h"
#define TILE_WIDTH 32
#define TILE_HEIGHT 32
#define FSize 256
//void convolution(int *InputImage,int width,int height,int *filter,int filterWidth,,int padding,int *result);
using namespace std;
__global__ void MatrixMultiple(int *InputImage,int width,int height,int *filter,int filterWidth,int *... |
21,890 | #include "includes.h"
__global__ void callOperation(int *niz, int *res, int k, int n)
{
int tid = blockDim.x * blockIdx.x + threadIdx.x;
if (tid >= n) {
return;
}
if (niz[tid] == k) {
atomicAdd(res, 1);
}
} |
21,891 | /*
* Copyright 1993-2006 NVIDIA Corporation. All rights reserved.
*
* NOTICE TO USER:
*
* This source code is subject to NVIDIA ownership rights under U.S. and
* international Copyright laws.
*
* This software and the information contained herein is PROPRIETARY and
* CONFIDENTIAL to NVIDIA and is being... |
21,892 | #include <stdio.h>
#include <stdlib.h>
__global__ // <--- writing a kernel function to be run on the gpu (called on host)
void saveIDs(int *idsOut){
//int tid = threadIdx.x;
// int bidx = blockIdx.x;
// int bdim = blockDim.x;
// int globaltid;
//
//globaltid = blockIdx... |
21,893 | #include "includes.h"
__global__ void convertKernel(short* idata, float* odata, int size)
{
int tidx = threadIdx.x + blockIdx.x*blockDim.x;
if(tidx < size)
odata[tidx] = (float)idata[tidx];
} |
21,894 | #ifndef _DEV_SPH_KERNELS_CU_
#define _DEV_SPH_KERNELS_CU_
#define PI 3.141592653589793
#define iPI 0.318309886183791
__device__ float w(float u) {
if (u < 0)
return iPI;
else if (u < 1)
return iPI * (1 - 1.5*u*u + 0.75*u*u*u);
else if (u < 2)
return iPI*0.25 * (2-u)*(2-u)*(2-u);
else
return... |
21,895 | #include "includes.h"
__global__ void abc(){} |
21,896 | #include "includes.h"
__global__ void scan_y(int* g_odata, int* g_idata, int n) {
extern __shared__ int temp[]; // allocated on invocation
int thid = threadIdx.x;
int bid = blockIdx.x;
int bdim = blockDim.x;
int gdim = gridDim.x;
int offset = 1;
temp[2 * thid] =
g_idata[bid + 2 * thid * gdim]; // load input into shar... |
21,897 | #include "includes.h"
#define LOG 0
/*
* An implementation of parallel reduction using nested kernel launches from
* CUDA kernels. This version adds optimizations on to the work in
* nestedReduce.cu.
*/
// Recursive Implementation of Interleaved Pair Approach
__global__ void reduceNeighbored (int *g_idata, int *g_oda... |
21,898 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <thrust/sort.h>
/*
nvcc -O3 -arch=sm_30 -o cuda_monkey monkey.cu
*/
unsigned int print2Smallest(unsigned int *arr, unsigned int arr_size)
{
unsigned int i, first, second;
/* There should be atleast two elements */
if (arr_size ... |
21,899 | #include <iostream>
#include <cuda_runtime_api.h>
int main()
{
int deviceCount;
cudaDeviceProp deviceProp;
//Сколько устройств CUDA установлено на PC.
cudaGetDeviceCount(&deviceCount);
std::cout << "Device count: " << deviceCount << "\n\n";
for (int i = 0; i < deviceCount; i++)
{
//... |
21,900 | #include "includes.h"
__global__ void depthwise_filter_backward(int B, int N, int M, int F, int C, int r, int K, const int* nnIndex, const int* nnCount, const int* binIndex, const float* input, const float* gradOutput, float* gradFilter, int sharedMemSize, int startIdx)
{
extern __shared__ float gradPerBlock[]; // the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.