serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
5,101 | #include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <time.h>
#include <iostream>
#include <cstring>
using namespace std;
#define NO_OF_CHARS 256
// A utility function to get maximum of two integers
// The preprocessing function for Boyer Moore's
// bad char... |
5,102 | #include "includes.h"
__global__ void Matrix_getRow_FloatPointer_naive(const float * A , int Acount, int Acols, const float * rowId , int empty_par1, int empty_par2, float * out0 , int out0count, int out0cols)
{
int id = blockDim.x*blockIdx.y*gridDim.x + blockDim.x*blockIdx.x + threadIdx.x;
if (id<Acols)
{
out0[id] = A... |
5,103 | #include <cfloat>
#include <climits>
#include <cmath>
__global__ void isinf_kernel(const double* value, bool* result)
{
result[threadIdx.x] = value[threadIdx.x] >= DBL_MAX;
}
|
5,104 | #include "cuda.h"
#include <stdio.h>
__global__ void mandel(double* ref_real_array,
double* ref_imag_array,
double* dc_real_array,
double* dc_imag_array,
int depth,
int* count_array)
{
unsigned int i = threadI... |
5,105 | __global__ void stochasticGradientDescentKernel (
int numberIterations,
float learningRate,
int* parameterIndices,
int* counts,
int parameterSize,
float* parameters,
float* gradient) {
int startEntry = (blockIdx.y * blockDim.x * numberIterations) + threadIdx.x * numberIterations;
i... |
5,106 | #include <stdio.h>
#include <cuda.h>
__global__ void sumKernel (double *d_a, double *d_b, double *d_c)
{
/* Sums the values in arrays d_a and d_b,
storing the result in d_c.
*/
int i = threadIdx.x;
d_c[i] = d_a[i] + d_b[i];
}
#define N 32
int main ()
{
double *a, *b, *c;
double *d_a, *d_b, *d_c;
... |
5,107 | #include <stdio.h>
#include <cuda_runtime.h>
#include <time.h>
#include <sys/time.h>
__global__ void
vector(int *A, int *B, int *C, int numElements)
{
int i = blockDim.x * blockIdx.x + threadIdx.x;
if (i < numElements)
{
C[B[i]] = A[i];
}
}
int main(int argc, char **argv)
{
struct timeval... |
5,108 | __global__
void f1( float3* __restrict__ ptr ) {
float3 v = ptr[threadIdx.x];
v.x += 1;
v.y += 1;
v.z += 1;
ptr[threadIdx.x] = v;
}
__global__
void f2( float* __restrict__ ptr1, float* __restrict__ ptr2, float* __restrict__ ptr3 ) {
ptr1[threadIdx.x] += 1;
ptr2[threadIdx.x] += 1;
ptr3[threadIdx.x] += 1... |
5,109 | //---------------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
//---------------------------------------------------------------------------------
static const int WORK_SIZE = 200000000;
static const int BLK_SIZE = 256;
u... |
5,110 | #include "includes.h"
__global__ void Update(float *WHAT , float *WITH , float AMOUNT) {
int idx = threadIdx.x + blockIdx.x * blockDim.x; // which voxel
WHAT[idx] +=AMOUNT*WITH[idx];
} |
5,111 | #include "includes.h"
__global__ void colorDistDiff_kernel(uchar4 *out_image, const float *disparity, int disparity_pitch, const float *disparity_prior, int width, int height, float f, float b, float ox, float oy, float dist_thres) {
const int x = blockIdx.x * blockDim.x + threadIdx.x;
const int y = blockIdx.y * blockD... |
5,112 | #include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <cmath>
#include <string>
#include <iostream>
using namespace std::chrono;
using namespace std;
__global__ void addMatOnDevice2D(float *in1, float *in2, float *out, int nx, int ny)
{
int ix = threadIdx.x + blockIdx.x * blockDim.x;
int iy = thre... |
5,113 | #include <iostream>
#include <chrono>
#include <cuda_runtime.h>
#include <string>
#include <iomanip>
using namespace std;
using ST = unsigned long long;
constexpr ST TOTAL_SIZE = 1 << 30; // 1 GB
constexpr ST TOTAL_SIZE_IN_BYTES = TOTAL_SIZE * sizeof(char);
constexpr ST CNT = 19;
const string grand_name[CNT] = {
"... |
5,114 | #include <iostream>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <thrust/extrema.h>
#include <thrust/device_vector.h>
#define CSC(call) \
do { \
cudaError_t res = call; ... |
5,115 | /* CUDA finite difference wave equation solver, written by
* Jeff Amelang, 2012
*
* Modified by Kevin Yuh, 2013-14 */
#include <cstdio>
#include <cuda_runtime.h>
#include "Cuda1DFDWave_cuda.cuh"
/* TODO: You'll need a kernel here, as well as any helper functions
to call it */
__global__
void waveEquationKernal... |
5,116 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include<iostream>
#include <stdio.h>
using namespace std;
cudaError_t addWithCuda(int *c, const int *a, const int *b, size_t size);
__global__ void addKernel(int *c, const int *a, const int *b)
{
int i = threadIdx.x;
c[i] = a[... |
5,117 | #include "memory.h"
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#define CACHED
#ifdef CACHED
#define CACHELEN 128
typedef struct _tup
{
size_t bytes;
void* ptr;
bool free;
} _tup;
_tup cache[CACHELEN];
bool initialized = false;
#endif // CACHED
void
cuda_malloc_clear(void** ptr, size_... |
5,118 | #include "includes.h"
__global__ void warmup(float *input, float *output) {
const int i = threadIdx.x + blockIdx.x * blockDim.x;
output[i] = input[i] * input[i];
} |
5,119 | #include <iostream>
/*
This code is copied/adapted from
https://devblogs.nvidia.com/how-query-device-properties-and-handle-errors-cuda-cc/
*/
using namespace std;
int main(int argc, char const *argv[]) {
/* code */
int nDevices = 0;
cudaGetDeviceCount(&nDevices);
//sets nDevices to the number of CUDA capable d... |
5,120 | /**
* @file SgemmGPU.cu
*
* @author btran
*
*/
#include "SgemmGPU.cuh"
#include <cublas_v2.h>
#include <thrust/device_vector.h>
namespace cuda
{
void sgemmGPU(int n, float alpha, const float* A, const float* B, float beta, float* C)
{
cublasStatus_t status;
cublasHandle_t handle;
status = cublas... |
5,121 | // ******************************************************************************************************
// PURPOSE : Print values for CUDA runtime variables for 3D configuration (4*4*4) threads. *
// LANGUAGE : CUDA C / CUDA C++ *
// ASSUMPTIONS : 3D Configuration 64 threads in each x,y & direction... |
5,122 | #include "mnist.hh"
#include <cassert>
#include <cstdio>
#include <stdexcept>
namespace mnist
{
namespace
{
static constexpr std::size_t NIMGS = 70000;
static constexpr std::size_t IMG_SIZE = 784;
}
void load(const std::string& path, dbl_t** x, dbl_t** y)
{
FILE* f =... |
5,123 | #include "cuda_runtime.h"
#include <chrono>
#include <cstdlib>
#include <iostream>
#include<sys/time.h>
using namespace std;
__global__ void transposeKernel(const double* A, double* AT, int N) {
int xIndex = blockDim.x * blockIdx.x + threadIdx.x;
int yIndex = blockDim.y * blockIdx.y + threadIdx.y;
AT[yIndex+xIn... |
5,124 | __global__ void kernel( void ) {
int id = 1;
} |
5,125 | //===- elementwise.cu -----------------------------------------*--- C++ -*-===//
//
// Copyright 2022 ByteDance Ltd. and/or its affiliates. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy... |
5,126 | #include <iostream>
#include <memory>
#include <chrono>
#include <random>
__global__ void add(float* vec_a, float* vec_b, float* vec_c, int n)
{
int i = blockIdx.x * blockDim.x + threadIdx.x;
if (i < n)
{
vec_c[i] = vec_a[i] + vec_b[i];
i += blockDim.x * gridDim.x;
}
}
int main(int arg... |
5,127 | #include <cstdio>
extern "C" {
__global__ void helloWorld(char *data) {
#if __CUDA_ARCH__ >= 200
printf("Hello, world! I'm thread (%d,%d,%d) in block (%d,%d,%d).\n",
threadIdx.x, threadIdx.y, threadIdx.z,
blockIdx.x, blockIdx.y, blockIdx.z);
#endif
int sum = 0;
for (int i=0; i<100; i... |
5,128 | #include "includes.h"
__global__ void SolveSmoothMedianGlobalKernel3(float* u, float* v, float* bku, float* bkv, int width, int height, int stride, float *outputu, float *outputv, float *outputbku, float* outputbkv)
{
const int ix = threadIdx.x + blockIdx.x * blockDim.x;
const int iy = threadIdx.y + blockIdx.y * blockD... |
5,129 | #include <stdio.h>
//onCPU
void onCPU()
{
printf("This is running on CPU\n");
}
//Kernel runs on GPU
__global__ void onGPU()
{
//keeps track of thread Index of the block
int i = threadIdx.x;
printf("This is running on GPU with the treadIndex of %d\n",&i);
}
int main()
{
//1 block/grid, runs 5 threads/block
... |
5,130 | extern "C" {
#define INPUT(i,j) input_grid[(j) + (i)*(N)]
#define WINDOW_SIZE (7)
#define NEIGHBOR_SIZE (3)
__global__ void nlmSimple(int N, double const *input_grid, double *output_grid, float filtSigma)
{
int gindex = threadIdx.x + blockIdx.x * blockDim.x;
int pix_ix,
... |
5,131 | #include "includes.h"
__global__ void gpu_update_sign(int *G, double *w ,int *neighbors , int k , int n ,int *temp, int *flag,int it_b ,int it_t)
{
int result;
double sum = 0.0;
int buf=0;
//Find the indexes
int x = blockIdx.x+it_b*gridDim.x;
int y = threadIdx.x+it_t*blockDim.x;
if (blockIdx.x+it_b*gridDim.x<n && thre... |
5,132 | #include <stdio.h>
unsigned char* dev_bitmap;
struct cuComplex
{
float r;
float i;
__device__ cuComplex(float a, float b) : r(a), i(b)
{
}
__device__ float magnitude2(void)
{
return r * r + i * i;
}
__device__ cuComplex operator*(const cuComplex& a)
{
return cuComplex(r * a.r - i * a.i, i * a.r + r * a... |
5,133 | #include "includes.h"
__global__ void min(int* U, int* d, int* outDel, int* minOutEdges, size_t gSize, int useD) {
int globalThreadId = blockIdx.x * blockDim.x + threadIdx.x;
int pos1 = 2*globalThreadId;
int pos2 = 2*globalThreadId + 1;
int val1, val2;
if(pos1 < gSize) {
val1 = minOutEdges[pos1] + (useD ? d[pos1] : 0)... |
5,134 | #include "includes.h"
__global__ void x15(float* x16, float* x17, float* x18, int x19) {
int x20 = gridDim.x * blockDim.x;
int x21 = threadIdx.x + blockIdx.x * blockDim.x;
while (x21 < x19) {
int x22 = x21;
x18[x22] = x16[x22] - x17[x22];
x21 = x21 + x20;
}
} |
5,135 | #include <thrust/device_vector.h>
#include <thrust/inner_product.h>
#include <math.h>
#include <stdio.h>
#define N (1024*1024)
int main() {
thrust::device_vector<float> dvec_x(N, 1.f);
float norm = sqrt(thrust::inner_product(dvec_x.begin(), dvec_x.end(), dvec_x.begin(), 0.0f));
printf("norm = %.0f\n", norm... |
5,136 | #include <stdio.h>
__global__ void hello_GPU(void){
int i = threadIdx.x;
printf("hello from GPU[%d]!\n",i);
}
int main(void){
printf("Hello, World - from CPU!\n");
hello_GPU<<<2,3>>>();
cudaDeviceSynchronize();
return 0;
}
|
5,137 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
//#include "cuda_common.cuh"
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring>
__global__ void sum_array_gpu(int* a, int* b, int* c, int size)
{
int gid = blockIdx.x * blockDim.x + threadIdx.x;
if (gid < size) {
c[... |
5,138 | #include <stdio.h>
#define N 1000
__global__ void vector_add(float *out, float *a, float *b, int n) {
for (int i = 0; i < n; i++) {
out[i] = a[i] + b[i];
}
}
int main(){
float *d_a, *d_b, *d_c;
float *h_a, *h_b, *h_c;
h_a = (float*)malloc(N * sizeof(float));
h_b = (float*)malloc(N * sizeof(float));
h_c =... |
5,139 | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
#include <assert.h>
#include <unistd.h>
#include <cuda_profiler_api.h>
#include <vector>
#include <unordered_map>
#include <iostream>
#include <fstream>
#include <numeric>
#include <functional>
#include <set>
#include <chrono>
//#include... |
5,140 | #include <iostream>
#include <stdio.h>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <iomanip>
class Properties {
private:
typedef std::vector<std::pair<std::string, std::string>> PTYPE;
std::list<PTYPE> allprops;
PTYPE* theseprops = nullptr;
public:
Properties& add(con... |
5,141 | /* Metsai Aleksandros 7723
* metsalex@ece.auth.gr
*
* Game of life using CUDA. Multiple cells per thread and use of shared memory
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
#define THRESHOLD 0.4
#define CELLS_PER_THREAD 2
#define THREADS_PER_BLOCK (500/CELLS_PER_THREAD)
... |
5,142 | #include<cuda_runtime.h>
#include<device_launch_parameters.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
__global__ void add(int* d_a,int* d_b,int* d_r)
{
int col = threadIdx.x;
int row = blockIdx.x;
int size = blockDim.x;
d_r[row*(size)+col] = d_a[row*(size)+col] + d_b[row*(size)+col];
}
int main... |
5,143 | #include <stdio.h>
#include <cmath>
#include <math.h>
#include <stdlib.h>
#include <unistd.h>
#include <cuda.h>
#include <cuda_runtime.h>
__global__ void add(int *a, int *b, int *c)
{
int index = threadIdx.x + blockIdx.x * blockDim.x;
c[index] = a[index] + b[index];
}
void testmain(int size, int *c)
{
int *a, *b;... |
5,144 | __device__ unsigned int reduce_sum(unsigned int in)
{
extern __shared__ unsigned int sdata[];
// Perform first level of reduction:
// - Write to shared memory
unsigned int ltid = threadIdx.x;
sdata[ltid] = in;
__syncthreads();
// Do reduction in shared mem
for (unsigned int s = blockD... |
5,145 | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <cuda_runtime.h>
#define N 10
__global__ void gpu_shared_mem(float *d)
{
int i, idx = threadIdx.x;
float avg, sum=0.0;
//Defining shared memory
__shared__ float sh_arr[N];
sh_arr[idx] = d[idx];
__syncthreads();
for(i=0; i<=i... |
5,146 | #include "includes.h"
#define BIN_WIDTH 0.25
#define BLOCK_DIM 256
#define COVERAGE 180
#define LINE_LENGTH 30
#define BINS_TOTAL (COVERAGE * (int)(1 / BIN_WIDTH))
typedef struct Galaxy
{
float declination;
float declination_cos;
float declination_sin;
float right_ascension;
} Galaxy;
__device__ float arcminutes_t... |
5,147 | #include <cuda_runtime.h>
#include <stdio.h>
int main(int argc, char **argv) {
// define total data elements
int nElem = 1024;
// define grid and block structure
dim3 block(1024);
dim3 grid((nElem + block.x - 1) / block.x);
printf("grid.x %d block.x %d \n", grid.x, block.x);
// reset block
block.x = 512;... |
5,148 | // Based on the Eric's Matlab implementation of ldpcEncoder1.
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
void ldpcEncoder (unsigned int *messageBits, unsigned int* W_ROW_ROM,
unsigned int numMsgBits, unsigned int numRowsInRom,
unsigned int numParBits,... |
5,149 | #include <iostream>
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/copy.h>
#include <thrust/sort.h>
#define MATRIX_SIZE 1024
#define BLOCK_SIZE 16;
int main() {
// allocate
thrust::host_vector<float> host_vec(3);
thrust::device_vector<float> device_vec(3);
// initialize
... |
5,150 | #include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <cuda_runtime.h>
#include <cuda.h>
#define gpuErrchk(ans){gpuAssert((ans),__FILE__,__LINE__);}
inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=false){
if(code != cudaSuccess){
printf("GPUassert: %s %s %d\n", cudaGetEr... |
5,151 | // sudo nvprof --unified-memory-profiling off ./ManagedMemoryVecAdd
// Use this command for profiling without errors for unified memory profiling
#include<iostream>
__global__ void vecAdd(int *a, int *b, int *c, int N){
int i = blockDim.x * blockIdx.x + threadIdx.x;
if(i < N){
c[i] = a[i] + b[i];
}
}
__global__ voi... |
5,152 | #include <iostream>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <curand.h>
#include <random>
#define BLOCK_SIZE 500
using namespace std;
__global__ void piCalcGPU(float* d_X, float* d_Y, int* d_countInBlocks, int blocksPerGrid, int N)
{
__shared__ int shared_blocks[500];
... |
5,153 | #include "includes.h"
#ifndef _KERNEL_H
#define _KERNEL_H
typedef struct Node {
int starting;
int no_of_edges;
}Node;
#endif
__global__ void bfs_kernel(Node* d_graph_nodes, int* d_edge_list, bool* d_graph_level, bool* d_graph_visited, int* d_cost, bool* loop, int no_of_nodes) {
int tid = blockIdx.x * blockDim.x + th... |
5,154 | #include "includes.h"
__global__ void markSegments( unsigned short * d_mark, unsigned int circuitGraphEdgeCount, unsigned int * d_cg_edge_start, unsigned int * d_cedgeCount, unsigned int circuitVertexSize){
unsigned int tid=(blockDim.x*blockDim.y * gridDim.x*blockIdx.y) + (blockDim.x*blockDim.y*blockIdx.x)+(blockDi... |
5,155 | #include "includes.h"
__global__ void int_to_char(int * img2, unsigned char * img)
{
int x = blockIdx.x * TILE_DIM + threadIdx.x;
int y = blockIdx.y * TILE_DIM + threadIdx.y;
int width = gridDim.x * TILE_DIM;
for (int j = 0; j < TILE_DIM; j+= BLOCK_ROWS) {
img[3*((y+j)*width + x)] = img2[(y+j)*width + x] / (256*256);
i... |
5,156 | #include "device_launch_parameters.h"
#include <iostream>
#include <stdio.h>
#include <cuda_runtime.h>
#include <time.h>
using namespace std;
#define eps 1e-4
// 2d grid 2d block
__global__ void matadd(const float *a, const float *b, float *c, int n, int m){
int i = blockDim.x * blockIdx.x + threadIdx.x;
int j... |
5,157 | template<class T>
__device__ const T& mymin(const T& a, const T& b)
{
return (b < a) ? b : a;
}
__global__ void call_min(double* first, const double* second)
{
first[threadIdx.x] = mymin(first[threadIdx.x], second[threadIdx.x]);
}
|
5,158 | #include <stdio.h>
__global__ void hello_kernel(){
int bid = blockIdx.x;
int tid = threadIdx.x;
printf("Hello from block %d, thread %d of the GPU!\n", bid, tid);
}
extern "C" void hello(){
// do stuff here
printf("Executing kernel...\n");
hello_kernel<<<2,2>>>();
cudaDeviceSynchronize();
}
|
5,159 | #include <cuda_runtime.h>
#include <curand.h>
__device__ double doBinomial(int n, double p, double *randomNumbers,curandGenerator_t s) {
int x = 0;
int tid = threadIdx.x + blockIdx.x * blockDim.x;
for(int i = tid; i < n; i++) {
if(randomNumbers[i]< p )
x++;
}
return x;
}
extern "C"
__global__ voi... |
5,160 | #include <thrust/iterator/counting_iterator.h>
#include <thrust/reduce.h>
#include <iostream>
int main(void)
{
thrust::counting_iterator<int64_t> start(1);
int64_t sum = thrust::reduce(start,
start + 1000000000,
0,
thrust:... |
5,161 | #include "includes.h"
#define N 128*256
#define THREADS_PER_BLOCK 256
#define N_BLOCKS N/THREADS_PER_BLOCK
// Kernel to add N integers using threads and blocks
// Main program
__global__ void add(int *a, int *b, int *c){
int index = blockIdx.x * blockDim.x + threadIdx.x;
c[index] = a[index] + b[index];
} |
5,162 | #include "includes.h"
__global__ void SoftmaxLossBackprop(const float *label, int num_labels, int batch_size, float *diff)
{
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx >= batch_size)
return;
const int label_value = static_cast<int>(label[idx]);
// For each item in the batch, decrease the result of the l... |
5,163 | /**
* Calculates the histogram 256 with the CPU
* @param a - Input Data (1xN)
* @param H - Output 256x1 Histogram
* @param N - Length of a
*/
void h_HG(int* a, int N, int* H)
{
/* Set the data to 0 before cumulative sum */
for(int i = 0; i < 256; i++)
{
H[i] = 0;
}
/* Accumulate the sum... |
5,164 | #include<stdio.h>
#include<stdlib.h>
__global__ void matAdd(int *matrixA, int *matrixB, int *matrixC, int matSize)
{
int threadCol = blockIdx.x * blockDim.x + threadIdx.x;
int threadRow = blockIdx.y * blockDim.y + threadIdx.y;
int indexOfMatrix = threadCol + threadRow * matSize;
if(threadCol < matSiz... |
5,165 | #include "includes.h"
__global__ void kernel_diagdiv_fl(int M, float eps, float *y, float *x){
unsigned int tid = blockIdx.x*blockDim.x + threadIdx.x;
/* make sure to use only M threads */
if (tid<M) {
if (x[tid]>eps) {
y[tid]=y[tid]/x[tid];
} else {
y[tid]=0.0f;
}
}
} |
5,166 | // Homework 8: CUDA implementation
// Mike James
// 5/3/2018
#include <cstdlib>
#include <stdio.h>
#define max 1024
#define elements 2
__global__ void dotprod(float *x, float *y, float *k, int *i) {
float sum = 0.0;
for (int m = 0; m < *i; m++) {
sum = x[m] * y[m];
__syncthreads();
*k = *k + sum;
}
}
int ma... |
5,167 | #include <cuda.h>
#include <stdio.h>
#include <stdlib.h>
#define N (1024 * 1024)
#define FULL_DATA_SIZE (N * 20)
__global__ void kernel(int *a, int *b, int *c)
{
int idx = threadIdx.x + blockIdx.x * blockDim.x;
if (idx < N) {
int idx1 = (idx + 1) % 256;
int idx2 = (idx + 2) % 256;
float as = (a[idx] + a[idx... |
5,168 | #include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#define THREADS_PER_BLOCK 512
__global__ void dot(int *a, int *b, int *c) {
__shared__ int temp[THREADS_PER_BLOCK];
int index = threadIdx.x+blockIdx.x*blockDim.x;
temp [threadIdx.x]=a[index]*b[index];
__syncthreads();
if(0==threadIdx.x){
int sum = ... |
5,169 | /*
Integrantes: Juan Retamales
*/
//#include <pmmintrin.h>
/*C library to perform Input/Output operations*/
#include <stdio.h>
/*C library Añade funciones para convertir texto a otro formato*/
#include <stdlib.h>
#include <ctype.h>
#include <fcntl.h>
/*Libreria C para trabajar y comparar texto (de la linea de coma... |
5,170 | #include "includes.h"
__global__ void tridiag_x_matrix_k(float p_d, float p_m, float p_u, float* u, int n)
{
// Identifies the thread working within a group
int tidx = threadIdx.x % n;
// Identifies the data concerned by the computations
int Qt = (threadIdx.x - tidx) / n;
extern __shared__ float sAds[];
float* su = (f... |
5,171 | extern "C"
__global__ void setRangePoolKernel(
int nBatch,int rbs,int nDegree,int nD,int rScale,
float *R, // array of range
// arrays pointer
float *RA,
float *BA,
float *EA,
// pointer of array of pointer to pointer of array in arrays, nevermind i just stun you.
// p(i) = data(i + size(data))
float... |
5,172 | //Includes for IntelliSense
#define _SIZE_T_DEFINED
#include <cuda.h>
#include <curand_kernel.h>
#include <device_launch_parameters.h>
#include "float.h"
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#define PI acos(-1.0)
extern "C"{
// Write coefficients back into the matrix, ready for fitness evalua... |
5,173 | #include "includes.h"
__global__ void addToKPlus(int msize, double* a, double* b, double* c, double* d)
{
int tid = threadIdx.x; // + blockIdx.x * blockDim.x;
if (tid < msize) {
d[tid] = a[tid] + b[tid] + c[tid];
// tid += blockDim.x*gridDim.x;`
}
} |
5,174 | #define LN2_INV 1.4426950408889634
#define TWO_PI 6.283185307179586
#define PI 3.141592653589793
#define E 2.718281828459045
__forceinline__ double __device__ exponent(double x)
{
return exp(x);
}
__forceinline__ float __device__ exponent(float x)
{
return expf(x);
}
__forceinline__ double __device__ cosine... |
5,175 | __device__ int count = 0;
__global__ static void sum(int* data_gpu, int* block_gpu, int *sum_gpu, int length)
{
extern __shared__ int blocksum[];
__shared__ int islast;
int offset;
const int tid = threadIdx.x;
const int bid = blockIdx.x;
const int tnum = blockDim.x;
const int bnum = gridDim.x;
blo... |
5,176 | #include<stdio.h>
#include<cuda.h>
#include<time.h>
__global__
void vecAddKernel(float* A, float* B, float* C, int n)
{
int i = (threadIdx.x + blockDim.x * blockIdx.x)*2;
if(i<n) C[i] = A[i] + B[i];
}
void vecAdd(float* A, float* B, float* C, int n)
{
int size = n * sizeof(float);
float *d_A, *d_B, *d_C ;
//Allocatin... |
5,177 | /*
Parallel Processing Architecture and Algorithms, Spring-2015.
Project: Image Convolution with Cuda.
Muhammad Shahid Noman Siddiqui.
Sp-2014/M.Sc.CE/007
Note: The following heterogeneous code has been developed on Intel core i7, 2.8GHz processor with
Nvidia NVS3100m notebook business graphic card with 16... |
5,178 | #include "includes.h"
__global__ void weighted_delta_kernel(int n, float *a, float *b, float *s, float *da, float *db, float *ds, float *dc)
{
int i = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;
if(i < n){
if(da) da[i] += dc[i] * s[i];
db[i] += dc[i] * (1-s[i]);
ds[i] += dc[i] * a[i] + dc[i] * -b[i]... |
5,179 | //CUDE_Minimum_Fineding.cu
//Ben Talotta
#include "stdio.h"
#include "stdlib.h"
//based on cuda summing_Arrrays example
#define N 8000000
#define ThreadCount 8
__global__ void findMin(int* a, int* c )
{
int numToSort = N / 8;
int low = numToSort * threadIdx.x;
int high = low + numToSort - 1;
int minVal... |
5,180 | #include <cstdio>
#define N 32
__global__ void k(volatile int* in)
{
__shared__ int volatile smem[N];
__shared__ int volatile tmem[N];
int idx = threadIdx.x + blockDim.x*blockIdx.x;
smem[idx] = in[idx];
tmem[idx] = smem[N-idx-1];
in[idx] = tmem[idx];
}
int main()
{
int* in = (int*) malloc(N*sizeof... |
5,181 | #include <stdio.h>
#include <iostream>
#include <cuda_runtime.h>
// kernels are C++ functions defined with CUDA
// They will be called with << >>()
// cudaGetDeviceCount (int* count)
// Returns the number of compute-capable devices
// cudaGetDeviceProperties (cudaDeviceProp* prop, int device)
// Returns informati... |
5,182 | #include <cuda_runtime.h>
#include <stdio.h>
#include <math.h>
int getSPcores(cudaDeviceProp devProp)
{
int cores = 0;
int mp = devProp.multiProcessorCount;
switch (devProp.major){
case 2: // Fermi
if (devProp.minor == 1) cores = mp * 48;
else cores = mp * 32;
br... |
5,183 |
__global__ void thresholding_filter_kernel(unsigned int *input, unsigned int *output, unsigned int thresh){
const int blockid = blockIdx.x + blockIdx.y *gridDim.x + gridDim.x * gridDim.y *blockIdx.z;
const int out_idx = blockid * (blockDim.x * blockDim.y) + (threadIdx.y * blockDim.x) + threadIdx.x;
// const ... |
5,184 | /*
* HostDeviceVector.cpp
*
* Created on: 11 янв. 2016 г.
* Author: aleksandr
*/
#include "HostDeviceVector.h"
#include <thrust/fill.h>
#include <thrust/copy.h>
#include <iostream>
HostDeviceVector::HostDeviceVector() {}
HostDeviceVector::~HostDeviceVector() {}
HostDeviceVector::HostDeviceVector(std::si... |
5,185 | #include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/reduce.h>
#include <thrust/functional.h>
#include <iostream>
int main(int argc, char *argv[]) {
long n = atol(argv[1]);
cudaEvent_t start;
cudaEvent_t stop;
cudaEventCreate(&start);
cudaEventCreate(&stop);
thrust::host_ve... |
5,186 | // Program corresponding to CythonBM.cu that can be run directly from the command line. For testing purposes.
// Attempt to use 2D array. Doesn't work.
//#include <cmath>
#include <curand_kernel.h>
#include <stdio.h>
#include <cuda.h>
// Error handling code used in Nvidia example found here: https://docs.nvidia.com/c... |
5,187 | #include "includes.h"
__global__ void rearrangePopulationWithRange(float *gene, float *fit, int *range)
{
const int idx = threadIdx.x + blockDim.x*blockIdx.x;
if(range[0]>range[1]) return;
int totalElements = range[1] - range[0] + 1;
int nHalf = totalElements / 2;
if(idx> nHalf) return;
int i = range[0] + idx;
int j ... |
5,188 | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <cuda.h>
__global__ void staticReverse(int *d, int n)
{
__shared__ int staticMem[12288];
int idx = threadIdx.x;
if (n <= blockDim.x & idx < n) {
staticMem[n - 1 - idx] = d[idx];
} else {
int k = idx * 12;
if (k ... |
5,189 | #include<stdio.h>
#include<cuda.h>
__global__ void convertToCaps(char *str,int length){
int index = threadIdx.x+blockIdx.x*blockDim.x;
if(index<length){
if(str[index]>=97&&str[index]<=122)
str[index]-=32;
}
}
__global__ void findMaxOccurence(char *str,int *count,int length){
int inde... |
5,190 | // Name: H.G. Manesha Washani
// Student Id: 1432289
#include <stdio.h>
#include <stdlib.h>
#define N 20
__global__ void MatAdd(int A[][N], int B[][N], int C[][N]){
int g = blockIdx.x;
int h = blockIdx.y;
C[g][h] = A[g][h] + B[g][h];
}
//int** randmatfunc();
void randmatfunc(int ... |
5,191 | #include "includes.h"
__global__ void computeMoment(int *readArr, int *writeArr, double *weightArr, int n){
// The dimensions are hardcoded here to simplify extra syntax
// cuda uses for dynamic shared memory allocation
__shared__ int readArr_shared[32][32];
__shared__ double weightArr_shared[5][5];
int row = blockIdx... |
5,192 | template<typename T>
__device__ void vectorMulVector(const T* A, const T* B, T* result, const int length) {
T resultValue = 0;
for (int i = 0; i < length; i++) {
resultValue += A[i] * B[i];
}
result[0] = resultValue;
}
template<typename T>
__device__ void matrixMulVector(const T* matrix, const T* vector, T... |
5,193 | #include "includes.h"
__global__ void ker_gkylCartFieldAccumulateOffset(unsigned sInp, unsigned sOut, unsigned nCells, unsigned compStart, unsigned nCompInp, unsigned nCompOut, double fact, const double *inp, double *out) {
if (nCompInp < nCompOut) {
for (unsigned i=blockIdx.x*blockDim.x + threadIdx.x; i<nCells; i += b... |
5,194 | //
// kernel routine
//
__global__ void my_first_kernel(float *x)
{
// Uncomment line below and define integer "tid" as global index to vector "x"
// int tid =
// Uncomment line below and define x[tid] to be equal to the thread index
// x[tid] =
}
|
5,195 | #include <stdio.h>
#include "cuda.h"
#define max(x,y) ((x) > (y)? (x) : (y))
#define min(x,y) ((x) < (y)? (x) : (y))
#define ceil(a,b) ((a) % (b) == 0 ? (a) / (b) : ((a) / (b)) + 1)
void check_error (const char* message) {
cudaError_t error = cudaGetLastError ();
if (error != cudaSuccess) {
printf ("CUDA error :... |
5,196 | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#define N 65536
#define THREADS_PER_BLOCK 128
void checkCUDAError(const char *);
void random_ints(int *a);
__device__ int d_a[N], d_b[N], d_c[N];
__global__ void vectorAdd(int max) {
int i = b... |
5,197 | #include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <sys/time.h>
using namespace std;
__device__ double norm_calc_device;
__global__ void JacobiKernel(double *u, double *u_new, int N, double h_sq) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if( (... |
5,198 | #include "includes.h"
__global__ void gpu_Comput (int *h, int N, int T) {
// Array loaded with global thread ID that acesses that location
int col = threadIdx.x + blockDim.x * blockIdx.x;
int row = threadIdx.y + blockDim.y * blockIdx.y;
int threadID = col + row * N;
int index = row + col * N; // sequentially down e... |
5,199 | #include <cuda.h>
#include <stdio.h>
#define TILE_WIDTH 2
__global__ void matMulKernel(float* d_N, float* d_M, float* d_P, int Width){
__shared__ float Mds[TILE_WIDTH][TILE_WIDTH];
__shared__ float Nds[TILE_WIDTH][TILE_WIDTH];
int bx = blockIdx.x; int by = blockIdx.y;
int tx = threadIdx.x; int ty = threadIdx.y;... |
5,200 | // Transpose checkRows matrix with rows == parity checks, to
// bitRows matrix with rows == bits
__global__ void
transposeRC (unsigned int* map, float *checkRows, float *bitRows,
unsigned int numChecks, unsigned int maxBitsForCheck) {
// index
unsigned int m,n;
unsigned int thisRowStart,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.