serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
16,001 | #include "includes.h"
__global__ void add(int n, float *x, float *y) {
// Calculate the starting value for the for loop's index
int index = ( blockDim.x * blockIdx.x ) + threadIdx.x;
// Calculate the stride between elements of the arrays
int stride = blockDim.x * gridDim.x;
// Add the elements from array x and arra... |
16,002 | #include <stdio.h>
#define N 64
inline cudaError_t checkCudaErr(cudaError_t err, const char* msg) {
if (err != cudaSuccess) {
fprintf(stderr, "CUDA Runtime error at %s: %s\n", msg, cudaGetErrorString(err));
}
return err;
}
//__global__ void matrixMulGPU( int * a, int * b, int * c )
//{
// /*
// * Buil... |
16,003 | #include <stdio.h>
#include <cuda.h>
__global__ void cuda_hello(){
int myId = blockIdx.x*blockDim.x + threadIdx.x; // thread indexing
printf("Hello World! My thread is %d\n", myId);
}
int main() {
cuda_hello<<<1,256>>>();
cudaError_t cudaerr = cudaDeviceSynchronize();
if (cudaerr != cudaSuccess)
p... |
16,004 | #include <stdio.h>
__global__ void print1D(int* input, dim3 size) {
int axis_x = blockIdx.x * blockDim.x + threadIdx.x;
// printf("%d, %d\n", axis_x, size.x);
int gid = axis_x;
// input[gid] = gid;
if (axis_x < size.x) {
printf(
"size(%d), blockDim(%d), blockIdx(%d), threadIdx(%d), input(%d), ... |
16,005 | #include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <math.h>
#include <algorithm>
#include <utility>
#include <cfloat>
#include <cmath>
#include <cstdlib>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <thrust/pair.h>
#include <thrust/host_... |
16,006 | #include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <numeric>
#include <iostream>
// Here you can set the device ID that was assigned to you
#define MYDEVICE 0
double random_double(void)
{
return 1.0;
// return static_cast<double>(rand()) / RAND_MAX;
// summing random doubles give numerical ... |
16,007 | #pragma region License
/*
The MIT License
Copyright (c) 2009 Sky Morey
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, m... |
16,008 | #include "kernels.cuh"
__global__
void find_maxnum_kernel(float* d_array, float* d_max, int* d_mutex, unsigned int N){
unsigned int index = threadIdx.x + blockIdx.x * blockDim.x;
unsigned int stride = gridDim.x*blockDim.x;
unsigned int offset = 0;
//share memory
__shared__ float cache[512];
... |
16,009 | //采用分块乘法,使用shared memory
#include<stdio.h>
#include<math.h>
#include<time.h>
#include <stdlib.h>
#define TILE_WIDTH 16
__global__ void multi(int m, int n, int k, double *A, double *B, double *C)
{
__shared__ double S_a[TILE_WIDTH][TILE_WIDTH];
__shared__ double S_b[TILE_WIDTH][TILE_WIDTH];
int ... |
16,010 | #include "includes.h"
__global__ void kCopy(float* srcStart, float* destStart, const int copyWidth, const int srcJumpWidth, const int destJumpWidth, const int numElements) {
const int idx = blockIdx.x * blockDim.x + threadIdx.x;
for (int i = idx; i < numElements; i += blockDim.x * gridDim.x) {
destStart[(i / copyWidth)... |
16,011 | #include<stdio.h>
int main() {
cudaError_t error_code = cudaDeviceReset();
printf("returned error code:%d \n", error_code); // a cudaError_t variable can be regarded as a integer
printf("cudaSuccess:%d, error_code==cudaSuccess:%d \n", cudaSuccess, cudaSuccess==error_code);
if(error_code==cudaSuccess)
... |
16,012 | __global__ void addSubArray1 (int *A, int *B, int w, int h) {
for (int i = 0; i < w; i++) {
int j = blockIdx.x * blockDim.x + threadIdx.x;
B[2 * j * w + i] += A[i];
B[(2 * j + 1) * w + i] -= A[i];
}
} |
16,013 | #include<stdio.h>
#include<math.h>
#define N 10000
#define Block 100
#define thread 100
__global__ void inclusive_scan(int *d_in)
{
__shared__ int temp_in[N];
int i = threadIdx.x;
int tid = blockIdx.x * blockDim.x + threadIdx.x;
temp_in[tid] = d_in[tid];
__syncthreads();
for(unsigned int s = 1; s <= N-1; s... |
16,014 | /*
CSC691 GPU programming
Project 1: All Hail the New Caesar!
Jiajie Xiao
Sep 14, 2017
*/
#include <stdio.h>
#define CHUNK 1024
__global__ void minus (char *cipherTxt, char *plainTxt)
{
int idx = threadIdx.x;
plainTxt[idx] = cipherTxt[idx]-1; // caesar cipher
}
void decode (char *cipherTxt, char *p... |
16,015 | #include "includes.h"
__global__ void _emul64(int n, double *x, double *y) {
int i = threadIdx.x + blockIdx.x * blockDim.x;
while (i < n) {
y[i] *= x[i];
i += blockDim.x * gridDim.x;
}
} |
16,016 | #include <stdio.h>
// the following is called a "kernel"
//void vectorAdd(const float *a, const float *b, float *c, int numElements)
__global__ void vectorAdd(const float *a, const float *b, float *c, int numElements)
{
// blockDim/ threadIdx is built-in vars, 3-dimensional (get .y, .z?)
// blockDim: number of threa... |
16,017 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <math.h>
#include <unistd.h>
#include <cuda.h>
#include <cuda_runtime_api.h>
//#include "cutil.h"
using namespace std;
int checkDeviceSpecs(int number_of_galaxies, int grid_size);
//KERNEL
__global__ void integrandKernel(doubl... |
16,018 | __global__ void bedSlopeSourceSolver(float *BedSlopeSource, float *U, float *BottomIntPts, int m, int n, float dx, float dy)
{
// Calculate the row and column of the thread within the thread block
int row = blockIdx.y * blockDim.y + threadIdx.y;
int col = blockIdx.x * blockDim.x + threadIdx.x;
// First check if t... |
16,019 | #include <stdio.h>
#include "cuda.h"
extern "C" {
void saturation_adjustment_cuda(int ntot,
double *t, double *qc, double *qv,
double cs1, double cs2, double cs3, double cs4, double t0);
}
//--------------------------------------
// saturatio... |
16,020 | #include "includes.h"
extern "C" {
#ifndef NUMBER
#define NUMBER float
#endif
}
__global__ void vector_swap (const int n, NUMBER* x, const int offset_x, const int stride_x, NUMBER* y, const int offset_y, const int stride_y) {
const int gid = blockIdx.x * blockDim.x + threadIdx.x;
if (gid < n) {
const int ix = of... |
16,021 | #include "includes.h"
__global__ void bp_output_fc(float *d_output, float *d_preact, float *weight, const int size, const int in_channel, const int out_channel)
{
const int pos = blockIdx.x * blockDim.x + threadIdx.x;
const int totalPos = blockDim.x * gridDim.x;
const int N = out_channel * in_channel * size * size;
co... |
16,022 | /**********************************************************************
* DESCRIPTION:
* Parallel by CUDA Wave Equation - C Version
* This program implements the concurrent wave equation
*********************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <math.... |
16,023 |
// update the particle positions
__global__ void move_part(int np, float dt, float Lx, float *x, float *u) {
int tid = threadIdx.x + blockIdx.x * blockDim.x;
while (tid < np) {
x[tid] = x[tid] + u[tid]*float(dt);
if (x[tid] < float(0.0)) {
x[tid] = x[tid] + float(Lx);
}
... |
16,024 |
/* 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... |
16,025 | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
//cuda include
#include <cuda.h>
#include <curand.h>
#include <curand_kernel.h>
/*
#define BLOCKNUM 100
#define THREADNUM 150
*/
__global__ void GSrand(curandState *state, unsigned int seed){
int index = blockIdx.x * blockDim.x * threadIdx.x;
curand_init(se... |
16,026 | #include <iostream>
#include <vector>
__global__ void fill( int * v, std::size_t size )
{
auto tid = threadIdx.x;
v[ tid ] = tid;
}
int main()
{
std::vector< int > v( 100 );
int * v_d = nullptr;
cudaMalloc( &v_d, v.size() * sizeof( int ) );
fill<<< 1, 100 >>>( v_d, v.size() );
cudaMemcpy( v.data()... |
16,027 | #include <iostream>
#include <chrono>
#include <cuda_profiler_api.h>
__global__ void parallel_for(const int n, double* da) {
int tid = threadIdx.x + blockIdx.x*blockDim.x;
if (tid < n) {
double dummy = 123.456;
da[tid] = dummy + 123.456*dummy;
}
}
int main()
{
const int N = 10000000;
i... |
16,028 | #include "stdio.h"
__global__ void cuda_hello(){
printf("Hello World from GPU!\n");
}
int main() {
printf("Prima di cuda");
cuda_hello<<<1,1>>>();
printf("Dopo di cuda");
return 0;
}
|
16,029 | #include "includes.h"
/******************************************************************************
* Mathias Bourgoin, Université Pierre et Marie Curie (2011)
*
* Mathias.Bourgoin@gmail.com
*
* This software is a computer program whose purpose is to allow
* GPU programming with the OCaml language.
*
* This software ... |
16,030 | /******************************************************************************
*cr
*cr (C) Copyright 2010 The Board of Trustees of the
*cr University of Illinois
*cr All Rights Reserved
*cr
*****************************************************************... |
16,031 | #include <stdint.h>
#define BDIM 32
#define ITERTOT 1024
extern "C" __global__ void
__launch_bounds__(32, 1)
arr_kernel(int *inptr, int *outptr) {
int x = threadIdx.x;
int a = inptr[x];
uint32_t start = 0;
uint32_t stop = 0;
int b;
asm volatile ("mov.u32 %0, %%clock;" : "=r"(start) :: "memory"... |
16,032 | #include<stdio.h>
#include<time.h>
#include<cuda.h>
#include<stdlib.h>
__global__ void max_value(int *a, int *b) // kernel subroutine called from the host cpu to the gpu device
{
int i = threadIdx.x; // getting the thread id
*b = a[0]; // equating the value of the address in c to a predefined value in a matrix.
... |
16,033 | #include "includes.h"
// ERROR CHECKING MACROS //////////////////////////////////////////////////////
__global__ void mmKernel(float* popsIn, float* popsOut, float* mmm, int patches) {
int ii = threadIdx.x;
if (ii < patches) {
extern __shared__ float s[];
s[ii] = 0.0;
for (int jj = 0; jj < patches; jj++) {
s[ii] +... |
16,034 | // From CUDA for Engineers
// Listing 4.3
#include <cuda_runtime.h>
#include <iostream>
#define W 500
#define H 500
#define TX 32 // thread per block along x
#define TY 32 // thread per block along y
__global__
void distanceKernel(float *d_out, int w, int h, float2 pos)
{
const int c = blockIdx.x ... |
16,035 | struct Vec3
{
float x;
float y;
float z;
};
__device__
Vec3 vec3Add(Vec3 a, Vec3 b)
{
Vec3 added = {a.x + b.x, a.y + b.y, a.z + b.z};
return added;
}
__device__
Vec3 vec3Sub(Vec3 a, Vec3 b)
{
Vec3 added = {a.x - b.x, a.y - b.y, a.z - b.z};
return added;
}
__device__
Vec3 vec3Scale(Vec3 a, float f)
{
Vec3 sca... |
16,036 | #include "includes.h"
extern "C"
extern "C"
__global__ void dropoutTest( const float* arguments, float* results, const float dropoutFraction, const long size ) {
const int X = gridDim.x;
const int index = gridDim.y * X * threadIdx.x + X * blockIdx.y + blockIdx.x;
if(index < size) {
results[index] = arguments[index] *... |
16,037 | #include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
#include<time.h>
#include<cuda.h>
__global__
void PictureKernell(float* d_Pin, float* d_Pout, int n, int m){
int Row = blockIdx.y * blockDim.y + threadIdx.y;
int Col = blockIdx.x * blockDim.x + threadIdx.x;
if ((Row < m) && (Col < n)){
d_Pout... |
16,038 | #include <stdio.h>
#include <stdlib.h>
__global__ void foo(int *ptr) { *ptr = 7; }
int main(void) {
foo<<<1, 1>>>(0);
return 0;
}
|
16,039 | // GPU monte Carlo Simulation to calculate the value of pi
#include <unistd.h>
#include <stdio.h>
#include <curand.h>
#include <curand_kernel.h>
#define N 100
#define NUMTHREADS 32
#define NUMBLOCKS 32
#define NUMDARTS (N * NUMTHREADS * NUMBLOCKS)
__global__ void getHits (int *c) {
__shared__ int cache[NUMTHR... |
16,040 | #include <stdio.h>
#include <cuda.h>
#include<sys/time.h>
__global__ void dkernel(unsigned *vector, unsigned vectorsize) {
unsigned id = blockIdx.x * blockDim.x + threadIdx.x;
if(id<vectorsize)
vector[id]++;
}
#define BLOCKSIZE 1024
int main(int nn, char *str[]) {
unsigned long long N=1024;... |
16,041 | /*
Poisson solver with CG, SOR
Compile with : g++ -fopenmp main.cpp
*/
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <time.h>
#include <ctime>
#include <iostream>
#include <fstream>
#include <cuda.h>
#include <cuda_runtime.h>
#include "const.cu"
#include "operator.cu"
#include "init.cu"
#include "Wri... |
16,042 | #include<iostream>
#define tile_width 16
using namespace std;
__global__ void Mat_Mul_Shared(float *d_A, float *d_B, float *d_C, int width) {
int i = blockIdx.y * blockDim.y + threadIdx.y;
int j = blockIdx.x * blockDim.x + threadIdx.x;
__shared__ float M[tile_width][tile_width];
__shared__ float N[tile_... |
16,043 | #include <stdio.h>
#include <stdlib.h>
__global__ void gpuVecAdd(float *A, float *B, float *C) {
// TODO: write kernel code here
int tid = blockIdx.x * blockDim.x + threadIdx.x;
C[tid] = A[tid] + B[tid];
}
void init(float *V, int N) {
for (int i = 0; i < N; i++) {
V[i] = rand() % 100;
}
}
... |
16,044 | // Output of "python3 circuit2.py sum.crc" is pasted in as the kernel
// along with some boilerplate code to test this out.
// Expected output: "28 1 5 3 22 5 13 7\n".
#include <iostream>
__global__ void sum(int *x0, int *x1){
int tid = threadIdx.x;
x1[tid] = x0[tid];
switch(tid){
case 0:
... |
16,045 |
#include<iostream>
#include<math.h>
#define n 8
using namespace std;
__global__ void minimum(int *input) {
int tid = threadIdx.x;
int step_size = 1;
int number_of_threads = blockDim.x;
printf("No of threads = %d", number_of_threads);
while(number_of_threads>0) {
if(tid < number... |
16,046 | #include <cuda.h>
#include <cuda_runtime.h>
#include <stdio.h>
int main(int argc, char **argv){
cudaDeviceProp dP;
//CUdevice dev;
//CUcontext ctx;
if(cudaSuccess != cudaGetDeviceProperties(&dP, 0)) return 0;
/*if(CUDA_SUCCESS != cuDeviceGet(&dev,0)) return 0;
// create context for program run:
if(CUDA_SUCCESS... |
16,047 | #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 :... |
16,048 | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define f_size sizeof(float)
#define i_size sizeof(int)
//Opens a matrix store and represents it using Compressed Sparse Row format
void matrix_read(int **row_pointer, int **column_index, float **values, const char *storename, int *nrows, int *ncols, int *nva... |
16,049 | /*******************************
* Autor: Alejandro Delgado Martel
* Nombre: Proyecto Final Versión 1
*******************************/
#include <stdio.h>
#include <stdlib.h>
#include <cuda_runtime.h>
#include <time.h>
#include <math.h>
#define HISTO_ELEMENTS 1000
__global__ void inicializa_histograma(float* A, ... |
16,050 | /**
* Copyright 1993-2012 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 relate... |
16,051 | extern "C" {
__global__ void dynamicReverse(int* d, int* sizebuffer){
const int n = sizebuffer[0];
extern __shared__ int s[];
int t = threadIdx.x;
int tr = n-t-1;
s[t] = d[t];
__syncthreads();
d[t] = s[tr];
}
}
|
16,052 | // 10,000 threads incrementing 10 array elements
// We need to avoid the conflicts
#include <stdio.h>
//#include "gputimer.h"
#define NUM_THREADS 1000
#define ARRAY_SIZE 10
#define BLOCK_WIDTH 100
void print_array(int* array, int size)
{
for(int i(0); i < size ; ++i)
{
printf("%d \t", array[i]);
... |
16,053 | #include <stdio.h>
#include <cuda.h>
#include <time.h>
int main(void) {
int *a_h;
int *b_h;
int *c_h;
int N = 50000000;
size_t size = N * sizeof(int);
cudaEvent_t start,stop,start1,stop1;
float time,time1;
cudaEventCreate(&start);
cudaEventCreate(&stop);
cudaEventCreate(&start1);
cudaEventCreate(&stop1);
cudaEve... |
16,054 | #include "includes.h"
/*
** Projeto de Algoritmos Paralelos
** Multiplicação de Matrizes
*/
#define TAM_BLOCO 16
// Função para rodar na CPU
// Computa R = M * N
// aM é a altura de M
// lM é a largura de M
// lN é a largura de N
__global__ void cuda_multiplicarmatriz(float* M, float* N, float* R, int tamM, i... |
16,055 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <cuda.h>
#include <cuda_runtime.h>
#define N 10000000
#define MAX_ERR 1e-6
__global__ void vector_add(float *out, float *a, float *b, int n) {
int tid = blockIdx.x * blockDim.x + threadIdx.x;
// Handling arbitrary vecto... |
16,056 | #include <iostream>
#include <math.h>
// Tells the CUDA C++ compiler that this is a function (kernel) that runs on the GPU and can be called from CPU code
// These __global__ functions are known as kernels, and code that runs on the GPU is often called device code, while code that runs on the CPU is host code.
__glob... |
16,057 | /***************************************************
* Module that multiply all the elements of a matrix by a number
* Author: Alonso Vidales <alonso.vidales@tras2.es>
*
* To be compiled with nvcc -ptx matrix_set_bias_to_zero.cu
* Debug: nvcc -arch=sm_20 -ptx matrix_set_bias_to_zero.cu
*
************************... |
16,058 | #include "includes.h"
__global__ void cudaSEuclideanSumBackward_kernel(unsigned int size, float* diffInput, float* input, float* output, const float scale, const float beta, float* result)
{
const unsigned int index = blockIdx.x * blockDim.x + threadIdx.x;
const unsigned int stride = blockDim.x * gridDim.x;
if (beta !... |
16,059 | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <cuda_runtime.h>
#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,"GPUassert: %s ... |
16,060 | #include <iostream>
int main() {
int thread, block_x, block_y, block_z, grid_x, grid_y, grid_z, processor;
thread = 0;
block_x = 0;
block_y = 0;
block_z = 0;
grid_x = 0;
grid_y = 0;
grid_z = 0;
processor = 0;
cudaSetDevice(0);
cudaDeviceGetAttribute (&thread, cudaDevAttrMa... |
16,061 | #include <stdio.h>
int main()
{
int i[4] = {1,2,3,4};
int j[6] = {2,3,1,0,4,2};
// int k[6] = {0,0,0,0,0,0};
int k[6];
// float i[12] = {1.04537429, 3.45278132, 3.47493422, 2.24801288, 4.88137731, 1.66288503, 4.81317032, 4.63570752, 1.36892613, 3.32203655, 3.31923711, 2.27048096};
// float j[15] = {1.59982314, 4.7... |
16,062 | #include <stdio.h>
#include <time.h>
#include <string.h>
#include <stdint.h>
//#include "../backend.h"
/* Device */
__inline__ __device__ int get_index(){
return blockIdx.x * blockDim.x + threadIdx.x;
}
__inline__ __device__ int4 get_neighborhood(int index, int width, int length){
int4 neighbors;
int col = in... |
16,063 | // REQUIRES: clang-driver
// REQUIRES: x86-registered-target
// REQUIRES: nvptx-registered-target
// RUN: %clang -### --target=i386-unknown-linux \
// RUN: --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda \
// RUN: --ptxas-path=/some/path/to/ptxas %s 2>&1 \
// RUN: | FileCheck %s
// CHECK-NOT: "ptxas"
// CHECK: "/som... |
16,064 | #include <cstddef>
#include <stdio.h>
namespace vecops {
template<class T>
__global__
void adder(T* ar1, T* ar2, T* result, const std::size_t ar_size) {
for (std::size_t index = 0; index < ar_size; index += 1) {
//printf("Adding numbers: %d, %d\n", ar1[index], ar2[index]);
result[index] = ar1[index] + ar2[... |
16,065 | #include<iostream>
#include<vector>
__device__ void derivative(float &x, float &y){y = 2*x;}
__global__ void EulerKernel(float *x, float *y, float *res, int N, int n_itr, float del_t, float del_x){
int index = threadIdx.x + blockIdx.x*blockDim.x;
float der_value;
for(int it = 0; it < n_itr; it++){
derivative(x... |
16,066 | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
#ifndef NDEBUG
#define CHECK_STATUS(status) \
if (status != cudaSuccess) \
fprintf(stderr, "File: %s\nLine:%d Function:%s>>>%s\n", __FILE__, __LINE__, __FUNCTION__,\... |
16,067 | #include "includes.h"
__global__ void SumNewCentroidCoordinatesKernel( float *input, int imgWidth, int imgHeight, float *centroidCoordinates, int *nearestCentroid, float *pointsWeight, int inputSize )
{
int threadId = blockDim.x*blockIdx.y*gridDim.x //rows preceeding current row in grid
+ blockDim.x*blockIdx.x //blo... |
16,068 | #include "includes.h"
__global__ void gpu_init(int *mapad, int max, int size)
{
/*Identificaciones necesarios*/
int IDX_Thread = threadIdx.x;
int IDY_Thread = threadIdx.y;
int IDX_block = blockIdx.x;
int IDY_block = blockIdx.y;
int shapeGrid_X = gridDim.x;
int threads_per_block = blockDim.x * blockDim.y;
int position =... |
16,069 | #include<stdio.h>
#include <sys/time.h>
#define numKernels 512
#define hashTableWidth 12288
#define searchKernels 1024
#define numHashPerThread 24
#define numThreadsPerBlock 1
__device__ void swapTriplets(int *d_x,int *d_y,int *d_z,int *d_indexOrder, int index1,int index2)
{
int temp1,temp2,temp3;
int temp4;
temp... |
16,070 | #include "includes.h"
__global__ void make_pillar_feature_kernel( float* dev_pillar_point_feature_in_coors, float* dev_pillar_point_feature, float* dev_pillar_coors, int* dev_x_coors, int* dev_y_coors, float* dev_num_points_per_pillar, const int max_points, const int num_point_feature, const int grid_x_size) {
int ith_... |
16,071 | /*
* CUDA C++ code to multiply two square matrices
*
* To compile and link this example, use
*
* nvcc matMul.cu -o matMul.x
*
* To run this code, use
*
* ./matMul.x
*/
#include <iostream>
#include <stdio.h>
// parameter describing the size of the matrices
const int rows = 16;
const int cols = 16;
/... |
16,072 | #include <iostream>
#include <fstream>
#include <vector>
#include <stdio.h>
using namespace std;
__global__ void bfs(int n, int m, int q_size, int level, int *dist, int *neib, int *off, int *q_size_new, int *q_prev, int *q_next) {
int tid = blockIdx.x * blockDim.x + threadIdx.x;
if (tid < q_size) {
int u = q_prev... |
16,073 | #include <stdio.h>
#include <stdlib.h>
#include <cuda_runtime.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#define INPUT_FILE "inp.txt"
#define Q1A_OUT_FILE "q1a.txt"
#define Q1B_OUT_FILE "q1b.txt"
typedef struct vector {
int *elements;
int capacity;
int size;
} vector;
// Method definitions
v... |
16,074 |
/* 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,int var_4,int 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 var_... |
16,075 | #include <algorithm>
#include <cuda.h>
#include <cuda_runtime.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/random.h>
#include <thrust/sort.h>
#include <time.h>
#define CUDA_CA... |
16,076 | /*
* ismin.cpp
* GSPAN
*
* Created by Jinseung KIM on 09. 07. 19.
* Copyright 2009 KyungHee. All rights reserved.
*
*/
#include "gspan.cuh"
using namespace std;
bool gSpan::is_min ()
{
if (DFS_CODE.size() == 1) //nếu như trong vector<DFS> chỉ có duy nhất 1 DFS thì nó là nhỏ nhất.
return (true);
DFS_C... |
16,077 | #include <stdio.h>
#include <sys/time.h>
const int N_def (1 << 10);
const int threadsPerBlock = 32;
//const int blocksPerGrid = (N_def+threadsPerBlock-1) / threadsPerBlock;
const int blocksPerGrid = 10;
#define MAX(a,b) (a) > (b) ? (a) : (b)
__global__ void cuda_max(int N, double *a, double *c)
{
// __shared__ ... |
16,078 | #include <cstdio>
#include "cuda.h"
__global__ void helloWorld()
{
printf("Hello from block %d/%d\n",
blockIdx.x, gridDim.x);
}
int main(int argc, char **argv)
{
helloWorld<<<6,1>>>();
cudaDeviceSynchronize();
return 0;
}
|
16,079 | /*#include <cv.h>
#include <highgui.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <stdio.h>
#include <math.h>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
VideoCapture cap(0);
if(!cap.isOpened())
{
printf("No hay camara web");
return -1;
}
//namedWindow("webcam");
Mat... |
16,080 | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cuda.h>
#include <cuda_runtime.h>
__global__ void process_kernel1(const float* input1, const float* input2, float* output, int numElements){
int blockNum = blockIdx.z*(gridDim.x*gridDim.y) + blockIdx.y*gridDim.x + blockIdx.x;
int threadNum = threadI... |
16,081 | #include <stdio.h>
__device__ int blockSum(int *b, int size) {
int sum=0, i;
for (i=0; i<size;++i) {
sum += b[i];
}
return sum;
}
// Compute the sum of each subblock and write the result to the first
// index in "a" where the subblock starts. For this code to
// work, Number of blocks * Number of threads ... |
16,082 | #include<iostream>
using namespace std;
#define mask_width 16
#define tile_width 16
__constant__ float M_dc[mask_width][mask_width]; // save mask in constant memory
__global__ void conv2d_kernel(float *N_d, float *P_d, int n) {
int i = blockIdx.y * blockDim.y + threadIdx.y; // link local thread idx to global ... |
16,083 | /*******************************************************************************
*
* probe a comuter for basic info about processing cores and GPU
*
* compile with:
*
* nvcc probe2.cu -L/usr/local/cuda/lib64 -I/usr/local/cuda-10.2/targets/x86_64-linux/include -lcuda -lcudart
*
* (in .tcshrc, please have:)
* s... |
16,084 | #include<iostream>
#include<chrono>
using namespace std;
using namespace std::chrono;
#define clock_now high_resolution_clock::now
__global__ void minimum(int *a,int *b,int n)
{
int block=256*blockIdx.x;
int mini=7888888;
for(int i=block;i<min(256+block,n);i++)
{
if(mini>a[i])
{
mini=a[i];
}
}
b[blo... |
16,085 | #include <iostream>
#include "../include/gpu_map.h"
#include <thrust/device_vector.h>
#define def_dvec(t) thrust::device_vector<t>
#define to_ptr(x) thrust::raw_pointer_cast(&x[0])
using namespace std;
const int MAP_SIZE = 100;
__global__ void test(float *output){
gpu_map<int, float, MAP_SIZE> map;
for(int i=... |
16,086 | #include <stdio.h>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <cuda_runtime_api.h>
#include <unistd.h>
/******************************************************************************
*
*
* To compile:
* nvcc -o linearRegressionByCuda linearRegressionByCuda.cu -lm
*
* To run:
* ./li... |
16,087 | #include "includes.h"
__global__ void windowHann(float* idata, int length)
{
int tidx = threadIdx.x + blockIdx.x*blockDim.x;
if (tidx < length)
{
idata[tidx] = 0.5*(1 + cos(2*tidx*PI_F / (length - 1)));
}
} |
16,088 | #include <iostream>
#include <stdio.h>
#include "cuda_runtime.h"
__global__ void cubic(const float * d_in, float * d_out)
{
int idx = threadIdx.x;
float f = d_in[idx];
d_out[idx] = f * f * f;
}
int main()
{
const int ARRAY_SIZE=10;
const int ARRAY_BYTES = ARRAY_SIZE * sizeof(float);
float h_... |
16,089 | #include "includes.h"
__global__ void MaskInput( float* image, float* mask, float* maskedValues, float* output, int count ) {
int id = blockDim.x*blockIdx.y*gridDim.x + blockDim.x*blockIdx.x + threadIdx.x;
if (id < count) {
output[id] = image[id] * mask[id] + maskedValues[id] * (1.0f - mask[id]);
}
} |
16,090 | #include <iostream>
#include <fstream>
using namespace std;
__global__ void addition( float* x, float* y, float* z, int num)
{
const unsigned int tid = threadIdx.x;
const unsigned int bid = blockIdx.x;
const unsigned int bdim = blockDim.x;
const unsigned int gdim = gridDim.x;
int step=bdim*gdim;
for (int ... |
16,091 | #include "includes.h"
__global__ void multMatrix(int *d1_in, int *d2_in, int *d_out, int n, int m, int k){
int indx = threadIdx.x;
int indy = threadIdx.y;
int ind = indy*k+indx;
//printf("%d %d\n",indy,indx);
if(ind<n*k){
d_out[ind] = 0;
for(int i=0;i<m;i++){
d_out[ind] += d1_in[indy*m+i]*d2_in[i*k+indx];
}
}
} |
16,092 | #include <stdlib.h>
#include <string.h>
#include <time.h>
#include <stdio.h>
__global__ void sumArray(float *A, float *B, float *C) {
int i = blockIdx.x;
C[i] = A[i] + B[i];
}
void initialData(float *ip, int size){
time_t t;
srand((unsigned int)time(&t));
for(int i = 0; i < size; i++){
ip[i] = (float)( rand(... |
16,093 | #include "includes.h"
__global__ void add(int* in, int* out, int n){
int gid = threadIdx.x + blockIdx.x * blockDim.x;
if(gid >= n) return ;
extern __shared__ int temp[];
temp[threadIdx.x] = in[gid];
for(int offset=1; offset<n; offset=(offset<<1)){
__syncthreads();
if(threadIdx.x >= offset){
temp[threadIdx.x] += tem... |
16,094 | #include<stdio.h>
#include<stdlib.h>
#define N 100
#define THREADS_PER_BLOCKS 10
//space for functions
__global__ void reverseArrayBlock(int *dev_a,int *dev_b){
int bx = blockIdx.x;
int tx = threadIdx.x;
int old_id = blockDim.x*bx + tx;
int new_id = (blockDim.x*gridDim.x) - 1 - old_id... |
16,095 | __global__ void primal(float* u, float* u_, const float* f, const float* p1,
const float* p2, const double tau, const int X, const int Y)
{
int x = blockIdx.x*blockDim.x + threadIdx.x;
int y = blockIdx.y*blockDim.y + threadIdx.y;
// center point
int c = y*X + x;
float div_x = 0.0f;
float div_y = 0.0f;
if ... |
16,096 | /*
Concurrent access on a counter with no lock. Atomicity Violation. Data Race in line 25. Intra Region Data Race.
*/
#include <stdio.h>
// Macro for checking errors in CUDA API calls
#define cudaErrorCheck(call) \
do{ ... |
16,097 | #include <cassert>
#include <cstdio>
const int BLOCK_SIZE = 16;
#define getX (conv ? blockI[i][threadIdx.x] : blockI[threadIdx.y][i])
#define getW (conv ? blockW[i][threadIdx.y] : blockW[i][threadIdx.x])
template <bool conv>
__global__ void inf_dist_forward_kernel(const float* __restrict__ input, const float* __res... |
16,098 | #include <iostream>
#include <cstdlib>
#include <time.h>
#define TILE_WIDTH 32
/* multiplies matrices represented by a (m x n) and b (n x k) and assigns the value of ab to ans (m x k) matrix
*/
__global__
void matmul(float* a, float* b, float* ans, const int m, const int n, const int k)
{
int i = threadIdx.x + b... |
16,099 | #include <stdio.h>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <cuda_runtime_api.h>
#include <errno.h>
#include <unistd.h>
//To compile: nvcc -o cudalinear cudalinear.cu -lm
//To run: ./cudalinear
typedef struct point_t {
double x;
double g;
} point_t;
int n_data = 1000;
__device__ int d_n... |
16,100 | __global__
void extrapolateVelocities(const float * d_levelset,
const float2 * d_surfacePoints,
const float * d_velIn_x,
const float * d_velIn_y,
float * d_velOut_x,
float * d_velOut_y)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.