serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
3,401 | #include <stdio.h>
static void encrypt(unsigned char *cipher, unsigned char const *clear, int clear_len, unsigned char const *key, int key_len) {
int key_cur = 0;
for(int i = 0; i < clear_len; i++) {
auto key_byte = key[key_cur];
cipher[i] = clear[i] ^ key_byte;
key_cur++;
if(... |
3,402 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <curand.h>
#include <random>
#include <iostream>
#include <math.h>
#include <iomanip>
#include <string>
#include <map>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <sys/time.h>
#include <stdio.h>
//#define NUM_PARTICLES 1e... |
3,403 | __global__ void powered_exponential_kernel(double* dist, double* cov,
const int n, const int nm,
const double sigma2, const double phi,
const double kappa, const double nugget)
{
int n... |
3,404 | #include "includes.h"
__global__ void AdaptWinningFractionKernel( int s1, float *winningFraction, int *winningCount, float bParam, int maxCells )
{
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(threa... |
3,405 |
/* This is a automatically generated test. Do not modify */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
__global__
void compute(float comp, float 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... |
3,406 | //Based on the work of Andrew Krepps
#include <iostream>
#include <random>
#include <stdio.h>
__global__ void add(int * a, int * b, int * c)
{
const unsigned int thread_idx = (blockIdx.x * blockDim.x) + threadIdx.x;
c[thread_idx] = a[thread_idx] + b[thread_idx];
}
__global__ void subtract(int * a, int *... |
3,407 | //#include "mdCuda.h"
__global__ void kernelForce(int NA, double* FFX, double* FFY, double* FFZ, double* EE, double* X, double* Y, double* Z, int IPBC, double *Params)
{
double XIJ, YIJ, ZIJ, RIJ, RIJ2, EPP, FX2, FY2, FZ2;
double ARG1, ARG2, EXP1, EXP2, UIJ1, UIJ2, UIJ;
double FAC1, FAC2, FAC12, XRIJ, YRIJ, ZRIJ;
... |
3,408 | /*
icc propagate-toz-test.C -o propagate-toz-test.exe -fopenmp -O3
*/
#include "cuda_runtime.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <unistd.h>
#include <sys/time.h>
#include <iostream>
#include <chrono>
#include <iomanip>
//#define DUMP_OUTPUT
#define FIXED_RSEED
//#define USE_ASYNC
#ifnd... |
3,409 | #include <cuda.h>
#include <stdio.h>
#include <stdlib.h>
#define BLOCK_SIZE 512 // You can change this
#define NUM_OF_ELEMS 1048576 // You can change this
/* #define funcCheck(stmt) { \ */
/* cudaError_t err = stmt; \ */
/* if... |
3,410 | #include <stdio.h>
void helloCPU()
{
printf("Hello from the CPU.\n");
}
/*
* `helloGPU` の定義を、GPU 上で起動できるカーネルに
* リファクタリングします。「Hello from the GPU!」と
* 出力されるようにメッセージを更新します。
*/
void helloGPU()
{
printf("Hello also from the CPU.\n");
}
int main()
{
helloCPU();
/*
* この `helloGPU` の呼び出しをリファクタリングして、
* G... |
3,411 | #include<stdio.h>
#define NUM_BLOCKS 16
#define BLOCK_WIDTH 1
__global__ void hello()
{
printf("Hello world! I'm a thread in block %d\n", blockIdx.x);
}
int main()
{
hello<<<NUM_BLOCKS, BLOCK_WIDTH>>>();
cudaDeviceSynchronize();
return 0;
}
|
3,412 | #include <stdio.h>
#include <stdlib.h>
#define N 4 // quantidades de numeros
#define I 2 // adjacentes
// codigo device
__global__ void soma_adj(int *a){
int ind = threadIdx.x;
int pos_inicio = ind - I;
int pos_final = ind + I + 1;
int soma = 0;
if (ind < N){
for (int i=pos_inicio; i<... |
3,413 | #include "includes.h"
//#define __OUTPUT_PIX__
#define BLOCK_SIZE 32
__constant__ __device__ float lTable_const[1064];
__constant__ __device__ float mr_const[3];
__constant__ __device__ float mg_const[3];
__constant__ __device__ float mb_const[3];
__global__ void lin2lin_resmpl_good_gpu_kernel(float *dev_in_img, fl... |
3,414 | //pass
//--gridDim=1024 --blockDim=1024
#include <cuda.h>
__global__ void square_array(float* dataView)
{
int idx = blockIdx.x*blockDim.x + threadIdx.x;
dataView[idx] = dataView[idx] * dataView[idx];
#ifdef MUTATION
dataView[idx+1] = dataView[idx+1];
#endif
/* BUGINJECT: ADD_ACCESS, UP */
}
|
3,415 | #include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/sort.h>
#include <thrust/copy.h>
#include <chrono>
using namespace std::chrono;
// comparison between insert vs copy vs resize
int main(){
// c1. larger vec to smaller vec -> in
int n = 1000000;
int reps = 8;
int init_... |
3,416 | #include <stdio.h>
__device__ int addem( int a, int b )
{
return a + b;
}
__global__ void add( int a, int b, int *c )
{
*c = addem( a, b );
}
int main(void)
{
int a,b,c;
int *dev_c;
/* Allocate memory on the device */
cudaMalloc( (void**)&dev_c, sizeof(int));
a = 2;
b = 7;
ad... |
3,417 | #include "includes.h"
__global__ void glcm_calculation_180(int *A,int *glcm, const int nx, const int ny,int max){
//int iy = threadIdx.y + blockIdx.y* blockDim.y;
unsigned int idx =blockIdx.x*nx+threadIdx.x;
int i;
int k=0;
for(i=0;i<nx;i++){
if(idx>=i*nx && idx<((i+1) *nx)-1){
k=max*A[idx+1]+A[idx];
atomicAdd(&glcm[k]... |
3,418 | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "n_body.h"
__global__ void calculateBodyForce(float4 *p, float4 *v, float dt, int n) {
int i = blockDim.x * blockIdx.x + threadIdx.x;
if (i < n) {
float Fx = 0.0f; float Fy = 0.0f; float Fz = 0.0f;
for (int tile = 0; tile < gridDim.x; t... |
3,419 | #include <stdio.h>
#include <cuda_runtime.h>
#include <iostream>
using namespace std;
int main(int argc, char*argv[]) {
int iDev=0;
cudaDeviceProp iProp;
cudaGetDeviceProperties(&iProp, iDev);
cout << "Device " << iDev << ": " << iProp.name << endl;
cout << "Number of multiprocessors: " << iProp.multiProce... |
3,420 | #include<stdio.h>
#include<cuda.h>
__global__ void dkernel()
{
printf("Hello World! \n");
}
int main()
{
dkernel<<<1, 32>>>(); //32 threads within 1 thread block
cudaDeviceSynchronize();
return 0;
} |
3,421 | #include <stdio.h>
#include <stdlib.h>
int reverseInt(int i) {
unsigned char ch1, ch2, ch3, ch4;
ch1 = i & 255;
ch2 = (i >> 8) & 255;
ch3 = (i >> 16) & 255;
ch4 = (i >> 24) & 255;
return ((int)ch1 << 24) + ((int)ch2 << 16) + ((int)ch3 << 8) + ch4;
}
void readMNIST(const char *imagefile,const c... |
3,422 | #include "includes.h"
struct MPIGlobalState {
// The CUDA device to run on, or -1 for CPU-only.
int device = -1;
// A CUDA stream (if device >= 0) initialized on the device
cudaStream_t stream;
// Whether the global state (and MPI) has been initialized.
bool initialized = false;
};
// MPI relies on global state f... |
3,423 | /*
**********************************************
* CS314 Principles of Programming Languages *
* Spring 2020 *
**********************************************
*/
#include <stdio.h>
#include <stdlib.h>
/**
* Collates results of segment scan (or segment prefix sum), putting last valu... |
3,424 | #include <stdio.h>
#include <cuda_runtime.h>
#define DATA_TYPE long long
__global__ void read_cache(DATA_TYPE* device_array, int array_size) {
int i;
DATA_TYPE* j = &device_array[0];
for (i = 0; i < array_size; i++)
j=*(DATA_TYPE**)j;
device_array[0] = (DATA_TYPE)j;
}
int main(int argc, char* argv[]... |
3,425 | #include "includes.h"
__global__ void smooth_shared(float * v_new, const float * v) {
extern __shared__ float s[];
int id = blockDim.x * blockIdx.x + threadIdx.x;
s[threadIdx.x + 1] = v[id];
if (threadIdx.x == 0) {
int start = blockDim.x * blockIdx.x;
int left = max(0, start - 1);
s[0] = v[left];
int end = blockDim.x ... |
3,426 | #include <stdio.h>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
// https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#multi-device-synchronization-cg
// typedef struct CUDA_LAUNCH_PARAMS_st {
// CUfunction function;
// unsigned int gridDimX;
// unsigned int gridDimY;
// ... |
3,427 | /*
* File: cuda_helper.cu
* Assignment: 5
* Students: Teun Mathijssen, David Puroja
* Student email: teun.mathijssen@student.uva.nl, david.puroja@student.uva.nl
* Studentnumber: 11320788, 10469036
*
* Description: File containing functions used to allocate, copy and free
* device memory and to chec... |
3,428 | /////////////////////////////////////////////////////////
// Auther: Aditya Mitkari
// Date: 4/5/19
//
// Description: Serial code for RFI mitigation
// Input: file / array of frequecy values for given DM
// Ouput: Frequecy values free of RFI
/////////////////////////////////////////////////////////
#include <stdio.h>... |
3,429 | #include "includes.h"
__global__ void copySimilarity(float* similarities, int active_patches, int patches, int* activeMask, int target, int source)
{
int i = threadIdx.x + blockIdx.x * blockDim.x;
if (i >= active_patches)
return;
int patch = activeMask[i];
similarities[target*patches + patch] = similarities[source*patc... |
3,430 | /*
Jaitirth Jacob - 13CO125 Vidit Bhargava - 13CO151
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
__global__ void rotateArray(int *c, int numThreads)
{
int nextIndex = (threadIdx.x + 1)%numThreads;
int val = c[nextIndex];
__syncthreads();
c[threadIdx.x] = val;
}
#define N 1024
int main... |
3,431 | #include "includes.h"
__global__ void multiplyTanh(float* out, float* in1, float* in2, int size){
int id = blockIdx.x * blockDim.x + threadIdx.x;
if(id < size)
out[id] = in1[id] * in2[id];
} |
3,432 | #include <stdlib.h>
#include <stdio.h>
#include <cuda.h>
#include <cuda_runtime.h>
int main(int argc, char** argv) {
int ct,dev;
cudaError_t code;
struct cudaDeviceProp prop;
cudaGetDeviceCount(&ct);
code = cudaGetLastError();
if(code) printf("%s\n", cudaGetErrorString(code));
if(ct == ... |
3,433 | #include "includes.h"
__global__ void initialize_rho(float* rho, int size_c, int nc) {
int i = blockIdx.x*blockDim.x + threadIdx.x;
int c = blockIdx.y*blockDim.y + threadIdx.y;
if (i < size_c && c < nc) {
rho[c*(size_c)+i] = 0.5f;
}
} |
3,434 | #include "includes.h"
__device__ size_t GIDX(size_t row, size_t col, int H, int W) {
return row * W + col;
}
__global__ void kernel_sub(float* d_f1ptr, float* d_f2ptr, float* d_dt, int H, int W) {
size_t row = threadIdx.y + blockDim.y * blockIdx.y;
size_t col = threadIdx.x + blockDim.x * blockIdx.x;
size_t idx = GIDX(... |
3,435 | #define CUDA_BLOCK_X 128
#define CUDA_BLOCK_Y 1
#define CUDA_BLOCK_Z 1
__global__ void _auto_kernel_0(int a[100][2][4])
{
int thread_x_id;thread_x_id = blockIdx.x * blockDim.x + threadIdx.x;
int thread_y_id;thread_y_id = blockIdx.y * blockDim.y + threadIdx.y;
int thread_z_id;thread_z_id = blockIdx.z * blockDim.z... |
3,436 | #include "includes.h"
__global__ void sumArraysOnGPU(float *A, float *B, float *C, const int N)
{
int i = blockIdx.x * blockDim.x + threadIdx.x;
__shared__ float d[256];
if (i < N) {
d[threadIdx.x%16]= A[i] + B[i];
C[i] = d[threadIdx.x%8];
}
} |
3,437 | #include <cuda.h>
#include <cuda_runtime_api.h>
__global__ void cuda_sum_kernel(float *a, float *b, float *c, size_t size)
{
size_t idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx >= size) {
return;
}
c[idx] = a[idx] + b[idx];
}
extern "C" {
void cuda_sum(float *a, float *b, float *c, si... |
3,438 | //--------------------------------------------------
// Autor: Ricardo Farias
// Data : 29 Out 2011
// Goal : Increment a variable in the graphics card
//--------------------------------------------------
/***************************************************************************************************
Includes
***... |
3,439 | #include <stdio.h>
int main()
{
/*
* 以下の出力文字列で現在アクティブな GPU の要求された
* プロパティを出力するために、これらの変数に値を代入します。
*/
int deviceId;
int computeCapabilityMajor;
int computeCapabilityMinor;
int multiProcessorCount;
int warpSize;
/*
* 以下の出力文字列を変更する必要はありません。
*/
printf("Device ID: %d\nNumber of SMs: %d\nCo... |
3,440 | // From CUDA for Engineers
// Listing 8.3: dist_1d_thrust
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <thrust/sequence.h>
#include <thrust/transform.h>
#include <iostream>
#define N 64
using namespace thrust::placeholders; // _1
struct SqrtOf{
__host__ __device__
float operat... |
3,441 | #include "includes.h"
__global__ static void findRHS(double* cOld, double* cCurr, double* cHalf, double* cNonLinRHS, int nx)
{
// Matrix index
int globalIdx = blockDim.x * blockIdx.x + threadIdx.x;
int globalIdy = blockDim.y * blockIdx.y + threadIdx.y;
// Set index being computed
int index = globalIdy * nx + globalIdx... |
3,442 | #include "includes.h"
extern "C" {
#ifndef NUMBER
#define NUMBER float
#endif
}
__global__ void vector_set (const int n, const NUMBER val, NUMBER* x, const int offset_x, const int stride_x) {
const int gid = blockIdx.x * blockDim.x + threadIdx.x;
if (gid < n) {
x[offset_x + gid * stride_x] = val;
}
} |
3,443 | #include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <stdint.h>
#include <assert.h>
#include <time.h>
#include <math.h>
/*
Author: Andrew DiPrinzio
Course: EN605.417.FA
*/
static const uint32_t DEFAULT_NUM_THREADS = 1024;
static const uint32_t DEFAULT_BLOCK_SIZE = 16;
static void usage(){
pri... |
3,444 | #include <iostream>
#include <vector>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
#include <curand.h>
using namespace std;
constexpr unsigned int ITERATIONS = 1 << 24;
constexpr unsigned int ITERATIONS_KERNEL = 1 << 16;
constexpr unsigned int TOTAL_KERNELS = ITERATIONS / ITERATIONS_KERNEL;
__glob... |
3,445 | // System includes
#include <stdio.h>
#include <assert.h>
// CUDA runtime
#include <cuda_runtime.h>
extern "C" __global__ void
maxwell_sgemm_64x64_raggedMn_nt(float *B, float *A, float *C, int ldb, int lda, int ldc, int N, int M, int K, float *alpha, float *beta, float alpha_, float beta_, int flag)
{
__shared__ f... |
3,446 | #include "includes.h"
__global__ void cudaSGatherRP_kernel( unsigned int inputSizeX, unsigned int inputSizeY, unsigned int nbAnchors, unsigned int batchSize, const float* inputs, const int* i, const int* j, const int* k, const int* b, const int* mask, float* outputs, int* anchors, unsigned int topN, const unsigned int ... |
3,447 | /* Command to compile on Windows:
nvcc .\lab5_2_1.cu -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64"
*/
#include <stdio.h>
__global__ void hello_GPU(void) {
if (blockIdx.x == 0 && threadIdx.x > 3) {
return;
}
printf("Hello from GPU... |
3,448 | //#include "StdAfx.h"
#include <iostream>
#include <stdio.h>
#include <cuda_runtime_api.h>
#define MAX_FILE_NAME_CHARS 40
#define MAX_OUTFILE_NAME_CHARS 45
#define FRAMES_PER_ITER 256
#define PROMETHEUS_TESLA_C2075 1
using namespace std;
// Define this to turn on error checking
#define CUDA_ERROR_CHECK
#define C... |
3,449 | #include <thrust/system/omp/vector.h>
#include <thrust/system/tbb/vector.h>
#include <thrust/iterator/retag.h>
#include <cstdio>
struct omp_hello
{
void operator()(int x)
{
printf("Hello, world from OpenMP!\n");
}
};
struct tbb_hello
{
void operator()(int x)
{
printf("Hello, world from TBB!\n");
}... |
3,450 | #include <iostream>
#include <math.h>
__global__
void Dense(int n, int m, float *W, float *b, float *x, float* y)
{
int j = blockIdx.x * blockDim.x + threadIdx.x;
int jn = j*n;
float r = b[j];
for (int i = 0; i < n; i++)
r = r+W[jn+i]*x[i];
y[j] = r;
}
int main(void)
{
int N = 1024;
int M = 2048;
i... |
3,451 | /*
Program name: HelloGPU_ThreadOrganization.cu
Author name: Dr. Nileshchandra Pikle
Email: nilesh.pikle@gmail.com
Contact Number: 7276834418
Webpage: https://piklenileshchandra.wixsite.com/personal
Purpose: To demonstarte
1. How to write CUDA program
2.... |
3,452 | #include <stdio.h>
#define N 160
#define THREADS 16
__global__ void max_kernel(float *A, float * max){
int i = blockDim.x*blockIdx.x+threadIdx.x;
__shared__ float smax[THREADS];
smax[threadIdx.x] = A[i];
for(unsigned int s = blockDim.x/2; s > 0; s>>=1){
if(threadIdx.x < s){
if(smax[thre... |
3,453 | #include "foo.cuh"
#define CHECK(res) { if(res != cudaSuccess){printf("Error :%s:%d , ", __FILE__,__LINE__); \
printf("code : %d , reason : %s \n", res,cudaGetErrorString(res));exit(-1);}}
__global__ void foo()
{
printf("CUDA!\n");
}
void useCUDA()
{
foo<<<1,25>>>();
CHECK(cudaDeviceSynchronize());... |
3,454 | #include <iostream>
#include <cstdlib>
#include <cuda.h>
#include <map>
#include <fstream>
using namespace std;
#define delta 10
#define rows 1000
#define columns 1000
int* findBarrier(int x, int y, int * Map[columns]){
//y-координаты препятствий
i... |
3,455 | #include <cassert>
#include <cstdlib>
#include <iostream>
#include <chrono>
using namespace std;
#define MASK_LENGTH 7
__constant__ int mask[MASK_LENGTH];
__global__ void convolution_1d(int *array, int *result, int n);
void verify_result(int *array, int *mask, int *result, int n);
auto get_time() { return chrono::hig... |
3,456 | /*
* Copyright 2011-2015 NVIDIA Corporation. All rights reserved
*
* Sample app to demonstrate use of CUPTI library to obtain metric values
* using callbacks for CUDA runtime APIs
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
// #include <cupti.h>
#include <math_constants.h>
// #include "../../lc... |
3,457 | #include <stdio.h>
#include <time.h>
#include <cuda_runtime.h>
#define TPB 256
#define PARTICLES 10000000
#define ITTERATIONS 10
struct Particle
{
float3 position;
float3 velocity;
};
__device__ float3 operator+(const float3& p1, const float3& p2)
{
return make_float3(p1.x + p2.x, p1.y + p2.y, p1.z + p2.z);
}
__d... |
3,458 | #include <stdio.h>
__global__ void square_1d_vector(float * d_out , float * d_in)
{
int idx = threadIdx.x;
d_out[idx] = d_in[idx] * d_in[idx];
}
void call_1d_parallel_computing(void)
{
const int ARRAY_SIZE = 32;
const int ARRAY_BYTES = ARRAY_SIZE * sizeof(float);
//Host mem arrays
float h_1d_in[ARRAY_SIZE];
... |
3,459 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <curand.h>
#include <curand_kernel.h>
#define min( a,b ) ( (a) > (b) ? (b) : (a) )
__global__
static void Normal_random_number_kern( int m_A, int n_A,
double * A_pg, int ldim_A,
curandState_t state,
unsigned long long rand_seed ) {
//... |
3,460 | #include <iostream>
#include <algorithm>
#include <chrono>
__global__ void add(float *x, float *y, float *z, int size)
{
int index = threadIdx.x;
int stride = blockDim.x;
for (int i = index; i < size; i += stride)
{
z[i] = x[i] + y[i];
}
}
cudaError_t cuda_add(float *x, float *y, float *... |
3,461 | #include "includes.h"
__global__ void init(float* xbar, float* xcur, float* xn, float* y1, float* y2, float* img, int w, int h, int nc) {
int x = threadIdx.x + blockDim.x * blockIdx.x;
int y = threadIdx.y + blockDim.y * blockIdx.y;
if (x < w && y < h) {
int i;
float val;
for (int z = 0; z < nc; z++) {
i = x + w * y + ... |
3,462 | #include <cassert>
#include <iostream>
#include <math.h>
#include <cooperative_groups.h>
using namespace cooperative_groups;
// Reduces a thread group to a single element
__device__ int reduce_sum(thread_group g, int *temp, int val){
int lane = g.thread_rank();
// Each thread adds its partial sum[i] to sum[lane+i]... |
3,463 | #include "includes.h"
__global__ void FullyConnectedCurvatureKernel( float *weightsGradPtr, float *biasGradPtr, float *shiftedWeightsPtr, float *shiftedBiasPtr, float *avgWeightGradPtr, float *avgBiasGradPtr, float *weightGradCurvePtr, float *biasGradCurvePtr, float *dropoutMaskPtr, int prevLayerSize, int thisLayerSize... |
3,464 | #pragma once
#include <iostream>
#include <numeric>
#include <curand.h>
#include <curand_kernel.h>
#include <ctime>
#include <chrono>
#include <iomanip>
#include <sstream>
#include <fstream>
typedef double(*FunctionCallback)(double);
namespace parallel {
__global__ void monteCarloThread(unsigned long seed,
... |
3,465 |
//#include <helper_cuda.h>
//#include <algorithm>
#include <time.h>
#include <limits.h>
//#define RADIX 4294967296
//#define RADIX 2147483658
#define RADIX 65536
//#define numElements 1048576
#define numElements 30000
#define numIterations 10
#define BLOCKSIZE 128
// countlength/threadsperblock
void __global__... |
3,466 | __global__ void double_itself(int* A) {
int tid = threadIdx.x;
A[tid] += A[tid];
}
|
3,467 | #include "includes.h"
__global__ void reduce(int *a, int *b, int n) {
unsigned int i = blockIdx.x * blockDim.x + threadIdx.x;
atomicAdd(b, a[i]);
} |
3,468 | #include <math.h>
__device__ float fact_fun(int idx){
float fact = 1;
for(int i = 1; i<idx+1; i++){
fact = fact*i;
}
fact = 1/fact;
return fact;
}
__global__ void e_sum(float *c){
int duljina = 500;
const int idx = threadIdx.x;
c[idx] = fact_fun(idx);
c[duljina-idx-1] = fact_fun(duljina-idx);
}... |
3,469 | ////////////////////////////////////////////////////////////////////////////////
//
// FILE: n_sample_moving_avg.cu
// DESCRIPTION: runs N Sample Moving Average Filtering algorithm on gpu
// AUTHOR: Dan Fabian
// DATE: 2/16/2020
#include <iostream>
#include <random>
#include <chrono>
using std::cou... |
3,470 | #include "includes.h"
__global__ void _drop64(int n, double *x, double *y, double *xmask, double dropout, double scale) {
int i = threadIdx.x + blockIdx.x * blockDim.x;
while (i < n) {
if (xmask[i] < dropout) y[i] = 0;
else y[i] = x[i] * scale;
i += blockDim.x * gridDim.x;
}
} |
3,471 | #include "includes.h"
//double* x, * devx, * val, * gra, * r, * graMax;
//double* hes_value;
////int size;
//int* pos_x, * pos_y;
//int* csr;
double* x;
//thrust::pair<int, int> *device_pos;
//typedef double (*fp)(double);
//typedef void (*val_fp)(double*, double*, int);
//typedef void (*valsum_fp)(double*, double*,int... |
3,472 | #include "includes.h"
//Library Definition
//Constant Definition
#define PI 3.141592654
#define blocksize 32
#define Repetitions 8192
//Print matrix into standard output
void print(double * M,int cols,int rows);
void dot(double * a,double * b, double & c, int cols);
void Create_New_Matrix(double * M,double * New,int... |
3,473 | #include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef pair< ull , ull> uull;
const ull MAX = 1;
uull LnRnBlocks[17]; // from l0r0 to l16r16
uull CnDnBlocks[17]; //from c0d0 to c16d16
ull keysBlocks[16]; //from key[1] = k0 to key[16] = k15
ull allCipherDES[1000000];
const ull Ro... |
3,474 | /* https://devblogs.nvidia.com/even-easier-introduction-cuda/ */
#include <iostream>
#include <math.h>
// __global__: indica que a função add deverá ser executada na
__global__
void add(int n, float *x, float *y){
int index = threadIdx.x;
int stride = blockDim.x;
for(int i = index; i<n ; i=i+stride){
y[i] = x[i]... |
3,475 | #include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
// Comment out this line to enable debug mode
// #define NDEBUG
/* time stamp function in seconds */
__host__ double getTimeStamp()
{
struct timeval tv;
gettimeofday(&tv, NULL);
return (double)tv.tv_usec / 1000000 + tv.tv_sec;
}
__host__ void i... |
3,476 | #include "includes.h"
__global__ void stencil_2d(int *in, int *out)
{
/*
Fill kernel code!
*/
} |
3,477 | /*
* Copyright 1993-2014 NVIDIA Corporation. All rights reserved.
*
* Please refer to the NVIDIA end user license agreement (EULA) associated
* with this source code for terms and conditions that govern your use of
* this software. Any use, reproduction, disclosure, or distribution of
* this software and related... |
3,478 | __global__ void intrinsic(float *ptr){
*ptr = __powf(*ptr, 2.0f);
}
__global__ void standard(float *ptr){
*ptr = powf(*ptr, 2.0f);
} |
3,479 | #include "includes.h"
__global__ void normalize_kernel(int N, float *x, float *mean, float *variance, int batch, int filters, int spatial)
{
const int index = blockIdx.x*blockDim.x + threadIdx.x;
if (index >= N) return;
int f = (index / spatial) % filters;
x[index] = (x[index] - mean[f]) / (sqrtf(variance[f] + .00001f... |
3,480 | __global__ void depth_conv_small(const float * __restrict__ bottom_data,float *top_data, const float *__restrict__ weights,
int channels,int kernel_single_size,int spatial_dim_in,int spatial_dim_out,
int spatial_dim_add_padding,int padding,int stride)
{ ... |
3,481 | /*
Uses N blocks with N threads
SOR Stokes Flow with no slip b.c. on top/bottom and no flux b.c. on left/right written by Dmitriy Kats
Inputs: N is the number of grid points in each direction,
mu is the viscosity
Pdiff is the pressure drop in the x direction
omega is the SOR factor
... |
3,482 | /* Write GPU kernels to compete the functionality of estimating the integral via the trapezoidal rule. */
#define F(n) ((n) + 1)/sqrt((n) * (n) + (n) + 1)
__global__ void trap_kernel(float a, float b, int n, float h, float *Result_Vector)
{
__shared__ float p[128];
unsigned int column = blockIdx.x * blockDim.x + ... |
3,483 | #include "stdio.h"
#define DIM 8
const int THREADS_PER_BLOCK = 8;
const int NUM_BLOCKS = 8;
__global__ void add(int *a, int *c)
{
__shared__ int cache[THREADS_PER_BLOCK];
int tid = threadIdx.x + (blockIdx.x * blockDim.x);
int cacheIndex = threadIdx.x;
int temp = 0;
temp = a[tid];
cache[cacheInd... |
3,484 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <iostream>
using namespace std;
int main() {
int count;
cudaGetDeviceCount(&count);
cudaDeviceProp prop;
for (int i = 0; i < count; ++i) {
cudaGetDeviceProperties(&prop, i);
cout << "Device" << i << prop.name <... |
3,485 | #include "includes.h"
__global__ void vectorAdd(int* a, int* b, int* c, int n) {
// Calculate global thread ID (tid)
int tid = (blockIdx.x * blockDim.x) + threadIdx.x;
// Vector boundary guard
if (tid < n) {
// Each thread adds a single element
c[tid] = a[tid] + b[tid];
}
} |
3,486 | #include "includes.h"
__global__ void gpu_vector_add(float *out, float *a, float *b, int n) {
// built-in variable blockDim.x describes amount threads per block
int tid = blockIdx.x * blockDim.x + threadIdx.x;
if (tid < n)
out[tid] = a[tid] + b[tid];
// more advanced version - handling arbitrary vector/kernel size
/... |
3,487 | // Use grid strided loops, descriped here:
// https://devblogs.nvidia.com/cuda-pro-tip-write-flexible-kernels-grid-stride-loops/
// This pattern ensures that all of the loop values are visited once, no matter
// what grid parameters are used for the function.
extern "C" __global__
void seq2col(float* output,
cons... |
3,488 | #include <stdio.h>
#define N 100
__global__ void assign(int *arr) {
int tid = threadIdx.x + blockIdx.x * blockDim.x;
if (tid < N && tid > 0) {
for (int i = 0; i < 50; i++) {
int tmp = arr[tid-1];
__syncthreads();
arr[tid] = tmp;
//arr[tid] = arr[tid-1]; //false operation
}
... |
3,489 | #include "stdio.h"
#include <cuda.h>
#include <cuda_runtime.h>
#include <iostream>
void handle_errors(void){
int *d_a;
cudaError_t cudaStatus;
cudaStatus = cudaMalloc((void**)&d_a, sizeof(int));
printf("Status: %d, cudaSuccess: %d\n", cudaStatus, cudaSuccess);
int *h_a;
cudaStatus = cudaMemcpy... |
3,490 | #include<cuda_runtime.h>
#include<stdio.h>
int main()
{
int num = 0;
int maxdev = 0;
cudaGetDeviceCount(&num);
if (num > 1)
{
int maxp = 0;
for (int i = 0; i < num; i++)
{
cudaDeviceProp props;
cudaGetDeviceProperties(&props, i);
if (maxp ... |
3,491 | #include "gpuMemoryLimitTester.cuh"
#define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); }
inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort = true)
{
if (code != cudaSuccess)
{
std::fprintf(stderr, "GPUassert: %s %s %d\n", cudaGetErrorString(code), file, line);
if (abort)... |
3,492 | #include <stdio.h>
#include <cstdlib>
#include <time.h>
#include <stdlib.h>
#include <math.h>
// CUDA runtime
#include <cuda_runtime.h>
// Helper functions and utilities to work with CUDA
//#include <helper_functions.h>
//This function takes 32 elements and computers their all-prefix-sum
//Also, stores the sum of t... |
3,493 | #include "includes.h"
#define FALSE 0
#define TRUE !FALSE
#define NUMTHREADS 16
#define THREADWORK 32
__device__ int dIsSignificant(float signif, int df) {
float tcutoffs[49] = {
// cuttoffs for degrees of freedom <= 30
637.000, 31.600, 2.920, 8.610, 6.869, 5.959, 5.408, 5.041, 4.781,
4.587, 4.437, 4.318, 4.22... |
3,494 | #include "includes.h"
__global__ void _copy_mat(float *m, float* target, int len){
int tid = blockIdx.x * blockDim.x + threadIdx.x;
if(tid < len){
target[tid] = m[tid];
}
} |
3,495 | #include <cuda_runtime_api.h>
#include <iostream>
using namespace std;
__global__ void kernel(int* tab, int elem_number) {
int i = blockIdx.x * blockDim.x + threadIdx.x;
int step = gridDim.x * blockDim.x;
for (; i < elem_number; i += step) {
tab[i] = 2 * tab[i];
}
}
int main() {
const int elem... |
3,496 | #include "includes.h"
__global__ void convolutionParallel(unsigned char* image, unsigned char* new_image, unsigned height, unsigned width, int thread_count, int convolution_size)
{
// process image
int offset = (blockIdx.x * blockDim.x + threadIdx.x);
int width_out = (width - convolution_size + 1);
int height_out = (he... |
3,497 | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cuda.h>
#define N 10
#define UPPER N*4
#define LOWER 1
#define THREADS_PER_BLOCK 512
__global__ void count_sort(int *a, int *s_a, int n);
void rand_init_array(int *array, int n, int upper, int lower);
void display_array(int *array, int n);
/*
* Mai... |
3,498 | #include "error.h"
#include <cuda.h>
#include <curand_kernel.h>
#include <cassert>
#include <iostream>
#include <string>
namespace
{
const char* curandGetErrorString(const curandStatus_t error)
{
switch (error)
{
case CURAND_STATUS_SUCCESS:
return "CURAND_STATUS_SUCCESS";
case CU... |
3,499 |
#include "cuda.h"
#include <time.h>
#include <stdio.h>
#include <math.h>
#define TILE_WIDTH 2
__global__
void reduce(int *data, int *result, int N) {
int i = threadIdx.x ;
for (int k = N/2; k > 0; k=k/2) {
if(i<k)
data[i] += data[k+i];
__syncthreads();
}
if (i == 0)
result[0] = data[0];
... |
3,500 | #include "VerifyMove.cuh"
int getCheck(Piece** board, int kingRow, int kingCol, int color){
// Loops through the rows
for(int direction=-1; direction<=1; direction+=2){
for(int row=kingRow; row<DIM && row>=0; row+=direction){
if(board[row][kingCol].piece.color==color){
break;
}
else if(board[row][ki... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.