serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
2,501 | /**
* @file utils.cu
* @author Daniel San Martin (dsanmartinreyes@gmail.com)
* @brief Extra CUDA functions
* @version 0.1
* @date 2020-09-01
*
* @copyright Copyright (c) 2020
*
*/
#include <stdlib.h>
#include "include/utils.cuh"
/**
* @brief Fill array
*
* @param v Pointer to fill, space discrete domai... |
2,502 | /*
* streams_kernel.cu
*
* Created on: 14/02/2018
* Author: fernando
*/
#include <pthread.h>
#include <stdio.h>
__global__ void sqrt_streams(float *x, int n) {
int tid = threadIdx.x + blockIdx.x * blockDim.x;
for (int i = tid; i < n; i += blockDim.x * gridDim.x) {
float sum = 0;
for (int j = 1; j < 10... |
2,503 | #include "includes.h"
__global__ void Counting(int* HalfData, int HalfDataSize, int N)
{
int i = blockIdx.x*blockDim.x + threadIdx.x;
if (i<HalfDataSize)
{
HalfData[i] *= N;
}
} |
2,504 | //
// Created by kindr on 2021/4/28.
//
#include "manualMemory.cuh"
#include "../../common/utils.cuh"
#include "zeroCopyMemory.cuh"
#include <cstdio>
void manualMemory(size_t nElement, size_t nThread) {
size_t nBytes = nElement * sizeof(float);
auto *vec = (float *) malloc(nBytes);
memset(vec, 0, nBytes... |
2,505 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <cmath>
#define D 1 //Please set it to d in texture_main.m manually
#define NG 32 //Please set it to Ng in texture_main.m manually
#define DEFAULT 0 //Please set it to defaul... |
2,506 | #include <stdio.h>
#include <cuda.h>
#include <unistd.h>
#include <signal.h>
#include <stdint.h>
#include <stdlib.h>
#include <pthread.h>
#include <sys/time.h>
#define NUM_THREADS 4
#define MEMPER 0.9
#define SIZE 1024ul
#define REQ_UNDEFINED '-'
#define REQ_IDLE ';'
#define REQ_START 'A'
#define RSP_F... |
2,507 | #include <iostream>
__device__ int compute_layer(float tx, float ty, float radius) {
int x = int(std::abs(tx) / radius + 0.5);
int y = int(std::abs(ty) / radius + 0.5);
if (x == 1 && y == 1)
return 2;
int c = 0;
if (x + y < 2)
c = x + y;
else
c = x + y + 1;
if (c > 5... |
2,508 | void setGrid(int n, dim3 &blockDim, dim3 &gridDim)
{
// set your block dimensions and grid dimensions here
gridDim.x = n / blockDim.x;
gridDim.y = n / blockDim.y;
if(n % blockDim.x != 0)
gridDim.x++;
if(n % blockDim.y != 0)
gridDim.y++;
}
|
2,509 | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#define N 100
#define IT 3
__global__ void JacobiIteration(int n, float *a, float *b, float *x, float*x_result){
for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < n; i += blockDim.x * gridDim.x){
float sigma = 0;
for(int j = 0 ; j<n;... |
2,510 | #include<ostream>
#include<vector>
#include<stdio.h>
#include<cuda_runtime.h>
// reset GPGPUs to be safe.
void reset_cuda_devs() {
int dev_count = 0;
cudaGetDeviceCount(&dev_count);
while( dev_count --> 0 )
{
printf("Resetting device %i", dev_count);
cudaSetDevice(dev_count);
... |
2,511 | /**
* gesummv.cu: This file is part of the PolyBench/GPU 1.0 test suite.
*
*
* Contact: Scott Grauer-Gray <sgrauerg@gmail.com>
* Louis-Noel Pouchet <pouchet@cse.ohio-state.edu>
* Web address: http://www.cse.ohio-state.edu/~pouchet/software/polybench/GPU
*/
#include <unistd.h>
#include <stdio.h>
#include <time.h... |
2,512 | /******************************************************************************
*cr
*cr (C) Copyright 2010 The Board of Trustees of the
*cr University of Illinois
*cr All Rights Reserved
*cr
*****************************************************************... |
2,513 | //=====================================================================
// MAIN FUNCTION
//=====================================================================
__device__ void kernel_cam(float timeinst, float* d_initvalu, float *d_finavalu, int valu_offset,
float* d_params, int params_offset, float* d_com, int com... |
2,514 | #include "includes.h"
#define FLOAT_N 3214212.01
__global__ void calcsymmat(double* d_data, double* d_symmat, int M, int N)
{
int i, j2;
int j1 = blockDim.x * blockIdx.x + threadIdx.x+1;
if (j1<=(M+1)) {
for (j2 = j1; j2 < (M+1); j2++) {
d_symmat[j1*(M+1) + j2] = 0.0;
for (i = 1; i < N+1; i++) {
d_symmat[j1*(M+1) + j... |
2,515 | #include <vector>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <math.h>
#include <cstring>
#include <cuda.h>
#define ITER_LIMIT 500
#define MATRIX_MAX 10
using namespace std;
void nmfgpu(float *a, int r, int c, int k, int niters, float *w, float *h);
void matrix_print(float *a, int r, int c);
... |
2,516 | //pass
//--gridDim=[4096,1,1] --blockDim=[256,1,1]
__global__ void vectorAddGPU(float *a, float *b, float *c, int N)
{
int idx = blockIdx.x*blockDim.x + threadIdx.x;
if (idx < N)
{
c[idx] = a[idx] + b[idx];
}
}
|
2,517 | #include "cuda_runtime.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <cstdio>
#include <chrono>
typedef std::chrono::high_resolution_clock Clock;
#define ITER 65535
// CPU version of the vector add function
void vector_add_cpu(int *a, int *b, int *c, int n) {
int i;
// Add the vecto... |
2,518 |
#include <stdio.h> //standard library
#include "/usr/include/linux/cuda.h" //cuda library
#include <stdlib.h>
#include <unistd.h>
__global__ void kernel(int* A)
{
A[0]++;
}
//~ __global__ void vecAdd(int* A, int* B)
//~ {
//~
//~
//~ }
//~ __global__ void passTheTorch(int* A)
//~ {
//~
//~ int i = t... |
2,519 | #include <stdio.h>
#include <cuda_runtime.h>
void printValue(float *ip, const int n);
__global__ void modifyGlobalVariable(const int n);
#define CHECK(call) { \
const cudaError_t error = call; \
if (error != cudaSu... |
2,520 | #include <stdio.h>
#include <cuda.h>
#define NBIN 1000000
#define NUM_BLOCK 13
#define NUM_THREAD 192
int tid;
float pi = 0;
__global__ void cal_pi( float *sum, int nbin, float step, int nthreads, int nblocks ) {
int i;
float x;
int idx = blockIdx.x * blockDim.x + threadIdx.x;
for( i = idx; i < nbin; i +=... |
2,521 | #include "includes.h"
#define H 64
// Default values
int N = 10000; //Size
int T = 32; //BlockSize
int B = 4; //Blocks
// Host Variables
int* HostData;
int* HostHist;
int* HostTimer=NULL;
// Device Variables
int* DeviceData;
int* DeviceHist;
int* DeviceTimer=NULL;
// Timer Variables
struct timeval CPU_Time_... |
2,522 | // ================================================================================================
// Tim Backus
// CIS 450 - High Performance Computing
// 3D Game of Life - CUDA Version
// ================================================================================================
#define GOL_IO_FILENAME "gol3DO... |
2,523 | #include "includes.h"
__global__ void addKernel(int * dev_a, int* dev_b ,int* dev_size)
{
int i = threadIdx.x;
int j,p;
for (j = 0; j < (*dev_size); j++)
{
p = *dev_size*i + j;
dev_b[i] += dev_a[p];
//printf("%d %d\n", i, p);
}
} |
2,524 | #include <iostream>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <time.h>
using namespace std;
__device__
int xgcd(int a, int b, int *x, int *y)
{
// Base Case
if (a == 0)
{
*x = 0, *y = 1;
return b;
}
int x1, y1; // To store results of recursive... |
2,525 | #include <iostream>
#include <math.h>
#include <unistd.h>
#include <memory>
#include <array>
#include <algorithm>
#include <vector>
const std::size_t NUMBER_STREAMS = 80;
const std::size_t N = 1 << 20;
struct test_struct
{
cudaStream_t stream;
std::unique_ptr<std::array<float, N>> h_a;
std::unique_ptr<... |
2,526 | #include<stdio.h>
#include<cuda.h>
/*__global__ void device_func(int *a)
{
int tid = blockDim.x * blockIdx.x + threadIdx.x;
a[tid]+=1;
//int tmp;
for(int i=0;i<6;i++)
{
if(i%2==0)
{
even(a)
/*tmp=a[threadIdx.x*2];
a[threadIdx.x]=a[threadIdx.x*2+1];
a[threadIdx.x*2+1]=tmp;
}
else{
odd(a)
/*tmp=a[threadIdx.x*... |
2,527 | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
// number of threads per block
//const int numThreadsPerBlock = 256;
const int numThreadsPerBlock = 1024;
//// device to use in case there is more than one
//static int selectedDevice = 0;
__global__ void kern_Dvxv(const int n, double* v1, double* v2, double* ... |
2,528 | #include <iostream>
#include <chrono>
const unsigned max_block_size = 1024;
__global__ void kernel_all_threads_malloc(void** ptr /*For side effect*/,
unsigned long long* total_malloc_clock,
unsigned long long* total_free_clock
) {
const auto tid = threadIdx.x;
void* p;
const auto t0 = clock64();
p = malloc... |
2,529 | #include <stdio.h>
#include <cuda_runtime.h>
__global__ void kernel() {
printf("%d, %d\n", threadIdx.x, blockIdx.x);
return;
}
int main() {
// main iteration
kernel <<<16, 4, 0>>>();
return 0;
} |
2,530 | #include <stdio.h>
#include <stdlib.h>
__global__ void exclusive_prefix_sum_gpu(int * oldSum, int * newSum, int distance, int numElements) {
int num_threads = blockDim.x * gridDim.x;
int tid = blockDim.x * blockIdx.x + threadIdx.x;
if(distance == 0){
for(int i = tid; i < numElements ; i+=... |
2,531 | #include "bitmap.cuh"
void BmpHeader::setDim(int32_t w, int32_t h) {
width = w;
height = h;
sizeOfBitmapFile = HEADER_SIZE + w * h * 3; // Each pixel takes 3 bytes
}
void BmpHeader::setRes(double mmPerPixel) {
horizontalResolution = (int32_t)(1000/mmPerPixel);
verticalResolution = (int32_t)(1000/m... |
2,532 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <iostream>
// ---------------------------------
// BEGIN OF USER AREA
// Debug level, possible values: 0 - 5, 5 is highest
// Highest level will cause EXTREMELY detailed output (the whole array will be printed)
__constant__ co... |
2,533 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <iostream>
using namespace std;
struct MyStruct
{
int a;
int b;
int c;
};
int main(void)
{
int *ptr;
char *ptr1;
int **ptr2;
int(*ptr3)[3];
int *(*ptr4)[4];
int temp = sizeof(*ptr);
printf("result is :%d\n",temp)... |
2,534 | /*
Faz a soma dos elementos de dois vetores
Exemplifica o uso de memoria mapeada com cudaHostAlloc() usando
o parametro cudaHostAllocMapped para alocar memoria
tanto no host quanto no device. Copias entre host e device sao
implicitas, igual aa memoria unificada.
cudaDeviceSynchronize() antes da impressao do resultad... |
2,535 | #include <cuda.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define THREADS_PER_BLOCK 512
//function declarations
unsigned int getmax(unsigned int *, unsigned int);
__global__ void getmaxcu(unsigned int *num, unsigned int size);
int main(int argc, char *argv[])
{
unsigned int size = 0; // The siz... |
2,536 | #include <iostream>
#include <vector>
#include <complex>
#include <cuComplex.h>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
// Функция освобождения памяти GPU (device_pointer_input — указатель на входное поле, device_pointer_output — на выходное поле (результат), device_pointer_x1 — на вектор x, d... |
2,537 | #include<stdio.h>
//#define NUM_BINS 64 // We are also going to use this for the number of threads in a block.
#define NUM_BINS 1024 // We are also going to use this for the number of threads in a block.
#define NUM_THREADS_PER_BLOCK 16
#define NUM_BLOCKS 16
//////////////////////////////////////////////////////////... |
2,538 | #include<iostream>
#include <cuda.h>
__global__ void matmul_kernel(const float* A, const float* B, float* C, size_t n)
{
size_t col = blockIdx.x * blockDim.x + threadIdx.x;
size_t row =0;
if (col < n*n) {
row = col / n;
col = col % n;
for (size_t i = 0; i < n; i++) {
C[row * n + col] += A[row * n +... |
2,539 | #include<bits/stdc++.h>
using namespace std;
#define MAX_VAL ((int)1e8)
#define cudaCatchError(error) { gpuAssert((error), __FILE__, __LINE__); }
// Catch Cuda errors
inline void gpuAssert(cudaError_t error, const char *file, int line, bool abort = false)
{
if (error != cudaSuccess)
{
printf("\n=====... |
2,540 | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
__device__ int d_change;
__global__ void bellman_ford(int *d_g, int *d_d, int k, int n)
{
d_change = 0;
int i = blockIdx.x*blockDim.x+threadIdx.x;
int cur_dis = d_d[i];
__syncthreads();
int j;
for (j=1; j<n;j++)
... |
2,541 | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <limits.h>
__global__ void assign(float * x)
{
int idx = (gridDim.y * blockIdx.x + blockIdx.y )*blockDim.x*blockDim.y*blockDim.z + blockDim.z*blockDim.y*threadIdx.x + blockDim.z*threadIdx.y + threadIdx.z;
x[idx] = idx;
print... |
2,542 | #include "includes.h"
extern "C"
{
}
__global__ void vadd(const int n, const double *a, const double *b, double *c)
{
int i = threadIdx.x + blockIdx.x * blockDim.x;
if (i<n)
{
c[i] = a[i] + b[i];
}
} |
2,543 | #include "includes.h"
/*
* file name: mm_omp_vs_cuda.cu
*
* mm_omp_vs_cuda.cu contains the code that realize some common used matrix operations in CUDA, and
* an implementation of matrix multiplication speedup via openmp, this is a practice to compare the
* of performance of cuda and openmp, as well as a trail of u... |
2,544 | #include "includes.h"
extern "C"
__global__ void multiply(int n, float *a, float *b, float *sum)
{
int ind = threadIdx.x + blockDim.x * blockIdx.x;
int i = ind ;
int j = ind % n;
if (j<n)
{
sum[i] = a[i] * b[j];
}
} |
2,545 | #include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <math.h>
#include "device_launch_parameters.h"
int main() {
int nDevices;
cudaGetDeviceCount(&nDevices);
for (int i = 0; i < nDevices; i++) {
cudaDeviceProp prop;
cudaGetDeviceProperties(&prop, i);
printf("Device numb... |
2,546 | #include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
// CUDA example: illustrates kernel-allocated shared memory; does
// nothing useful, just copying an array from host to device global,
// then to device shared, doubling it there, then copying back to device
// global then host
__global__ void doubleit(int *dv... |
2,547 | #include "includes.h"
__global__ void constructCircuitGraphVertex(unsigned int * C,unsigned int * offset,unsigned int ecount, unsigned int * cv, unsigned int cvCount){
unsigned int tid=(blockDim.x*blockDim.y * gridDim.x*blockIdx.y) + (blockDim.x*blockDim.y*blockIdx.x)+(blockDim.x*threadIdx.y)+threadIdx.x;
if(tid < ecou... |
2,548 | #include "CmplxUtils.cuh"
__device__ __host__ cuComplex cuComplex_exp(float exp)
{
float re = cos(exp);
float im = sin(exp);
return make_cuComplex(re, im);
} |
2,549 | #include <stdio.h>
__device__ const char *STR = "HELLO WORLD!";
const char STR_LENGTH = 12;
__global__ void hello()
{
printf("calling kernel\n");
printf("%c\n", STR[threadIdx.x % STR_LENGTH]);
printf("kernel called\n");
}
int main(void)
{
int num_threads = STR_LENGTH;
int num_blocks = 1;
printf("before hello... |
2,550 |
#include "test.cuh"
__global__
void hello_kernel(char *a, int *b)
{
a[threadIdx.x] += b[threadIdx.x];
}
void hello(char *ad, int *bd)
{
dim3 dimBlock( blocksize, 1 );
dim3 dimGrid( 1, 1 );
hello_kernel<<<dimGrid, dimBlock>>>(ad, bd);
}
|
2,551 | #include "includes.h"
__global__ void fill_AT_expansion(float* A, int* rowind, int* colind, float* val, int npix, int nimages) {
int i = blockIdx.x*blockDim.x + threadIdx.x;
if (i < npix*nimages) {
colind[i] = i / nimages + (i % nimages)*npix;
rowind[i] = i / nimages;
val[i] = A[colind[i]];
}
} |
2,552 | /*
Faz a soma dos elementos de dois vetores em uma stream e em outra stream faz a multiplicacao de um vetor
por um valor escalar
Exemplifica o uso de diferentes streams (1 e 2) para computacoes
distintas. Usa cudaMallocHost para alocar memoria nao paginavel
no host e faz copia assincrona com cudaMemcpyAsync. Usa tam... |
2,553 | #include<iostream>
#include<vector>
#include<random>
const int SHARED_MEM = 256;
__global__ void dotProduct(int *x, int *y, int *dot, int N){
int index = blockDim.x*blockIdx.x+threadIdx.x;
__shared__ int cache[SHARED_MEM];
int offset = 0;
int stride = blockDim.x;
while(index+offset<N){
c... |
2,554 | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#define ROW_NUM 10000100
#define COLUMN_NUM 4
#define CONSTRAINT_MAX 100000
__global__
void request(int *tab, int *result)
{
int index = blockIdx.x * blockDim.x + threadIdx.x;
int stride = blockDim.x * gridDim.x;
... |
2,555 | #include <cstdio>
#include <string>
#include <cassert>
#include <iostream>
#include <cstddef>
#include <vector>
#define uint8_t unsigned char
#define uint16_t unsigned short
#define uint32_t unsigned int
#define uint64_t unsigned long long
using namespace std;
//
// DEFAULt functions for work with cuda
//
#define ... |
2,556 | #include <stdio.h>
#include <chrono>
using namespace std::chrono;
#define N 2048 * 2048 // Number of elements in each vector
/*
* Optimize this already-accelerated codebase. Work iteratively
* and use profiler to check your progress
*
* Aim to profile `saxpy` (without modifying `N`) running under
* 25us.
*
* S... |
2,557 | // To compile - gcc -o 3dFDTD FDTD3D.c -lm
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sys/time.h>
#include <cuda_runtime.h>
int main() {
int imax = 100, jmax = 100, nmax = 1000, nhalf = 20, no = nhalf*3, kmax = 100;
int i, j, n,k;
double c = 2.99792458e8, pi = 3... |
2,558 | #include "includes.h"
__global__ void _reluback(int n, float *y, float *dy) {
int i = threadIdx.x + blockIdx.x * blockDim.x;
while (i < n) {
if (y[i] <= 0) dy[i] = 0;
i += blockDim.x * gridDim.x;
}
} |
2,559 | #include "includes.h"
#define TB 128
#define GS(x) (((x) - 1) / TB + 1)
__global__ void fix_border_(float *input, int pad_size, int side, int size3, int size23)
{
int id = blockIdx.x * blockDim.x + threadIdx.x;
if (id < size23) {
int x = id % size3;
int y = id / size3;
if (side == 0 && x < pad_size) {
input[id] = in... |
2,560 | /*********************************************************************
* Copyright © 2011-2014,
* Marwan Abdellah: <abdellah.marwan@gmail.com>
*
* This library (cufftShift) is free software; you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the F... |
2,561 | extern "C" __global__
void cu_suppress_non_max(float* mag, float* deltaX, float* deltaY, float* nms,
long parser_length, long offset)
{
const int SUPPRESSED = 0;
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx >= 0 && idx < parser_length * offset)
{
float alpha... |
2,562 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include "curand.h"
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
__device__ __host__ __inline__ float N(float x)
{
return 0.5 + 0.5 * erf(x * M_SQRT1_2);
}
__device__ __host__ void price(float k, float s, float ... |
2,563 | #include "cuda_kernel_func.cuh"
extern "C" void vecSub(float *a, float *b, float *res, int blockSize, int n) {
int gridSize = (n + blockSize - 1)/blockSize;
vecSub_kernel<<<gridSize, blockSize>>>(a, b, res, n);
}
extern "C" void vecAdd(float *a, float *b, float *res, int blockSize, int n) {
int gridSize = (n + b... |
2,564 | //#include "cuda_runtime.h"
//#include "device_launch_parameters.h"
//
//#include <stdio.h>
//#include <iostream>
//#include <time.h>
//
//void CHECK(cudaError_t error)
//{
// if (error != cudaSuccess)
// {
// printf("Error : %s : %d, ", __FILE__, __LINE__);
// printf("code : %d, reason: %s \n", error, cudaGetErrorSt... |
2,565 | #include <stdio.h>
#include <stdlib.h>
typedef short WORD;
typedef int DWORD;
typedef int LONG;
#pragma pack(push, 1)
typedef struct tagBITMAPFILEHEADER
{
WORD bfType; //specifies the file type
DWORD bfSize; //specifies the size in bytes of the bitmap file
WORD bfReserved1; //reserved; must be 0
WO... |
2,566 | #include <stdlib.h>
#include <stdio.h>
__device__ int get_global_index(){
return blockIdx.x * blockDim.x + threadIdx.x;
}
__device__ int get_constant(){
return 7;
}
__global__ void kernel1(int *array){
int index = get_global_index();
array[index] = get_constant();
}
__global__ void kernel2(int *array){
int index = get... |
2,567 | //raytracer.mustafaisik.net//
#include "world.cuh"
#include "cuda_runtime.h"
int main()
{
{
World world;
world.loadScene("input//cornellbox//scene-realtime.xml");
world.video();
}
return 0;
} |
2,568 | #include "includes.h"
__global__ void CalcTotEnergy(double *Etotal_d, double *GlobalE_d, double *Mh_d, double *W_d, double *Rho_d, double *temperature_d, double Gravit, double Cp, double Rd, double A, double *Altitude_d, double *Altitudeh_d, double *lonlat_d, double *areasT, double *func_r_d, int num, bool D... |
2,569 | /***************************************************************************//**
* \file LHS1.cu
* \author Christopher Minar (minarc@oregonstate.edu)
* \brief kernels to generate the left hand side for the intermediate velocity solve
*/
#include "LHS1.h"
namespace kernels
{
/*
* calculates the boundary terms for... |
2,570 | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <cuda_runtime.h>
#define N 10
#define num_threads 10000
__global__ void increment_naive(int *d)
{
int tid = threadIdx.x + blockIdx.x*blockDim.x;
tid = tid % N;
d[tid] += 1;
}
__global__ void increment_atomic(int *d)
{
int tid = ... |
2,571 | //#include <cuda.h>
//#include <cuda_runtime.h>
//#include <math.h>
//#include "NativeDeclarations.h"
//#include <memory>
//
//#define PI 3.14159f
//#define BlockSize 16
//#define IterationLimit 10
//#define Planes 3
//
//template<typename T, int BLOCK_SIZE>
//__global__ void MeanFilterKernel(int Rows, int Cols, T* Ima... |
2,572 | #include <stdio.h> /* printf, scanf, puts, NULL */
#include <stdlib.h> /* srand, rand */
#include <time.h> /* time */
#include <iostream>
// From: https://a248.e.akamai.net/f/862/5658/3/developer.download.nvidia.com/assets/cuda/files/reduction.pdf
template<unsigned int blockSize>
__device__ void warpRe... |
2,573 | #include "include/vec_add.cuh"
int main(int argc, char *argv[]) {
test_vec_add();
return 0;
}
|
2,574 | //#define num_cuda_stream (5)
__global__ void Euler_distance(float* input, float* output, int index, int size)
{
int thread = blockIdx.y*gridDim.x*(blockDim.x*blockDim.y) + blockIdx.x*(blockDim.x*blockDim.y) + threadIdx.y*blockDim.x + threadIdx.x;
int total = gridDim.x*gridDim.y*blockDim.x*blockDim.y;
float dx, dy;... |
2,575 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
__global__ void kernel_sumar(int *a, int *b, int *c, int *resultado)
/*
Guarda en resultado la suma de a + b + c.
*/
{
*resultado = *a + *b + *c;
}
void sumar_en_cuda(int a, int b, int c, int* resultado)
{
// Variables de la grfic... |
2,576 | #include "includes.h"
#pragma diag_suppress integer_sign_change
static unsigned short* d_in;
static unsigned char* d_out;
static unsigned int h_Width;
static unsigned int h_Height;
static unsigned int h_BlockWidth;
static unsigned int h_BlockHeight;
#define THREAD_TOTAL_X_LEN 12
#define THREAD_AUX_X_LEN 4
#define ... |
2,577 | #include <cuda_runtime.h>
typedef unsigned int uint;
uint max_threads = 1024;
uint max_blocks = 65535;
__global__
void bitonicSortStep(float *cudaArr, uint i, uint j)
{
uint tid = threadIdx.x + blockDim.x * blockIdx.x;
uint mate = tid ^ j;
if (tid < mate)
{
if((tid & i) == 0)
{
if(cudaArr[tid] > cudaArr... |
2,578 | #include "includes.h"
#define IDX2D(a, i, stride, j) ((a)[(i)*(stride) + (j)])
__global__ void sim_kernel_naive(double *z, double *v, size_t nx, size_t ny, double dx2inv, double dy2inv, double dt) {
const int mesh_x = blockIdx.x*blockDim.x + threadIdx.x + 1;
const int mesh_y = blockIdx.y*blockDim.y + threadIdx.y + 1;... |
2,579 | #include "includes.h"
__global__ void transposeSmemUnrollPad(float *out, float *in, const int nx, const int ny)
{
// static 1D shared memory with padding
__shared__ float tile[BDIMY * (BDIMX * 2 + IPAD)];
// coordinate in original matrix
unsigned int ix = 2 * blockIdx.x * blockDim.x + threadIdx.x;
unsigned int iy = bl... |
2,580 |
// update the velocities
__global__ void fields2part(int np, float dx, float *xp, float *Epx, float *Ecx){
int tid = threadIdx.x + blockIdx.x * blockDim.x;
while (tid < np) {
Epx[tid] = Ecx[int(xp[tid]/float(dx))];
tid += blockDim.x * gridDim.x;
}
}
|
2,581 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
extern "C"
{
__global__ void NewModuleWithSourceDepsKernel(float* input, float* output, float incrementSize, int itemCount)
{
int threadId = blockIdx.y*blockDim.x*gridDim.x
+ blockIdx.x*blockDim.x
+ threadIdx.x;
}
} |
2,582 | #include "includes.h"
__global__ void conv2() {
} |
2,583 | //#include"E:\VisualStudio\CUDA\CUDAColorToGray\CUDAColorToGray\bmploader_zhang.h"
//#include"E:\VisualStudio\CUDA\CUDAColorToGray\CUDAColorToGray\color_fading.h"
//#include"E:\VisualStudio\CUDA\cudaDome03\common\cpu_bitmap.h"
//#include <stdio.h>
//#include <stdlib.h>
//#include <cmath>
//#define width 1024
//#defi... |
2,584 | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#define cudaCheckErrors(msg) \
do { \
cudaError_t __err = cudaGetLastError(); \
if (__err != cudaSuccess) { \
fprintf(stderr, "Fatal error: %s (%s at %s:%d)\n", \
msg, cudaGetErrorString(__err), \
... |
2,585 | #include "includes.h"
__global__ void sort_boxes_by_indexes_kernel( float* filtered_box, int* filtered_label, int* filtered_dir, float* box_for_nms, int* indexes, int filter_count, float* sorted_filtered_boxes, int* sorted_filtered_label, int* sorted_filtered_dir, float* sorted_box_for_nms, const int num_box_corners, c... |
2,586 | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#define MAX_DIM 20
#define SCALING_FACTOR 256
#define NUM_THREADS 1024
#define MOD_BASE 10007
int NUM_DIM;
int * MAT_DIM;
int ** MAT_LIST;
int find_max(int * arr, int num_elem)
{
int max = 0;
for (int i = 0; i < nu... |
2,587 | //xfail:ASSERTION_ERROR
//--blockDim=1024 --gridDim=1 --no-inline
struct wrapped {
unsigned int bidx;
unsigned int bdim;
unsigned int tidx;
};
__device__ float multiplyByTwo(float *v, wrapped tw)
{
unsigned int tid = tw.bidx * tw.bdim + tw.tidx;
return v[tid] * 2.0f;
}
__device__ float divideByTwo(floa... |
2,588 | #include "includes.h"
__global__ void multiplicacion( int *a, int *b, int *c, int n, int m, int l ) {
int i = threadIdx.x + blockIdx.x*blockDim.x;
int j = threadIdx.y + blockIdx.y*blockDim.y;
c[j+i*l] = 0;
for(int k=0 ; k < m ; k++ ){
c[j+i*l] += a[k+i*m] * b[j+k*l];
}
} |
2,589 | /*
* Copyright (C) 2018 Philip Langdale <philipl@overt.org>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (a... |
2,590 | #include<time.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<cuda.h>
/* Macro for mapping three dimensional index (ix,iy,iz) to
* linear index. The vertical index (z) is running fastest so
* that vertical columns are always kept together in memory.
*/
#define LINIDX(n, ix,iy,iz) ((n.z)*(n.y)*(i... |
2,591 | #include <stdio.h>
#include <stdlib.h>
#include <string.h> /* memcpy */
#include <math.h>
#include <stdint.h>
void *cuda_upload_var(void *host_var, int size)
{
void *cuda_var;
cudaMalloc(&cuda_var, 4);
cudaMemcpy(cuda_var, host_var, size, cudaMemcpyHostToDevice);
return cuda_var;
}
void cuda_download_var(void *cud... |
2,592 | #include "includes.h"
/*
* lanczos computes the smallest n_eigs eigenvalues for dev_L and the
* corresponding eigenvectors using the Lanczos algorithm.
*
* F: an array (n_patch by n_eigs) to store the eigenvectors
* Es: an array (1 by n_eigs) to store the eigenvalues
* dev_L: an array (n_patch by n_patch) representing... |
2,593 | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
__global__ void mk_kernel(char* keep_mem, size_t bytes)
{
for (unsigned i=0; i<bytes; ++i)
{
keep_mem[i] = 0;
}
}
int main()
{
unsigned bytes = 1024 * 1024 * 1024;
printf("I will sleep for 5 seconds. \n");
... |
2,594 | #include <cuda_runtime.h>
#include <stdio.h>
int main(int argc, char **argv) {
// set up device
int dev = 0;
cudaSetDevice(dev);
// memory size
unsigned int isize = 1<<22;
unsigned int nbytes = isize * sizeof(float);
// get device information
cudaDeviceProp deviceProp;
cud... |
2,595 | #include <stdio.h>
#include <stdlib.h>
#include <cmath>
__device__ int position; //index of the largest value
__device__ int largest; //value of the largest value
int lenString = 593;
int maxNumStrings = 1000000;
int threshold = 2;
// Checks if there are any unmerged tuples (Parall... |
2,596 | #include<stdio.h>
#include<stdlib.h>
#define N 2048
#define BLOCK_SIZE 32
//naive way of implementing it, uncoalecesd memory access
__global__ void matrix_transpose_naive(int *in, int *out) {
int index_x = threadIdx.x + blockDim.x * blockIdx.x;
int index_y = threadIdx.y + blockDim.y * blockIdx.y;
int idx = in... |
2,597 | #define BLOCK_SIZE 32
#define BLOCK_DEPTH 3
#define POW2(x) ((x) * (x))
__global__ void bilateralFilterKernel(float* o_arr1d, float* i_arr1d, int rows, int cols, int radius, float gauss_color_coeff, float gauss_space_coeff) {
__shared__ float tile[BLOCK_DEPTH][BLOCK_SIZE][BLOCK_SIZE];
int tx = threadI... |
2,598 |
extern "C"
__global__ void wavee(int* tab, unsigned int rowSize, unsigned int centerX, unsigned int centerY,
float A, float lambda, float time, float fi, unsigned int N)
{
int index = threadIdx.x + blockDim.x * blockIdx.x;
int w = int(index/rowSize);
int h = index%rowSize;
if ( w*rowSize+h < N ) ... |
2,599 | #include <stdio.h>
#include <cuda.h>
//Code writen by Alan Fleming
void add_matrix_cpu(int *a, int *b, int *c, int N){
int i, j, index;
for( i = 0; i<N; i++){
for( j = 0; j<N; j++){
index = i*N+j;
c[index] = a[index] + b[index];
}
}
}
__global__ void add_matrix_gpu(int *a, int *b, int *c, int N){
int co... |
2,600 | /*
nvcc gpu_info.cu -o gpu_info.x
Michael Pohoreski
Copyleft {c} 2013
*/
#include <stdio.h>
#include <cuda.h>
/*
GeForce GTX Titan @ 928 MHz
SM: 14 * 192 sm/core = 2688 Cores
384-bit @ 3004 MHz = 288 GB/s
GeForce GT 750M @ 925 MHz
2 * 192 Cores/SM = 384 Cores
128-bit @ 250... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.