serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
20,901 | #include <vector>
#include <iostream>
#include <cmath>
__global__ void vector_add_kernel(float * r, float * v1, float * v2, int size)
{
int i = blockDim.x * blockIdx.x + threadIdx.x;
if(i < size)
{
r[i] = v1[i] + v2[i];
}
}
void vector_add_cpu(float * r, float * v1, float * v2, int size)
{
... |
20,902 | #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcpp"
#include <thrust/device_vector.h>
__global__ void
_cu_vertdegree(int numpts, int colsize, float eps, float* d_data, int* d_Va)
{
int i = blockIdx.x * blockDim.x + threadIdx.x;
if (i >= numpts)
return;
d_Va[i] = 0;
for (int j = 0; j < nu... |
20,903 | __global__ void
naiveKernel(float *A,float *A_out,const int n){
//First make a function that works for the input size 2*2
extern __shared__ float sdata[];
int tid = threadIdx.x;
int i = blockDim.x*blockIdx.x + threadIdx.x;
sdata[tid] = 0;
if(i<n)
sdata[tid] = A[i];
for(uns... |
20,904 | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <cuda.h>
#include <curand.h>
#include <curand_kernel.h>
#define THREADNUM 4
#define BLOCKNUM 4
__device__ float G_rand(curandState *states, int ind){
curandState local_state = states[ind];
float rand_num = curand_uniform(&local_state);
//st... |
20,905 | #include <iostream>
#include <cuda.h>
#define WIDTH 3833
#define HEIGHT 2160
bool checkResults(uchar4* rgba, uchar3* bgr, int size) {
bool correct = true;
for (int i=0; i < size; ++i) {
correct &= rgba[i].x == bgr[i].z;
correct &= rgba[i].y == bgr[i].y;
correct &= rgba[i].z == bgr[i]... |
20,906 |
/* 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 ... |
20,907 | #include "includes.h"
__global__ void build_hll(int n, unsigned int *in, unsigned int *out) {
int offset = (blockIdx.x * blockDim.x + threadIdx.x);
if (offset < n) {
// Extract the parts
unsigned int val = *(in + offset);
int bucket = val >> HLL_BUCKET_WIDTH;
// Update the maximum position
int pos = val & ((1 << HLL_B... |
20,908 | #include "includes.h"
__global__ void histo_kernel(unsigned char *buffer1, long size1, unsigned int *histo1){
// Phase 1 ------------------------------------------------------------
__shared__ unsigned int temp[256];
temp[threadIdx.x] = 0;
__syncthreads();
int i = threadIdx.x + blockDim.x * blockIdx.x;
int stride = b... |
20,909 | /******************************************************************************
*cr
*cr (C) Copyright 2010-2013 The Board of Trustees of the
*cr University of Illinois
*cr All Rights Reserved
*cr
***************************************************************... |
20,910 | #include <stdlib.h>
#include <stdio.h>
void fill_matrix(double *mat, unsigned numRows, unsigned numCols)
{
for(unsigned i=0; i < numRows; i++)
for(unsigned j=0; j < numCols; j++)
{
mat[i*numCols + j] = i*2.1f + j*3.2f;
}
}
void print_matrix_to_file(double *mat, unsigned numRows, unsi... |
20,911 | __global__ void smallKernel(int *offset, int *col_id, int *small, int sizeSmall, int *color, int currentColor)
{
if((blockIdx.x*blockDim.x+threadIdx.x)<sizeSmall)
{
int node = small[blockIdx.x*blockDim.x+threadIdx.x];
if(color[node]==0) {
int neighLen = offset[node+1]-offset[node];
bool s... |
20,912 | #include "includes.h"
__global__ void bcnn_cuda_axpy_strided_kernel(int n, int num_batches, float a, float *x, float *y, int dst_stride, int src_stride, int x_c, int x_h, int x_w, int y_c, int y_h, int y_w, int min_c, int min_h, int min_w) {
int id = (blockIdx.x + blockIdx.y * gridDim.x) * blockDim.x + threadIdx.x;
if ... |
20,913 | //Kelvin silva
//matrix vector parallel naive
#include <stdio.h>
#include <cuda.h>
#include <sys/time.h>
//matrix vector -> y = A*x
__global__ void simpleMxv(int width, int height, float *matrix, float *vector, float * result_vector) {
int current_index = blockIdx.x * blockDim.x + threadIdx.x;
float accumulat... |
20,914 | #include "includes.h"
__global__ void kernel_euclidean_norm(const double *vec, int numElements, double *answer)
{
extern __shared__ double square[]; // one element per thread
int i = threadIdx.x; // numElements assumed to fit into one block
square[i] = vec[i] * vec[i];
__syncthreads();... |
20,915 | #include <cuda.h>
#include <stdio.h>
#include <random>
__global__ void randSumKernel(int *arr, int a) {
// threadIdx.x is x and blockIdx.x is y
arr[blockIdx.x * blockDim.x + threadIdx.x] = a * threadIdx.x + blockIdx.x;
}
// reference is https://github.com/DanNegrut/ME759/blob/main/2021Spring/GPU/setArray.cu
int ma... |
20,916 | #include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/sort.h>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
int main() {
string str = "\002banana\003";
vector<string> table;
for (int i = 0; i < str.length(); i++) {
string temp = str.substr(i, str.l... |
20,917 | #include "includes.h"
/*
* Find BLANK and replace your own code.
* And submit report why do you replace the blank that way.
*/
/* 2015004693_YangSangheon */
#define TILE_WIDTH 24 /* set TILE_WIDTH 16 for the evaluation! */
#define MAXPOOL_INPUT_FILENAME "input.txt"
#define A_FILENAME "a.txt"
#define B_FILENAME ... |
20,918 | #include <iostream>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cuda_runtime_api.h>;
using namespace std;
__global__ void AddIntsCuda(int *a, int *b)
{
int i = threadIdx.x;
a[i] += b[i];
}
__global__ void InterChangeCuda(int *a, int *b)
{
int i = threadIdx.x;
int temp = a[i];
a[i] = b[i];
b[i] = a... |
20,919 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <cuda.h>
#define SIZE 1024*1024*1000
#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", ... |
20,920 | #include <iostream>
int main(){
std::cout << "hi" << std::endl;
int devicesCount;
cudaGetDeviceCount(&devicesCount);
for(int deviceIndex = 0; deviceIndex < devicesCount; ++deviceIndex)
{
cudaDeviceProp deviceProperties;
cudaGetDeviceProperties(&deviceProperties, deviceIndex);
// printf("Device na... |
20,921 | #include <cuda.h>
__global__ void vecadd(int * a, int * b, int len) {
int idx = threadIdx.x + blockDim.x * blockIdx.x;
a[idx] += b[idx];
}
|
20,922 | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
using namespace std;
__global__
void sumaMatrixKernel(float* A, float* B, float* C, int n)
{
int i = threadIdx.x + (blockDim.x * blockIdx.x);
if(i<n*n)
C[i] = A[i] +B[i];
}
__global__
void sumaMatrixKernelRow(float* A, float*... |
20,923 | #include <iostream>
using namespace std;
int main() {
// Get the Number of Devices
int count;
cudaGetDeviceCount(&count);
cout << "Number of Devices: " << count << endl;
// Get Useful Properties
cudaDeviceProp prop;
cudaGetDeviceProperties(&prop, 0);
// Output Requested Informat... |
20,924 | #include "includes.h"
//#define DEPTH 2
// dp - cost aggregation array
// cost_image - m x n x D array
// d - use every d channels of input to conserve register memory
// m - image rows
// n - image columns
// D - depth
// depth_stride - pitch along depth dimension
// row_stride - pitch along row dimension
__devic... |
20,925 | #include <stdio.h>
#include <stdlib.h>
#define DEBUGG 1
//static const int N = 16; //Siempre matrices cuadradas
static const int N = 36; //Siempre matrices cuadradas
//...
//Kernel que distribueix la l'execució a la grid
__global__ void organitza_grid(int *array) {
//Distribueix la grid(blocks i threads) ... |
20,926 | #include <cstdlib>
#include <cstdio>
#include <cooperative_groups.h>
#define P(i, j) ((i) * nx + (j))
void allocate_2d(float *&a, int nx, int ny){
cudaMallocManaged(&a, nx*ny*sizeof(float));
}
__global__ void build_up_b(float *b, float rho, float dt, float *u, float *v, float dx, float dy, int nx, int ny){
... |
20,927 | #include "includes.h"
__global__ void kApplySoftThreshold(float* mat, float alpha, float* target, unsigned int len) {
const unsigned int idx = blockIdx.x * blockDim.x + threadIdx.x;
const unsigned int numThreads = blockDim.x * gridDim.x;
for (unsigned int i = idx; i < len; i += numThreads) {
float f = mat[i];
target[i... |
20,928 | #include <iostream>
#include <thrust/device_vector.h>
#include <thrust/scan.h>
#include <cuda_runtime.h>
#include "device_launch_parameters.h"
#include <assert.h>
#include <chrono>
template <typename T, typename C>
__global__
void sub(T* output, const C* starter, const C* stopper, int64_t startsoffset, int64_t stopsof... |
20,929 | #include<cuda.h>
#include<iostream>
#include <unistd.h>
using namespace std;
const int numElems =2;
__global__ void dataKernel( double* data, int nsteps){
//this adds a value to a variable stored in global memory
int thid = threadIdx.x;
//data[thid] = 0;
int i = 0;
bool wait = 1;
clock_t start = clock64();
cl... |
20,930 | #include "includes.h"
__global__ void initialConditions(int n, double* x, double* y, double* z, double* vx, double* vy, double* vz, double* mass){
/* TODO */
} |
20,931 | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
__global__ void playGame(int *gridIn, int intpitch, int width, int height){
unsigned int iy = blockIdx.y * blockDim.y + threadIdx.y; //row index
unsigned int ix = blockIdx.x * blockDim.x + threadIdx.x; //column index
int tx = threadIdx.x; // For shared memo... |
20,932 | #include "includes.h"
static unsigned int GRID_SIZE_N;
static unsigned int GRID_SIZE_4N;
static unsigned int MAX_STATE_VALUE;
__global__ static void cudaIIGammaKernel(double *extEV, double *x1, double *x2, double *x3, double *left, double *right) {
__shared__ volatile double al[64], ar[64], v[64], x1px2[16];
const in... |
20,933 | /****************************************************************************************************
* Tyler Griffith *
* October 25th, 2018 *
* Project 7: ... |
20,934 |
#include <sys/time.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
// this is the max iterations decide to do in the loop
unsigned long MAX_OPS = 20000000;
__global__ void gpu_iops(unsigned long max_ops) {
int ab=1;
int bb=1;
in... |
20,935 | // input: in_data (b,g,c), in_grid (b,n)
// output: out_data (b,n,c)
__global__ void grid_upsampling_gpu(int b,int n,int c,int g,const float * in_data,const int * in_grid,float * out_data){
//int index = blockIdx.x * blockDim.x + threadIdx.x;
int stride = blockDim.x * gridDim.x;
for (int index = block... |
20,936 | #include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <cuda.h>
#include <ctime>
using namespace std;
__device__ int hashing_d (int element, int a, int b, int c, int p, int n){
return (unsigned int)(a * element + b) % p % n;
}
int hashing (int element, int a, int b, int c, int p, int n)... |
20,937 |
#include <stdio.h>
#include <stdlib.h>
// For the CUDA runtime routines (prefixed with "cuda_")
#include <cuda_runtime.h>
#include <sys/time.h>
#include <cooperative_groups.h>
//#include <helper_cuda.h>
#define N_INPUTS 256
#define N_ARITH 4096
__global__ void
ac(float *A, const int *B, const int *C, const int *op_s... |
20,938 | /*
* FILE: isingV3.cu
* THMMY, 7th semester, Parallel and Distributed Systems: 3rd assignment
* Parallel Implementation with shared memory of the Ising Model
* Authors:
* Moustaklis Apostolos, 9127, amoustakl@ece.auth.gr
* Papadakis Charis , 9128, papadakic@ece.auth.gr
* Compile command with :
* make all
* Run co... |
20,939 |
#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <string>
#include <vector>
#include <set>
using namespace std;
vector<string> splitpath( const string& str, const set<char> delimiters)
{
vector<string> result;
char const* pch = str.c_str();
char const* start = pch;
for(; *pch; ++pch)
{
... |
20,940 | /*
============================================================================
Name : review_chp3_2_bhd.cu
Author : freshield
Version :
Copyright : Your copyright notice
Description : CUDA compute reciprocals
============================================================================
*/
#inc... |
20,941 | #include<stdio.h>
#include"cuda_runtime.h"
#include"device_launch_parameters.h"
__global__ void add(int *a,int *b,int *c)
{
int tid=threadIdx.x;
c[tid]=a[tid]+b[tid];
}
int main()
{
int n,a[10],b[10],c[10];
printf("\nValue of N:");
scanf("%d",&n);
printf("\n Enter the Values of array A:");
for (int i = 0; i < ... |
20,942 | /*
============================================================================
Filename : algorithm.c
Author : Your name goes here
SCIPER : Your SCIPER number
============================================================================
*/
#include <iostream>
#include <iomanip>
#include <sys/time.h>
#incl... |
20,943 | // Matrix addition program MatrixMult.cu, Barry Wilkinson, Dec. 28, 2010.
#include <stdio.h>
#include <cuda.h>
#include <stdlib.h>
__global__ void gpu_matrixmult(int *gpu_a, int *gpu_b, int *gpu_c, int N) {
int k, sum = 0;
int col = threadIdx.x + blockDim.x * blockIdx.x;
int row = threadIdx.y + blockDim.y * block... |
20,944 | #include "includes.h"
__device__ bool checkBoundary(int blockIdx, int blockDim, int threadIdx){
int x = threadIdx;
int y = blockIdx;
return (x == 0 || x == (blockDim-1) || y == 0 || y == 479);
}
__global__ void mSetFieldBoundary(float *field, float scalar) {
if(checkBoundary(blockIdx.x, blockDim.x, threadIdx.x)) {
int ... |
20,945 | #include "device_launch_parameters.h"
#include "curand_kernel.h"
#include "dev_noise.cuh"
__global__ void cudaNoiseGeneWithSoS(float *dev_cos_value, float *dev_sin_value, unsigned int length, unsigned int path_num,
unsigned long long uniform_seed, float omega_amp, float delta_alpha, float delta_omega, float delta_t,... |
20,946 | #include "includes.h"
__global__ void initGridKernel ( float *d_grid, int axis, int w, int h, int d ) {
const int baseX = blockIdx.x * IG_BLOCKDIM_X + threadIdx.x;
const int baseY = blockIdx.y * IG_BLOCKDIM_Y + threadIdx.y;
const int baseZ = blockIdx.z * IG_BLOCKDIM_Z + threadIdx.z;
const int idx = (baseZ * h + baseY)... |
20,947 | #include "includes.h"
__global__ void brickSort(int* array, int arrayLen, int p) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx >= arrayLen - 1)
return;
if ((p % 2 == 0) && (idx % 2 == 1))
return;
if ((p % 2 == 1) && (idx % 2 == 0))
return;
if (array[idx] > array[idx + 1]) {
int tmp = array[idx + 1];
array[... |
20,948 | #include <cuda.h>
#include <cuda_runtime.h>
/* initialize grid
* we'll distribute all particles evenly on the screen
*/
__global__ void d_reset( float4* verts, float4* states,
float ww, float wh,
int mesh_width, int mesh_height
)
{
int x, y;
for (y = blockIdx.y... |
20,949 | #include <iostream>
#include <stdlib.h>
#include <set>
#include <fstream>
#include <stdio.h>
#include <malloc.h>
#include <time.h>
#include <math.h>
#include <random>
#include <chrono>
#include <ratio>
#include <thread>
#include <mutex>
//#define MODULUS_PRIME 1073741827// 30 bit prime
#define MODULUS_PRIME 53687090... |
20,950 | #include <iostream>
#define imin(a, b) (a < b ? a : b)
const int N = 33 * 1024;
const int threadsPerBlock = 256;
// blocksPerGrid is smart. We won't use a constant number
// of blocks 'cause it's unnecessary. We will use the right amount,
// which comes from this simple formula, meaning, the max number
// of blocks ... |
20,951 | #include "includes.h"
__global__ void donothing()
{
/* Do nothing! */
return;
} |
20,952 | /*
Transformer function helper function.
Written by tomztyang,
2021/08/23
*/
#include <math.h>
#include <stdio.h>
#define THREADS_PER_BLOCK 256
#define DIVUP(m,n) ((m) / (n) + ((m) % (n) > 0))
// #define DEBUG
__global__ void rpe_v_forward(
int b, int total_query_num, int local_size,
int total_key_num, int ... |
20,953 | #include <iostream>
using namespace std;
#define N 65536
#define A 2
#define blockSize 65
// SAXPY Kernel
// Performs A*X+Y
// Assumes single N blocks with 32 threads each
__global__ void saxpy(int *X, int *Y, int *Z){
// Need to account for different smx tid's
int tid = blockIdx.x * blockDim.x + threadIdx.x;... |
20,954 | #include "cuda.cuh"
__global__ void
kernel(void){
}
void run(){
kernel<<<1,1>>>();
}
|
20,955 | #include <iostream>
__global__ void helloWorld(){
}
int main(int argc, char const *argv[]){
helloWorld<<< 1,1 >>>();
return 0;
} |
20,956 | #include <stdlib.h>
#include <stdio.h>
#define BLOCKS size
#define THREADS 1
#define T 100000
#define H 0.01
#define R 1.0
#define K 2.0
#define ALPHA 9.96
#define BETA 1.0
#define M 0.28
#define DN 0.5
#define DP 0.5
__global__ void rosmac(float *n0, float *n1, float *p0... |
20,957 | // ================================================================================================
// A simple script to get memory usage & properties of CUDA supported NVIDIA devices
//
// Author: Sivagnanam Namasivayamurthy
//
// =======================================================================================... |
20,958 | /* written by Xin Liu
* Dec 2017
*/
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
// deposition_sim.cpp : Defines the entry point for the console application.
//
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<random>
#include<math.h>
#include <time.h>
// Nondi... |
20,959 | //pass
//--gridDim=40 --blockDim=256
typedef unsigned char Bool;
typedef unsigned int uint;
__global__ void computeVisibilities_kernel(const float *angles,
const float *scannedAngles,
int numAngles,
... |
20,960 | #include "cuda.h"
__global__ void multiply_by_two(double *y, const double *x, int n){
int i = blockIdx.x * blockDim.x + threadIdx.x;
if (i < n){
y[i] = 2*x[i];
}
}
void multiply_by_two_forward(double *y, const double *x, int n){
multiply_by_two<<< (n-1)/64 + 1, 64 >>>(y, x, n);
}
void multi... |
20,961 | #include "includes.h"
__global__ void pre_mul_kernel(int n, double *a, double *ct) {
const int j2 = blockIdx.x * blockDim.x + threadIdx.x;
double wkr, wki, xr, xi, yr, yi, ajr, aji, akr, aki;
const int nc = n >> 2;
const int j = j2 << 1;
if (j2) {
int nminusj = n - j;
wkr = 0.5 - ct[nc - j2];
wki = ct[j2];
ajr = a[j]... |
20,962 | // This is a generated file, do not edit it!
#pragma once
#include <stdint.h>
#define Constants_NumThreadsPerBlock 128
#define Constants_LargeBlock 1024
#define Constants_MaxClasses 32
#define Constants_MaxLevels 16
#define Constants_MaxAttributeAxes 40
#define Constants_MaxCategoricalAxes 8
#define Constants_MaxCatego... |
20,963 | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#include <time.h>
#include "cuda_fp16.h"
#define L1_SIZE 65536
#define FP_TYPE double
#define FP_DEV_TYPE double
/* Kernel for vector addition */
__global__ void Vec_add(FP_DEV_TYPE x[], FP_DEV_TYPE y[], FP_DEV_TYPE z[], int n, FP_DEV_TYPE l... |
20,964 | #include"tracker.cuh"
using namespace std::chrono;
LaserScan * d_scan=NULL;
LaserScan h_scan;
EgoMotion h_egomotion;
ObjectState * d_particle=NULL;
ObjectState h_particle[RQPN];
ObjectState * d_tmpparticle=NULL;
ObjectState h_tmpparticle[MAXPN];
bool h_flag[MAXPN];
int h_seed[MAXPN];
thrust::minstd_rand * d_rng=NUL... |
20,965 | /*
* This program uses the host CURAND API to generate 100
* pseudorandom floats.
*/
#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <curand.h>
#include <time.h>
#include <sys/time.h>
#define CUDA_CALL(x) do { if((x)!=cudaSuccess) { \
printf("Error at %s:%d\n",__FILE__,__LINE__);\
... |
20,966 | #include "includes.h"
__global__ void kernel_sqrtweights_fl(int N, float *wt){
unsigned int tid = blockIdx.x*blockDim.x + threadIdx.x;
/* make sure to use only M threads */
if (tid<N) {
wt[tid]=sqrtf(wt[tid]);
}
} |
20,967 | /*
* MAC0431 - Introducao a Programacao Paralela e Distribuida
*
* Fisica Alternativa
*
* Bruno Endo - 7990982
* Danilo Aleixo - 7972370
* Gustavo Caparica - 7991020
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <assert.h>
#include <cuda.h>
#include <cuda_runtime.h>
__const... |
20,968 | #ifdef __cplusplus
extern "C" {
#endif
__constant__ int sobx[3][3] = { {-1, 0, 1},
{-2, 0, 2},
{-1, 0, 1} };
__constant__ int soby[3][3] = { {-1,-2,-1},
{ 0, 0, 0},
{ 1, 2, 1} };
// Sobel kernel. ... |
20,969 | #include <stdio.h>
#include <stdlib.h>
#include <cuda_runtime.h>
#include <time.h>
const int Array = 1024 * 1024 * 8;
const int threadsPerBlock = 512;
__global__ void dot(int *d_a, int *d_b, int *d_c){
int tid = threadIdx.x;
int tidTemp = tid ;
while(tidTemp < Array){
d_c[tidTemp] = d_a[tidTemp] ... |
20,970 | #include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <cuda.h>
#include <math.h>
#include <unistd.h>
#define BLOCKSIZEX 8
#define BLOCKSIZEY 8
#define BLOCKSIZEZ 8
void checkCUDAError (const char *msg);
void dprint (float *campo, int x, int y, int Lx, int Ly, int Lz);
void mprint (float *campo, int x... |
20,971 | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
__device__ void mystrcpy(char dest[], const char source[])
{
int i = 0;
while ((dest[i] = source[i]) != '\0')
{
i++;
}
}
__device__ int mystrcmp(char string1[], char string2[] )
{
for (int i = 0; ; i++)
{
... |
20,972 | #include "cuda.h"
#include "stdio.h"
#define threads_per_block 512
void printi(int i){
printf("%d\n", i);
}
void init_CPU_array(int* array, int n){
for(int i = 0; i < n; i++) {
array[i] = 1;
}
}
void print_CPU_array(int array[], int n){
for(int i = 0; i < n; i++) {
printi(array[i]);
}
}
// realiza la s... |
20,973 | #include "includes.h"
using namespace std;
__device__ int getGlobalIdx_2D_2D()
{
int blockId = blockIdx.x + blockIdx.y * gridDim.x;
int threadId = blockId * (blockDim.x * blockDim.y)
+ (threadIdx.y * blockDim.x)
+ threadIdx.x;
return threadId;
}
__global__ void matrixSquareElementWiseKernel(float* in, float* out, ... |
20,974 | #include <cuda_runtime.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <sys/time.h>
#define N 2048
#define THREADS_PER_BLOCK 256
//Kernel
__global__ void marks(float * media, int * final){
int thread = blockIdx.x*blockDim.x + threadIdx.x;
final[thread] = (media[thread] == (int)media[thread]) *... |
20,975 |
extern "C" {
__device__
void colorize_pixel(double pixel[4], double mag, double escape, double i, double maxiter, double2 val, double2 coord) {
double darkener;
if (i < maxiter) {
double inp = (double)i / (double)maxiter;
double x = escape / mag;
x = (x / (double)maxiter + inp) - 0.2;
darkener = ... |
20,976 | //#include <thrust\adjacent_difference.h>
//#include <thrust\execution_policy.h>
//#include <thrust\sort.h>
//#include <thrust\gather.h>
//#include <thrust\iterator\constant_iterator.h>
//#include <thrust\binary_search.h>
//
////__global__ void CircshiftKernel(double2 * __restrict out, //double2 __restrict * out,
///... |
20,977 | #include <stdio.h>
int main(int argc, char **argv) {
struct cudaDeviceProp prop;
cudaGetDeviceProperties(&prop, 0);
printf("name: %s\n", prop.name);
printf("totalGlobalMem: %zd\n", prop.totalGlobalMem);
printf("sharedMemPerBlock: %zd\n", prop.sharedMemPerBlock);
printf("regsPerBlock: ... |
20,978 | #include <stdio.h>
#include <cuda.h>
#include "mytime.h"
#define N 1024
__global__ void dkernel(unsigned *a, unsigned wpt, unsigned chunksize) {
for (unsigned ii = 0; ii < wpt; ii += chunksize) {
unsigned start = wpt * blockDim.x * threadIdx.x;
for (unsigned nn = start; nn < start + chunksize; ++nn) {
a[nn]++;... |
20,979 | #include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <cuda.h>
#include <math.h>
#include <time.h>
#include <curand_kernel.h>
using namespace std;
#define N 1024
#define GRID_SIZE 128
#define BLOCK_SIZE 128
__global__ void PiCalcGPU(float* res, curandState* states) {
unsigned long index = threadIdx.x... |
20,980 | // ........ jsaes: AES in JavaScript (... B. Poettering) ... C ....
// ... http://point-at-infinity.org/jsaes/.... GNU GPL ...
#include <cuda.h>
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <fstream>
#include <iostream>
#include <sstream>
#define BYTE unsigned char
using namespace std;
class ae... |
20,981 | /*
file name: matrix_mul.cu
*
* matrix.cu contains two implemention of matrix multiplication in class
* Each matrix size is 1024*1024
* In this program, the elapesed time is only calculating kernel time. Time periods of allocating cuda memory, data transfer and freeing cuda memory are not included. However, i... |
20,982 | #include "includes.h"
extern "C"
__global__ void add32(float* A, float *B, int size) {
int block = blockIdx.x + blockIdx.y * gridDim.x + gridDim.x * gridDim.y * blockIdx.z;
int index = block * (blockDim.x * blockDim.y * blockDim.z) + (threadIdx.z * (blockDim.x * blockDim.y)) + (threadIdx.y * blockDim.x) + threadIdx.x;
... |
20,983 | #include "../include/Activation.cuh"
#include <vector>
/* ----------------------------------------------
maxGPU
Parameters:
a - double
b - double
Finds max of a and b and returns it
Returns:
max(a, b)
---------------------------------------------- */
__device__ double maxGPU(double a, double b)
{
bool sel = (a... |
20,984 | #include "includes.h"
__global__ void kernel_image2D1C_ConvolveColumn(float* img, int n_x, int n_y, short k, float *kernel, float* out)
{
// Find index of current thread
int idx_x = blockIdx.x * blockDim.x + threadIdx.x;
int idx_y = blockIdx.y * blockDim.y + threadIdx.y;
if (idx_x>=n_x) return;
if (idx_y>=n_y) return;
... |
20,985 | #include <iostream>
#include <fstream>
#include <vector>
#include <stdlib.h>
//#include <common\book.h>
#define DIM 512
#define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); }
inline void gpuAssert(cudaError_t code, char *file, int line, bool abort=true)
{
if (code != cudaSuccess)
{
fprintf(stderr... |
20,986 | // input: radius (1), nsample (1), xyz1 (b,n,3), xyz2 (b,m,3)
// output: idx (b,m,nsample), pts_cnt (b,m)
__global__ void query_ball_point_gpu(int b, int n, int m, const float *radius, int nsample, const float *xyz1, const float *xyz2, int *idx, int *pts_cnt) {
int batch_index = blockIdx.x;
xyz1 += n*3*batch_in... |
20,987 | extern "C" __global__ void build_hashtable(int *R, int R_size, int *hash_table) {
int offset = blockIdx.x * blockDim.x + threadIdx.x;
int key = R[offset];
int hash = key & (R_size-1);
if (offset < R_size) {
hash_table[hash] = key;
}
} |
20,988 | // one dimension of mean filter designed and coded by neo
/*
Ŀ
ֵ˲
һάоֵ˲
ÿΪԴ˵Ϊİ뾶Ϊr鵥Ԫ
ȡֵңƽֵԹв
Ҫ:
1.C ʵִ
2.Cuda ʵִ
3.shared memoryʹ
4.СݷʲԽ
5.ʱͼ
6.ִ֧ݵĴ
thinking:
the data of margin side can be dealed by this (i-j+n)%n
shaped the array like circle
in the same block ,the threads visit the data range in [r-i r r+i... |
20,989 | extern "C" __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];
}
}
|
20,990 | #include "includes.h"
__global__ void find_maximum(double *array, double *max, int dSize, int *d_mutex){
int index = threadIdx.x + blockIdx.x*blockDim.x;
int stride = gridDim.x*blockDim.x;
int offset = 0;
__shared__ double cache[threadsPerBlock];
double temp = -999999999.0;
while(index + offset < dSize){
temp = fmaxf... |
20,991 |
#include <cassert>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
int main()
{
int dev_count;
cudaDeviceProp prop;
cudaGetDeviceCount( &dev_count);
for (int i = 0; i < dev_count; i++) {
cudaGetDeviceProperties(&prop, i);
}
if (prop.deviceOverlap){
printf("Device support ... |
20,992 | #include <stdio.h>
#include <cuda_runtime.h>
__global__ void helloFromGPU()
{
printf("Hello from GPU thread %d!\n", threadIdx.x);
}
int main(int argc, char **argv)
{
printf("Hello from CPU\n");
helloFromGPU <<<1, 10>>>();
// cudaDeviceSynchronize();
cudaDeviceReset();
return 0;
}
|
20,993 | //
// Created by root on 2020/11/11.
//
#include "cuda_runtime.h"
#include <stdio.h>
__global__ void LocateThreadIdKernel() {
int x = blockDim.x * blockIdx.x + threadIdx.x;
int y = blockDim.y * blockIdx.y + threadIdx.y;
int z = blockDim.z * blockIdx.z + threadIdx.z;
// printf("%d, %d. %d\n", threadIdx... |
20,994 | #include "includes.h"
__global__ void gpu_array_scale_r8__(size_t tsize, double *arr, double val)
/** arr(:)*=val **/
{
size_t _ti = blockIdx.x*blockDim.x + threadIdx.x;
size_t _gd = gridDim.x*blockDim.x;
for(size_t l=_ti;l<tsize;l+=_gd){arr[l]*=val;}
return;
} |
20,995 | //#include "cuda_hamming_distance.cuh"
//#include <cuda.h>
//#include <cuda_runtime.h>
//
//
//#include <stdio.h>
//
//namespace dce {
// namespace metrics {
// namespace cuda {
// namespace hamming {
//
// template<typename TValue>
// __global__ void dista... |
20,996 | #include <cstdio>
#include <cstdlib>
#include <cuda_runtime_api.h>
int main(int argc, char *argv[]) {
cudaDeviceProp prop;
cudaError_t status;
int device_count;
int device_index = 0;
if (argc > 1) {
device_index = atoi(argv[1]);
}
status = cudaGetDeviceCount(&device_count);
if ... |
20,997 | // cuda_example3.cu : Defines the entry point for the console application.
//
#include <stdio.h>
#include <string.h>
#include <cuda.h>
#define N_h(x,y) N_h[(dimension)*(x-1)+(y-1)]
#define N_d(x,y) N_d[dimension*(x-1)+(y-1)]
#define MAX 100
#define ZERO 0
#define ONE 1
#define INICIO 1
#define TRUE 1
#define INFIN... |
20,998 | #include <cstdio>
#include <cstdlib>
#include <cuda_runtime.h>
#include <errno.h>
using namespace std;
int
main(int argc, char **argv)
{
int num_devices, use_device;
cudaDeviceProp device_prop;
cudaGetDeviceCount(&num_devices);
printf("number of devices: %d\n", num_devices);
const char *device_pick = getenv("... |
20,999 | #include<iostream>
using namespace std;
__global__ void test(float *data) {
unsigned int tid = threadIdx.x;
if(tid < 32) {
volatile float *in = data;
in[tid] += in[tid + 32];
in[tid] += in[tid + 16];
in[tid] += in[tid + 8];
in[tid] += in[tid + 4];
in[tid] += in[tid + 2];
in[tid] += in[ti... |
21,000 | // file esempio tantiprint
#include "stdio.h"
__global__ void miokernel(void){
int tid = blockIdx.x * blockDim.x + threadIdx.x;
printf("Sono il thread %d!\n", tid);
}
int main() {
//miokernel<<<2,32>>>();
miokernel<<<1,8>>>();
printf("Hello World!\n");
cudaDeviceSynchronize();
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.