serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
23,401 | // This program will print out some of the properties of the GPU that is being used
#include<iostream>
int main()
{
int deviceId;
int warpSize;
int computeCapabilityMajor;
int computeCapabilityMinor;
int multiProcessorCount;
cudaGetDevice(&deviceId);
cudaDeviceProp props;
cudaGetDeviceProperties(&pr... |
23,402 | #define PI 3.1415926535
// Pytchography kernels
void __global__ mul(float2 *g, float2 *f, float2 *prb, float *scanx, float *scany,
int Ntheta, int Nz, int N, int Nscan, int Nprb, int detx, int dety)
{
int tx = blockDim.x * blockIdx.x + threadIdx.x;
int ty = blockDim.y * blockIdx.y + threadIdx.y;
int tz = blockDim.... |
23,403 | #include "includes.h"
__global__ void bcnn_scales_kernel(float *output, float *biases, int n, int size) {
int offset = blockIdx.x * blockDim.x + threadIdx.x;
int filter = blockIdx.y;
int batch = blockIdx.z;
if (offset < size) {
output[(batch * n + filter) * size + offset] *= biases[filter];
}
} |
23,404 | #include <stdlib.h>
#include <stdio.h>
#include <cuda_runtime.h>
#ifndef N
#define N (1024)
#endif
void fail(const char *message)
{
printf(message);
exit(EXIT_FAILURE);
}
__global__ void useLocal(unsigned long long *d_time)
{
int target = 0;
int arr[N];
for (int i = 0; i < N; i++) {
arr... |
23,405 | #include<bits/stdc++.h>
using namespace std;
#define pi (2.0*acos(0.0))
#define eps 1e-6
#define ll long long
#define inf (1<<29)
#define vi vector<int>
#define vll vector<ll>
#define sc(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin() , v.end()
#define me(a,val) memset( a , val ,sizeof(a) )
#... |
23,406 | #include "includes.h"
__global__ void Brent_Kung_scan_kernel(float *X, float *Y, int InputSize)
{
__shared__ float XY[SECTION_SIZE];
int i = 2 * blockIdx.x*blockDim.x + threadIdx.x;
if (i < InputSize) XY[threadIdx.x] = X[i];
if (i + blockDim.x < InputSize) XY[threadIdx.x + blockDim.x] = X[i + blockDim.x];
for (unsigne... |
23,407 | #include "includes.h"
__global__ void kernelGradf(const float *d_x, float *d_grad, float *A, float *b, const size_t len)
{
size_t index = blockIdx.x * blockDim.x + threadIdx.x;
if (index >= len)
return;
d_grad[index] = 0.0f;
for (size_t j = 0; j < len; ++j)
{
d_grad[index] += A[index * len + j] * d_x[j];
}
d_grad[i... |
23,408 | //pass
//--gridDim=[1322,1,1] --blockDim=[256,1,1]
#include "common.h"
__global__ void getSuccessors(const uint *verticesOffsets,
const uint *minScannedEdges,
uint *successors,
uint verticesCount,
... |
23,409 | #include "includes.h"
__global__ void multiplyBy2(int *size, int *in, int *out) {
const int ix = threadIdx.x + blockIdx.x * blockDim.x;
if (ix < *size) {
out[ix] = in[ix] * 2;
}
} |
23,410 | #include "includes.h"
__global__ void TanhBackKernel(float* Z, float* dZ, int size){
int id = blockIdx.x * blockDim.x + threadIdx.x;
if(id < size){
float t = (Z[id]);
dZ[id] = dZ[id] * (1-t*t) ;
}
} |
23,411 | #include<stdio.h>
#include<cuda.h>
#define N 1 //shift/key of cipher
__global__ void encrypt(char *a)
{
a[threadIdx.x]+=N;
if(a[threadIdx.x]>122)
a[threadIdx.x]=200-a[threadIdx.x];
}
__global__ void decrypt(char *a)
{
a[threadIdx.x]-=N;
if(a[threadIdx.x]<97)
a[threadIdx.x]=200-a[threadIdx... |
23,412 |
#include <cuda_runtime.h> |
23,413 |
/* 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 ... |
23,414 | #include <thrust/reduce.h>
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
__constant__ double PI = 3.141592653589;
// nn => d_nnData ==> array of nearest point in scene from a given provenance vector
// kp => kpData ==> key point to t... |
23,415 | // RUN: %clang_cc1 -fcuda-is-device -triple spirv32 -o - -emit-llvm -x cuda %s | FileCheck %s
// RUN: %clang_cc1 -fcuda-is-device -triple spirv64 -o - -emit-llvm -x cuda %s | FileCheck %s
// Verifies that building CUDA targeting SPIR-V {32,64} generates LLVM IR with
// spir_kernel attributes for kernel functions.
/... |
23,416 | #include <stdio.h>
#include <sys/time.h>
#define SIZE 1024
__global__ void Add(int *c, int *a, int *b, int n){
int i = threadIdx.x;
if (i < n) {
c[i] = a[i] + b[i];
}
}
__global__ void Add_f(float *c, float *a, float *b, float n){
int i = threadIdx.x;
if (i < n) {
c[i] = a[i] ... |
23,417 | // Modified from
// https://github.com/sshaoshuai/Pointnet2.PyTorch/tree/master/pointnet2/src/interpolate_gpu.cu
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define THREADS_PER_BLOCK 256
#define DIVUP(m, n) ((m) / (n) + ((m) % (n) > 0))
__global__ void three_interpolate_kernel(int b, int c, int m, int n... |
23,418 | /* ###############################################
# Basic reduction kernel without optimization #
# #
# Kirtan Mali #
############################################### */
#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <cuda_runtime.h>
... |
23,419 | /**
#include <iostream>
#include <fstream>
#include <iomanip>
#include <complex>
#include <cmath>
#include "uvdma/_AppSource/uvAPI.h"
#include "DAQHandler.h"
//#include "glitchTest.h"
using namespace std;
//using namespace PAQ_SOQPSK;
int main(int argc, char ** argv)
{
//DAQHandler daqhandler;
//daqhandler.acquir... |
23,420 | #include <cuda_runtime.h>
#include <stdio.h>
#include <sys/time.h>
#include <fstream>
#include <iostream>
#include <stdlib.h>
using namespace std;
#define CHECK(call) \
{ \
const cudaError_t error = call; \
if (error != cudaSuccess) \
{ \
printf("Error: %s:%d ", __FILE__, __LINE__); \
... |
23,421 | #include "includes.h"
__global__ void combine_kernel(int nPixels, int cuePitchInFloats, float* devBg, float* devCga, float* devCgb, float* devTg, float* devMpb, float* devCombinedg) {
int index = blockDim.x * blockIdx.x + threadIdx.x;
int orientation = threadIdx.y;
int orientedIndex = orientation * cuePitchInFloats + i... |
23,422 | #include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <limits.h>
#include <algorithm>
#include <sys/time.h>
#include <cuda_runtime.h>
using namespace std;
#define INF INT_MAX-1
__global__
void FloydWarshall(int via, int from, int to, float *matrix, int n)
{
matrix[from * n + to] = min(matr... |
23,423 | #include "includes.h"
__global__ void SetElement(float *vector , int position , float what) {
vector[position] = what;
} |
23,424 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <cstdio>
#include <ctime>
cudaError_t addWithCuda(int *c, int *a, int *b, unsigned int size);
/*
__global__ void addKernel(int n, int *c, int *a, int *b)
{
int index = threadIdx.x;
int stride = blockDim.x;
for (int i = in... |
23,425 | #include "../util/cuda_util.cuh"
#include "corHelper.cuh"
#include "corOwn.cuh"
#include <cuda.h>
#include <cuda_runtime.h>
#include <stdio.h>
#define PERTHREAD 8
void gpuPMCC(const double *h_mat, uint64_t n, int dim, double *cors, int deviceId, bool verbose) {
if (verbose)
printf("Cor started with N=%lu, dim=%... |
23,426 | #include <cuda.h>
////////////////////////////////////////////////////////////////////////////////
// firDnRow kernel
// filtering and downsampling by 2 along 1st dimension
////////////////////////////////////////////////////////////////////////////////
__global__ void firDnRow(
double *d_Dst,
double *d_Src,
... |
23,427 | #include <stdio.h>
__global__ void hello(){
printf("Hello CUDA!\n");
}
int main(){
hello<<<1,1>>>();
cudaDeviceSynchronize();
return 0;
} |
23,428 | #include <stdio.h>
struct Complex {
double real;
double imag;
};
Complex* a_device = NULL;
Complex* host_mem = NULL;
Complex* device_precomp = NULL;
__global__
void donkey_inv(Complex* precomp,
Complex* a,
int blocks_per_half,
int lg_len,
int n... |
23,429 | // Jin Pyo Jeon
// Lab 02
#include <cuda.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <math.h>
#define T 1024 // Shared needs to be known at compile time??
__global__ void calculateDot(int N, int* a, int* b, unsigned long* result){
__shared__ int temp[T];
int lowRange = ceil(N / (T * 1.0)) ... |
23,430 | #include <stdio.h>
#include <cuda.h>
#define N 10
__host__ __device__ void fun(int *arr) {
for (unsigned ii = 0; ii < N; ++ii)
++arr[ii];
}
__global__ void dfun(int *arr) {
fun(arr);
}
__host__ __device__ void print(int *arr) {
for (unsigned ii = 0; ii < N; ++ii)
printf("%d, ", arr[ii]);
printf("\n");
}
__gl... |
23,431 | #include "includes.h"
__global__ void ker_gkylCartFieldAccumulate(unsigned s, unsigned nv, double fact, const double *inp, double *out)
{
for (int n = blockIdx.x*blockDim.x + threadIdx.x + s; n < s + nv; n += blockDim.x * gridDim.x)
out[n] += fact*inp[n];
} |
23,432 | #include "includes.h"
__global__ void Frontier_copy( unsigned int *frontier, unsigned int *frontier2, unsigned int *frontier_length)
{
unsigned int tid=threadIdx.x + blockDim.x * blockIdx.x;
if(tid<*frontier_length)
{
frontier[tid]=frontier2[tid];
}
if(tid==0)
{
g_mutex=0;
g_mutex2=0;
*g_q_offsets=0;
*g_q_size=0;
}
} |
23,433 | #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<time.h>
#include<cuda.h>
using namespace std;
__global__ void avg_pooling(float* dev, float* gpu_output_data, int input_h_size, int input_w_size, int pool_h_size, int pool_w_size, int pool_h_stride, int pool_w_stride)
{
int x... |
23,434 | __device__ int get(int x, int y,int width){
return y * width +x;
}
extern "C"
__global__ void EVAPORATION( int width, int height, float *values, float evapCoef)
{
int i = blockIdx.x * blockDim.x + threadIdx.x;
int j = blockIdx.y * blockDim.y + threadIdx.y;
if (i < width && j < height ... |
23,435 | #include<stdio.h>
__global__ void GetAverageAndNorm(float *R, int cols, int rows, float *avg, float *norm){
/* int tid = blockIdx.x*blockDim.x + threadIdx.x, countNonZero = 0;
float sum = 0.0f, avgThread = 0.0f;
for(int i = 0; i < cols; i++){
if (R[tid * cols + i] > 0.0f) {
s... |
23,436 | // CUDA runtime
#include <cuda_runtime.h>
#include <stdio.h>
// Helper functions and utilities to work with CUDA
// #include <helper_functions.h>
/**********************************************
* Check whether we read back the same input
* The double check is just for debug purposes.
* We can comment it out when be... |
23,437 | /**********************************************************************
* Name: Eric Blasko
* Date: 06/12/19
* Final
* reduction.cu
* This program performs reduction using CUDA and supports mulitple
* block reduction. Multiple kernal calls may be needed based
* on the number of blocks. Each block will sto... |
23,438 | __global__ void convtranspose_kernel(){
// extern __shared__ float shmem[];
// float* shared_X = &shmem[];
// float* shared_W = &shmem[output_size * output_size];
// int batch, out ;
// batch = blockIdx.x;
// out = blockIdx.y;
// int h_out, w_out;
// h_out = threadIdx.x;
// w_out... |
23,439 | #include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <math.h>
#include <chrono>
void checkCUDAError(const char *msg)
{
cudaError_t err = cudaGetLastError();
if( cudaSuccess != err)
{
fprintf(stderr, "CUDA Error: %s: %s.\n", msg, cudaGetErrorString(err) );
exit(EXIT_FAILURE);
}
}
#define BLOCKSIZE... |
23,440 | #include <cuda.h>
#include <stdio.h>
__global__ void initVector(float* vector, float value)
{
vector[threadIdx.x + blockDim.x * blockIdx.x] = value;
}
int main(int argc, char *argv[])
{
int blocks = 1024;
int threads = 1;
int size_vector = blocks * threads;
float time;
float value = 1.0;
float *dvector, *hvec... |
23,441 | #include "includes.h"
__global__ void cunn_CriterionFilter_updateGradInput_kernel( float *gradInput, float *target, float *ignored_label, int batch_size, int n_classes, int map_nelem, int blocks_per_sample)
{
int i, t;
int sample = blockIdx.x / blocks_per_sample;
int step = blockDim.x * blocks_per_sample;
int toffset =... |
23,442 | //compile: > nvcc -Xcompiler -Wall -o kern sp_mat_mult_ffq369_hector.cu -DCUDA=1
#include <cstdio>
#include <vector>
#include <cstdlib>
#define LINE_LEN 256
#define gpuErrchk(ans) {gpuAssert((ans), __FILE__, __LINE__); }
inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true)
{
if (code ... |
23,443 | extern "C"
#define ITERATIONS 10000
__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 c... |
23,444 | #include "includes.h"
#define ITER 4
#define BANK_OFFSET1(n) (n) + (((n) >> 5))
#define BANK_OFFSET(n) (n) + (((n) >> 5))
#define NUM_BLOCKS(length, dim) nextPow2(length) / (2 * dim)
#define ELEM 4
#define TOTAL_THREADS 512
#define TWO_PWR(n) (1 << (n))
extern float toBW(int bytes, float sec);
__global__ void add_k... |
23,445 | #include "includes.h"
__global__ void ReductionMin(unsigned int *sdata, unsigned int *results, int n) //take thread divergence into account
{
// extern __shared__ int sdata[];
unsigned int tx = threadIdx.x;
// block-wide reduction
for(unsigned int offset = blockDim.x>>1; offset > 0; offset >>= 1)
{
__syncthread... |
23,446 | #include <fstream>
#include <iostream>
#include <iomanip>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cuda_runtime_api.h>
#include <math.h>
using namespace std;
// 1 byte is stored in 2 pixels
// extract 1 byte per thread
__global__ void decode_per_byte(uchar4* const d_encodedImage, unsigned char* d_encod... |
23,447 | #include <stdio.h>
/*
* Refactor `loop` to be a CUDA Kernel. The new kernel should
* only do the work of 1 iteration of the original loop.
*/
__global__ void loop()
{
printf("This is iteration number %d\n", threadIdx.x);
}
int main()
{
/*
* When refactoring `loop` to launch as a kernel, be sure
* to use... |
23,448 | #include <pthread.h>
#include <stdio.h>
/* this function is run by the second thread */
void *inc_x(void *x_void_ptr)
{
/* increment x to 100 */
int *x_ptr = (int *)x_void_ptr;
while(++(*x_ptr) < 100);
printf("x increment finished\n");
/* the function must return something - NULL will do */
return NULL;
}
i... |
23,449 | #include "includes.h"
// filename: eeTanh.cu
// a simple CUDA kernel to square the elements of a matrix
extern "C" // ensure function name to be exactly "eeTanh"
{
}
__global__ void normLogErr(int N, int M, float *A, float *Y)
{
int i = blockIdx.x * blockDim.x + threadIdx.x;
int j = blockIdx.y... |
23,450 | //fail: assertion
//--blockDim=64 --gridDim=64 --no-inline
#include <stdio.h>
#include <cuda.h>
#include <stdlib.h>
#include <assert.h>
#define N 2//64
__device__ int f(int x) {
return x + 1;
}
__global__ void foo(int *y) {
*y = f(2);
}
int main() {
int *a = (int*)malloc(sizeof(int));
int *dev_a;
cudaMal... |
23,451 | #include "includes.h"
// In CUDA we trust.
// When compiling, use -std=c++11 or higher.
__global__ void histogramSimple(int* d_out, const int* d_in, const int BINS_COUNT) {
int tid = threadIdx.x + blockDim.x * blockIdx.x;
atomicAdd(&(d_out[d_in[tid] % BINS_COUNT]), 1);
} |
23,452 | #include "includes.h"
__global__ void im2col_gpu_kernel(const int n, const float* data_im, const int height, const int width, const int ksize, const int pad, const int stride, const int height_col, const int width_col, float *data_col) {
int index = blockIdx.x*blockDim.x + threadIdx.x;
for (; index < n; index += blockD... |
23,453 | #include "mse.hh"
#include <cassert>
#include <stdexcept>
#include "graph.hh"
#include "mse-grad.hh"
#include "ops-builder.hh"
#include "../runtime/node.hh"
#include "../memory/alloc.hh"
namespace ops
{
MSE::MSE(Op* y, Op* y_hat)
: Op("mse", Shape{}, {y, y_hat})
{}
void MSE::compile()
{
... |
23,454 | // Assert requires compute capability 2.x or higher
// (e.g., "nvcc -arch=sm_21").
#include <assert.h>
#include <stdio.h>
#include <cuda.h>
#define N 10
__global__ void synctest(void) {
int x, tid = threadIdx.x;
x = __syncthreads_count(tid % 2 == 0);
assert(x == N/2 + !!(N % 2));
x = __s... |
23,455 | /*
====================================================================================================
Description: HashTable
Custom implementation of hashtable for different DataTypes.
====================================================================================================
Date: 16 October 2021... |
23,456 | #include "includes.h"
__global__ void set_row_perm(int *d_bin_size, int *d_bin_offset, int *d_max_row_nz, int *d_row_perm, int M, int min, int mmin)
{
int i = blockDim.x * blockIdx.x + threadIdx.x;
if (i >= M) {
return;
}
int nz_per_row = d_max_row_nz[i];
int dest;
int j = 0;
for (j = 0; j < BIN_NUM - 2; j++) {
if (n... |
23,457 | #include "includes.h"
using namespace std;
#define BLOCKSIZE 32
//test code
__global__ void nmfw(float *a, int r, int c, int k, float *w, float *h, float *wcp)//must be block synchronized!!!
{
int row = blockIdx.y*blockDim.y + threadIdx.y;
int col = blockIdx.x*blockDim.x + threadIdx.x;
//compute W
if (col < k && row... |
23,458 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PI 3.141592
/**
* This macro checks return value of the CUDA runtime call and exits
* the application if the call failed.
*/
#define CUDA_CHECK_RETURN(value) { \
cudaError_t _m_cudaStat = value; \
if (_m_cudaStat != cudaSuccess) {... |
23,459 | #include <bits/stdc++.h>
#include <cuda.h>
#include <curand.h>
#include <curand_kernel.h>
using namespace std;
using namespace std::chrono;
/* Global Variables */
int *edge_array,*edge_array_parent,*vertex_array,*vertex_array_parent,*start_interval,*end_interval;
bool *active,*explored,*parent_updated,*is_leaf;
i... |
23,460 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <math.h>
#include <vector>
#include <iostream>
const int NUM_THREADS_PER_BLOCK_SINGLE = 8;
const int NUM_THREADS_PER_BLOCK = NUM_THREADS_PER_BLOCK_SINGLE * NUM_THREADS_PER_BLOCK_SINGLE;
__shared__ float F[NUM_THREADS_PER_BLO... |
23,461 | // ########################################################################
// Practical Course: GPU Programming in Computer Vision
// Technical University of Munich, Computer Vision Group
// ########################################################################
#include <cuda_runtime.h>
#include <iostream>
using na... |
23,462 | /*
**********************************************
* CS314 Principles of Programming Languages *
* Spring 2020 *
**********************************************
*/
#include <stdio.h>
#include <stdlib.h>
__global__ void markFilterEdges_gpu(int * src, int * dst, int * matches, int * ke... |
23,463 | #include <iostream>
#include <math.h>
__global__
void init(int n, float *x, float val){
int index = blockDim.x * blockIdx.x + threadIdx.x;
int stride = gridDim.x * blockDim.x;
for(int i = index; i < n; i += stride){
x[i] = val;
}
}
__global__
void add(int n, float *x, float *y){
int index ... |
23,464 | /*
*this file exercise matrix multiplication with shared memory and use
*the thought of dividing matrix to sub_matrix
*/
#include<time.h>
#include<stdlib.h>
#include<stdio.h>
#include<assert.h>
#include<cuda_profiler_api.h>
#define BLOCK_SIZE 8
#define MATRIX_SIZE 64
typedef struct {
int width;
int height;
f... |
23,465 | // Elapsed Real Time for input-c4.txt:
// Elapsed Real Time for input-c5.txt:
#include <stdio.h>
#include <stdbool.h>
#include <cuda_runtime.h>
// Simple struct for representing a circle.
typedef struct {
int x, y;
int r;
} Circle;
// List of all circles.
Circle *cList;
// Number of circles on our list.
int cCo... |
23,466 | /*
*
* Programa de Introducción a los conceptos de CUDA
*
*
*
*
*/
#include <stdio.h>
#include <stdlib.h>
/* Declaración de métodos/
/* Utilidad para checar errores de CUDA */
void checkCUDAError(const char*);
/* Kernel para sumar dos vectores en un sólo bloque de hilos */
__global__ void vect_add(int *... |
23,467 | #include <stdio.h>
// Macro for checking errors in GPU API calls
#define gpuErrorCheck(call) \
do{ \
cudaError_t gpuErr = call; ... |
23,468 | #include "includes.h"
__global__ void reg_addArrays_kernel_float(float *array1_d, float *array2_d)
{
const int tid= (blockIdx.y*gridDim.x+blockIdx.x)*blockDim.x+threadIdx.x;
if(tid < c_VoxelNumber){
array1_d[tid] += array2_d[tid];
}
} |
23,469 | #include <cmath> /* pow() */
#include <cstdint> /* uint64_t */
#include <ctime> /* time() */
#include <cstdlib>
#include <unistd.h>
#include <iostream>
using namespace std;
#include <ctime> /* time() */
#include <sys/time.h>
#include <stdlib.h>
#include <iostream>
#include <cstdint> /* int64_t, uint64_t */
void... |
23,470 | #include <stdio.h>
#define N (100*1024*1024)
#define CHUNK_SIZE (1024*1024)
void random_ints(int* a, int size){
for(int i =0; i<size; i++)
a[i]=rand()%1000;
}
__global__ void addVecs(int *c, int *a, int *b){
int index = threadIdx.x + blockIdx.x * blockDim.x;
c[index] = a[index]+b[index];
}
int main(){
i... |
23,471 | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define N 8192
#define LINEAR_SIDE 8
void print_matrix(int *p){
for(int i = 0;i<N;i++){
for(int j=0;j<N;j++){printf("%d ",p[i*N + j]);}
printf("\n");
}
}
void fill_matrix(int *p){
for(int i = 0; i<N;i++){
... |
23,472 | // Author: Ulises Olivares
// uolivares@unam.mx
// Oct 22, 2020
#include<iostream>
#include<stdio.h>
#include<time.h>
#include<cstdlib>
#include<math.h>
#include <unistd.h>
#define n 99999999 // input/output 1D array size
#define m 9999 //assume mask size as odd
#define TILE_SIZE 1024
#define MAX_MASK_WIDTH 256... |
23,473 | #include <stdio.h>
__global__ void cube(float *d_in, float *d_out){
int idx = threadIdx.x;
float data = d_in[idx];
d_out[idx] = data * data * data;
}
int main(int argc, char ** argv){
const int ARRAY_SIZE = 96;
const int ARRAY_BYTES = ARRAY_SIZE * sizeof(float);
float h_in[ARRAY_SIZE];
fl... |
23,474 | /*
This is a basic code to compare between Host Code(CPU) and Device Code(GPU)
*/
#include<iostream>
using namespace std;
int main(void)
{
cout << "Hello World \n";
return 0;
}
|
23,475 | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
const int THREAD_SIZE = 1024 * sizeof(int);
int randomNumberGeneration(int upperBound, int lowerBound) {
// creates a random integer within the bounds
int num = (rand() % (upperBound - lowerBound + 1)) + lowerBound;
return num;
}... |
23,476 | #include <cuda.h>
#include <cuda_runtime_api.h>
#include <stdio.h>
__global__
void cudaMultVectorsKernel(int N, float *x, float *y, float *z)
{
int idx = blockIdx.x*blockDim.x + threadIdx.x;
if (idx < N) {
z[idx] = x[idx] * y[idx];
}
// idx = idx + blockDim.x * gridDim.x; // we will discuss this later...
}... |
23,477 | #include "includes.h"
__global__ void ApplyMat3(float* input, float* output, float* matrix){
int id = threadIdx.x + blockDim.x * blockIdx.x;
//for (int i = 0; i < 148 * 148; ++i){
// if(input[i] > 0.1f) printf("Input above 0, %i", i);
//}
for (int i = 0; i < 146; ++i){
float total = 0.0f;
//if (input[id * 148 + i] >... |
23,478 | #include <stdlib.h>
#include <vector>
#include <algorithm>
#include <iostream>
#define TILE_WIDTH 16
// Task 1 - simple matrix multiplication
__global__ void matrix_multiply_simple(float *ma, float *mb, float *mc, size_t width)
{
//TODO: calculate the row & column index of the element
int row = blockIdx.y * blockDi... |
23,479 | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;
// Struct: Color Photo Pixels
struct Color{
unsigned char red;
unsigned char green;
unsigned char blue;
};
// Struct: BW Photo
struct BW{
unsigned char pixel;
};
// Global Variables
ch... |
23,480 | #include "includes.h"
__device__ double complexMagnitude(double2 in){
return sqrt(in.x*in.x + in.y*in.y);
}
__global__ void complexMag_test(double2 *in, double *out){
out[0] = complexMagnitude(in[0]);
} |
23,481 | // ##########################################################
// By Eugene Ch'ng | www.complexity.io
// Email: genechng@gmail.com
// ----------------------------------------------------------
// The ERC 'Lost Frontiers' Project
// Development for the Parallelisation of ABM Simulation
// ------------------------------... |
23,482 | __global__
void Mandelbrot(float* out,const double* re,const double* im){
int idx = blockIdx.x*blockDim.x + threadIdx.x;
double zr=0;
double zi=0;
double cr=re[idx];
double ci=im[idx];
double count=0;
for(int i=1;i<1000;i++){
double zrt=zr*zr-zi*zi;
double zit=2*zr*zi;
... |
23,483 | //#include <cuda.h>
//#include <cuda_runtime.h>
//#include <stdio.h>
//#include <iostream>
//using namespace::std;
//__global__ void test(int* d_in, int* d_out)
//{
// for (int i=0; i<5; i++)
// {
// d_out[i] = d_in[i]+1;
// }
//}
//
//void test_wrapper(void* d_in, void* d_out)
//{
// test<<<1,1>>>((int*)d_in, (int*)d... |
23,484 | #include "device_launch_parameters.h"
#include "cuda_runtime.h"
#include <ctime>
#include <cstdio>
#include <cmath>
__global__ void primes_in_range(int *result)
{
double number = (blockIdx.x * blockDim.x) + threadIdx.x;
if (number <0)
{
return;
}
if (fmod(number,1000000.0) == 0) printf("%f %d\n", number, *re... |
23,485 | #include "includes.h"
__global__ void MatrixMul( float *Md , float *Nd , float *Pd , const int WIDTH )
{
// calculate thread id
unsigned int col = TILE_WIDTH*blockIdx.x + threadIdx.x;
unsigned int row = TILE_WIDTH*blockIdx.y + threadIdx.y;
for (int k = 0 ; k<WIDTH ; k++ )
{
Pd[row*WIDTH + col]+= Md[row * WIDTH + k ] *... |
23,486 | #include "includes.h"
#define L2HYS_EPSILON 0.01f
#define L2HYS_EPSILONHYS 1.0f
#define L2HYS_CLIP 0.2f
#define data_h2y 30
//long h_windowx=Imagewidth/Windowx;
//long h_windowy=ImageHeight/Windowy;
//dim3 blocks(h_windowx,h_windowy);//h_windowx=ImageWidth/Windowx,h_windowy=ImageHeight/Windowy
//dim3 thr... |
23,487 | /*
**********************************************
* CS314 Principles of Programming Languages *
* Spring 2020 *
**********************************************
*/
#include <stdio.h>
#include <stdlib.h>
__global__ void exclusive_prefix_sum_gpu(int * oldSum, int * newSum, int distance... |
23,488 | extern "C"
__global__ void galoisMul(int n, unsigned char *a, unsigned char *b, unsigned char *res)
{
int p = 0;
for (int i = 0; i < 8; i++) {
if ((*b & 1) == 1) {
p = p ^ *a;
}
int hiBitSet = *a & 0x80;
*a = (unsigned char)((*a & 0xff) << 1);... |
23,489 | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include <unistd.h>
#include "MobileNets_kernel.cu"
#define INPUT_LAYER_SIZE 225 * 225 * 3
#define FIRST_LAYER_WEIGHT_SIZE 32 * 3 * 3 * 3
#define FIRST_LAYER_OUTPUT_SIZE 114 * 114 * 32
#define FIRST_LAYER_CHANNELS 32
#define SECOND_LAYER_WEIGHT... |
23,490 |
/* This is a automatically generated test. Do not modify */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
__global__
void compute(float comp, int var_1,int var_2,float var_3,float var_4,float var_5,float var_6,float var_7,float var_8,float var_9,float var_10,float var_11,float var_12,float var_13,float va... |
23,491 | #include <stdio.h>
#include <cuda_runtime.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <png.h>
void abort_(const char * s, ...)
{
va_list args;
va_start(args, s);
vfprintf(stderr, s, args);
fprintf(stderr, "\n");
... |
23,492 | #include "slicer.cuh"
#include <thrust/sort.h>
#include <thrust/functional.h>
#include <stdio.h>
/**
* fps1: First stage of slicing -- Ray Triangle Intersection
* Inputs:
* triangles -- array of all triangles
* num_triangles -- length of the triangle array
* locks -- array of locks (used in atomic... |
23,493 | #include "includes.h"
#define GLM_FORCE_CUDA
// LOOK-2.1 potentially useful for doing grid-based neighbor search
#ifndef imax
#define imax( a, b ) ( ((a) > (b)) ? (a) : (b) )
#endif
#ifndef imin
#define imin( a, b ) ( ((a) < (b)) ? (a) : (b) )
#endif
#define checkCUDAErrorWithLine(msg) checkCUDAError(msg, __LINE__)
... |
23,494 | /******************************************************************************
*cr
*cr (C) Copyright 2010-2013 The Board of Trustees of the
*cr University of Illinois
*cr All Rights Reserved
*cr
***************************************************************... |
23,495 | #include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <numeric>
#include <iostream>
float random_float(void)
{
return static_cast<float>(rand()) / RAND_MAX;
}
// this kernel computes, per-block, the sum
// of a block-sized portion of the input
// using a block-wide reduction
__global__ void block_sum(... |
23,496 | /*
Monte Roybal
CS_577 Parallel and Distributed Programming
5-2-2018
Dr. Gil Gallegos
Jacobi Kernel Solution with 4x4 and 9x9 A Matrices
*/
/*Link Section*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define N 4
/*Jacobi Method Algorithm Kernel*/
__global__ void jacobi_kernel(double *a,double *b,double... |
23,497 | #include <curand_kernel.h>
extern "C"
__global__ void uniform_float(int n,float lower,float upper,float *randomNumbers, float *result) {
int totalThreads = gridDim.x * blockDim.x;
int tid = threadIdx.x;
int i = blockIdx.x * blockDim.x + tid;
for(; i < n; i += totalThreads) ... |
23,498 | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "matmul.cuh"
float mat_a[MAT_SIZE][MAT_SIZE];
float mat_b[MAT_SIZE][MAT_SIZE];
float mat_c[MAT_SIZE][MAT_SIZE];
static void generate_matrices();
int main(int argc, char* argv[]) {
if (argc != 2) {
fprintf(stderr, "Usag... |
23,499 | #include <algorithm>
#include <vector>
#include <random>
#include <functional>
#include <iostream>
#include <stdio.h>
#include <cuda_runtime.h>
#define TILE_WIDTH 16
#define GPU_ERROR(ans) { gpuAssert((ans), __FILE__, __LINE__); }
inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true) {... |
23,500 | #include "includes.h"
__global__ void cudaDadd_kernel(unsigned int size, double value, const double *x, double *y)
{
const unsigned int index = blockIdx.x * blockDim.x + threadIdx.x;
const unsigned int stride = blockDim.x * gridDim.x;
for (unsigned int i = index; i < size; i += stride) {
y[i] = x[i] + value;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.