serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
18,701 | #include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <math.h>
#include <sys/time.h>
#include <cuda.h>
double wtime(void)
{
static struct timeval tv0;
double time_;
gettimeofday(&tv0,(struct timezone*)0);
time_=(double)((tv0.tv_usec + (tv0.tv_sec)*1000000));
re... |
18,702 | #include <stdio.h>
__global__ void vector_add(const int *a, const int *b, int *c) {
*c = *a + *b;
}
int main(void) {
const int a = 2, b = 5;
int c = 0;
int *dev_a, *dev_b, *dev_c;
cudaMalloc((void **)&dev_a, sizeof(int));
cudaMalloc((void **)&dev_b, sizeof(int));
cudaMalloc((void **)&dev... |
18,703 | #include "includes.h"
__global__ void Sign( float * x, size_t idx, size_t N)
{
for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < N; i += blockDim.x * gridDim.x)
{
float res = x[(idx-1)*N+i];
if (res > 0 )
x[(idx-1)*N+i] = 1.0 ;
else if (res == 0)
x[(idx-1)*N+i] = 0.0;
else
x[(idx-1)*N+i] = -1.0 ;
}
return;
} |
18,704 | #include "includes.h"
__global__ void rectified_linear_backprop_upd_kernel( float4 * __restrict input_errors, const float4 * __restrict output_errors, const uint4 * __restrict bits_buffer, float negative_slope, bool add_update_to_destination, int elem_count)
{
int elem_id = blockDim.x * blockIdx.x + threadIdx.x;
if (el... |
18,705 | #include<stdio.h>
#include<iostream>
using namespace std;
void __global__ test() {
}
//struct false_usage{
// enum{
//
// }
//}
int main(int argc ,char* argv[]) {
if(argc < 2) {
fprintf(stderr,"invalid Usager,-c blocksize -g gridsize\n");
exit(-1);
}
int flag = 0;
unsigned int blocks... |
18,706 |
/* 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,int var_3,int 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) {
for (int i=0; i < v... |
18,707 | #include <cuda.h>
#include <assert.h>
#include <stdio.h>
template <int channel_per_thread, int filter_per_thread, int channel_per_block, int filter_per_block, int batch_per_block>
__global__ static void _cwc_kern_convolutional_backward_propagate_coefficient_default(const int strides, const int border, const int batch,... |
18,708 | float h_A[]= {
0.9955789127977188, 0.8561169145481113, 0.9886189102815928, 0.8374468724930431, 0.9685061234540727, 0.5495717202706307, 0.8972547277287506, 0.6807241267920705, 0.5165322394782044, 0.9307949057543159, 0.6428965371946282, 0.8579360303733771, 0.8439745945790106, 0.8225012250461169, 0.911510507690394, 0.7274... |
18,709 | extern "C" __global__ void scale(double* vector, double alpha, unsigned int size) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if(idx < size) {
vector[idx] *= alpha;
}
}
extern "C" __global__ void acc(double* x, double* y, double alpha, int size) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if(idx... |
18,710 | #include <cstdio>
#include <cuda_runtime.h>
#include "kosaraju.cuh"
/* Fill out the adjacency list and the reverse adjacency list as according to
* the routes given. Each route represents a directed edge.
*/
__global__
void cudaAirportAdjacencyKernel(int *dev_routes,
int *dev_adj,
int *dev_radj,
... |
18,711 | #include "includes.h"
__global__ void kernel_vecDouble(int *in, int *out, const int n)
{
int i = threadIdx.x;
if (i < n) {
out[i] = in[i] * 2;
}
} |
18,712 | #include <stdio.h>
#include <sys/time.h>
#define ARRAY_SIZE 100000
#define TPB 32
__host__ float cpu_saxpy(int i, float a, float *X, float *Y)
{
return (a*X[i]+Y[i]);
}
__device__ float gpu_saxpy(int i, float a, float *X, float *Y)
{
return (a*X[i]+Y[i]);
}
__global__ void ThreadId(float *y_out, int n, float a, ... |
18,713 | #define NT 1024
// Overall counter variables in global memory.
__device__ int z;
__device__ int m[3];
extern "C" __global__ void modCube (int c, int N){
//Variable declarations
int thr, size, rank;
//Rank and size computations
thr = threadIdx.x;
size = gridDim.x*NT;
rank = blockIdx.x*N... |
18,714 | #include <cuda.h>
#include <iostream>
#include <chrono>
#include <cstring>
#include <cmath>
#define DEBUG 0
//If DEBUG is setted, the program will print the used matrices and the times on the stdout
using namespace std;
/*function marked with '__global__' are the GPU Kernels*/
//This reduces the matrix to upper tria... |
18,715 | #include "includes.h"
__global__ void isnan_check_device(double *array, int size, bool *check) {
//
// Description: Check for nan in array.
int idx = threadIdx.x + blockDim.x * blockIdx.x;
if (idx < size && ::isnan(array[idx])) {
*check = true;
}
} |
18,716 |
/*************************************************
** Accelereyes Training Day 1 **
** Matrix Addition **
** **
** This program will add two matrices and store **
** the result in a third matrix using the GPU **
*************************************************/
#include <iostream>
#include <ve... |
18,717 | //
// Cuda Sudoku Solver
//
// Created by Arpit Jain
// Copyright (c) 2014 New York University. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <curand_kernel.h>
#include <math.h>
#include <cuda.h>
#define NUM_ITERATION 10000
#define INIT_TEMPERATURE 0.4
#define MIN_TEMPERATURE 0.001
#define... |
18,718 | #include "includes.h"
__global__ void TgvComputeOpticalFlowVectorMaskedKernel(const float *u, const float2 *tv2, float* mask, int width, int height, int stride, float2 *warpUV)
{
const int ix = threadIdx.x + blockIdx.x * blockDim.x;
const int iy = threadIdx.y + blockIdx.y * blockDim.y;
if ((iy >= height) && (ix >= wid... |
18,719 | #include "includes.h"
__global__ void callOperationSharedStatic(int *a, int *b, int *c, int n)
{
int tid = blockDim.x * blockIdx.x + threadIdx.x;
if (tid >= n) {
return;
}
__shared__ int s_a[size], s_b[size], s_c[size];
s_a[tid] = a[tid];
s_b[tid] = b[tid];
if (s_a[tid] <= s_b[tid])
{
s_c[tid] = s_a[tid];
}
else
{
... |
18,720 | #include <cstdlib>
#include<iostream>
#include<cuda.h>
#include <sys/time.h>
#include <cuda_fp16.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <cuda_fp16.h>
#define cudaCores 3584
using namespace std;
FILE *fp;
int smCount,totalThreads;
//__float2half
/*void getGPUConfi... |
18,721 | #include <stdlib.h>
#include <stdio.h>
// CUDA kernel
__global__ void say_hello()
{
// a CUDA core executes this line
printf("GPU says, Hello world!\n");
}
// CUDA kernel for step 2
__global__ void say_hello2()
{
// a CUDA core executes this line
printf("Thread %d says, Hello world!\n", threadIdx.x);
... |
18,722 | #include <stdio.h>
#define imin(a,b)(a<b?a:b)
const int N = 33 * 1024;
const int threadsPerBlock = 256;
const int blocksPerGrid = imin(32, (N + threadsPerBlock - 1) / threadsPerBlock);
__global__ void dot(float *a, float *b, float *c)
{
__shared__ float cache[threadsPerBlock];
int tid = threadIdx.x + blockI... |
18,723 |
/*
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
//#include "helper_cuda.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define SIZE_M (512 * 2)
#define SIZE_N (512 * 4)
#define SIZE_K (512 * 2)
#define BLOCK_SIZE 16
#define ID2INDX(_row, _col, _width) (((_row)*(_wi... |
18,724 | #include <iostream>
#include <math.h>
#define cudaCheckError() { \
cudaError_t e=cudaGetLastError(); \
if(e!=cudaSuccess) { ... |
18,725 | #include "includes.h"
#define THREADS_PER_BLOCK 256
__global__ void MatrixMul( float *Md , float *Nd , float *Pd , const int WIDTH )
{
int COL = threadIdx.x + blockIdx.x * blockDim.x;
int ROW = threadIdx.y + blockIdx.y * blockDim.y;
if (ROW < WIDTH && COL < WIDTH) {
for (int i = 0; i < WIDTH; i++) {
Pd[ROW ... |
18,726 | //#include <stdio.h>
//#include <string.h>
//int main()
//{
//
//
//
//} |
18,727 | extern "C" __global__ void transpose(int* A, int* B, int rows, int cols)
{
int col = threadIdx.x + blockIdx.x * blockDim.x;
int row = threadIdx.y + blockIdx.y * blockDim.y;
int index = row * rows + col;
int transposedIndex = col * rows + row;
if (col < cols && row < rows)
{
B[index] = A[transposedIndex];
}
} |
18,728 | #include "includes.h"
//============================================================================
// Name : CudaMap.cu
// Author : Hang
//============================================================================
using namespace std;
__global__ void addTen(float* d, int count) {
int threadsPerBlo... |
18,729 | /*
* Author Oleksandr Borysov
* Task3
*/
#include <stdio.h>
#include <stdlib.h>
#include <curand.h>
#include <curand_kernel.h>
#include <math.h>
#include <ctime>
#define MAX 32767
#define PLOT_DATA_FILE "plot_data3.txt"
#define SEED 254321
__global__ void getCounts(double* results, unsigned long* idxSteps, unsigned ... |
18,730 | #include <stdio.h>
#include <cuda_runtime_api.h>
__global__ void empty()
{
return;
}
int main()
{
dim3 gridSize = dim3(1, 1, 1);
dim3 blockSize = dim3(1, 1, 1);
empty<<<gridSize, blockSize>>>();
printf("Hello World\n");
return 0;
}
|
18,731 | #include "includes.h"
using namespace std;
__global__ void propagateCarries(int* d_matrix, int numCols) {
int idx = blockDim.x * blockIdx.x + threadIdx.x * numCols;
int carry = 0;
for (int i = numCols - 1; i >= 0; i--) {
int rowVal = (d_matrix[idx + i] + carry) % 10;
carry = (d_matrix[idx + i] + carry) / 10;
d_m... |
18,732 | #include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdio.h>
//#include "cg_cpu.h"
/*
The following functions implement the conjugate gradient algorithm
on the CPU as a pretest for the implementation on the GPU.
Uses float as this will also be fastest on the GPU.
*/
void set_zero(float * v, int n) {
... |
18,733 | #include <cuda_runtime.h>
#include <cstdlib>
#include <iostream>
#include <time.h>
#include "CudaPhysics.cuh"
#include "CudaKernels.cuh"
void ConstructMatrixOfInfluenceCoefficientsCuda(
const float *h_cp_x,
const float *h_cp_y,
const float *h_cp_z,
const float *h_n_x,
const float *h_n_y,
const float *h_n_z,
co... |
18,734 | #include <stdio.h>
#include <stdlib.h>
#include <cuda_runtime.h>
#include <time.h>
#include <stdio.h>
#include "device_launch_parameters.h"
#define DATA_SIZE 1048576
#define BLOCK_NUM 32
#define THREAD_NUM 256
int data[DATA_SIZE];
clock_t clockBegin, clockEnd;
__global__ static void sumOfSquares(int *num, i... |
18,735 | #include "includes.h"
#define INF 2147483647
extern "C" {
}
__global__ void oneReduction(int * tab, int len, int mod) {
__shared__ int begin, end;
__shared__ int tmp_T[1024];
if(threadIdx.x == 0) {
begin = blockIdx.x*len;
end = blockIdx.x*len + len;
}
__syncthreads();
if(blockIdx.x % mod < mod/2) {
for(int k... |
18,736 | #include "includes.h"
/*
Now we make the matrix much bigger
g++ -pg seq_matrix_big_mul.c -o seq_matrix_big_mul
*/
#define N_THREADS 32
int num_rows_A = 2000; int num_rows_B = 2000; int num_rows_C = 2000;
int num_cols_A = 2000; int num_cols_B = 600; int num_cols_C = 600;
//int num_rows_A = 64; int num_rows_B = 64; int... |
18,737 | //#include <stdio.h>
//#include <stdlib.h>
//
//#include "cuda_runtime.h"
//#include "device_launch_parameters.h"
//#include "common.h"
//#include "cuda_common.cuh"
//
//__global__ void k1()
//{
// int gid = blockDim.x * blockIdx.x + threadIdx.x;
// if (gid == 0)
// {
// printf("This is a test 1 \n");
// }
//}
//
//__... |
18,738 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define INF 1073741824
#define BLOCK_SZ 16
int m; // nodes
int n; // dimensions
int k; // k-nearest
// input sample file
int* load(const char *input)
{
FILE *file = fopen(input, "r");
if (!file) {
fprintf(stderr, "Error: no such input file \"%s... |
18,739 | //#include "kernel.cuh"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#define N 5000
__host__
bool checkArr(int *arr, int size)
{
for (int i = 0; i < size-1; ++i)
{
if (arr[i] > arr[i + 1])
{
printf("Array index: %d... |
18,740 | #include <stdio.h>
__global__ void transpose(unsigned char *odata, const unsigned char *idata)
{
int H = blockDim.x * gridDim.x; // # dst_height
int W = blockDim.y * gridDim.y; // # dst_width
int h = blockDim.x * blockIdx.x + threadIdx.x; // 32 * bkIdx[0:18] + tdIdx; [0,607] # x / h-th row
int w = ... |
18,741 | #include <cstdio>
int main() {
printf ("Hello, CUDA!\n");
return 0;
}
|
18,742 | #include <cstdio>
#include <cuda_runtime.h>
#include "main.cuh"
#define gpuCheck(ans) { gpuAssert((ans), __FILE__, __LINE__); }
inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true)
{
if (code != cudaSuccess)
{
fprintf(stderr,"GPUassert: %s %s %d\n", cudaGetErrorString(cod... |
18,743 | #include "includes.h"
__global__ void profileLevelDown_kernel() {} |
18,744 | #include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/copy.h>
#include <thrust/fill.h>
#include <thrust/sequence.h>
#include <thrust/transform.h>
#include <thrust/replace.h>
#include <thrust/functional.h>
#include <thrust/sort.h>
#include <thrust/binary_search.h>
#include <thrust/random.h>... |
18,745 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <cstdlib>
#include <cstring>
#define BLOCK_SIZE 256
#define HISTOGRAM_LENGTH 256
__global__ void histo(unsigned char* buffer, unsigned int* histo, long size)
{
__shared__ unsigned int private_histo[256];
if(threadIdx.x < 2... |
18,746 | __device__ float function_a_appli(float x);
__global__ void applique_fonc ( int nb_ligne, int nb_col, float * input, float * res ){
int index_col=threadIdx.x+blockDim.x*blockIdx.x;
int index_ligne=threadIdx.y+blockDim.y*blockIdx.y;
int global_index;
if ((index_col >= nb_col) || (index_lig... |
18,747 | #include <stdio.h>
#include <cuda.h>
__global__ void dkernel(unsigned *vector, unsigned vectorsize) {
unsigned id = blockIdx.x * blockDim.x + threadIdx.x;
vector[id] = id;
__syncthreads();
if (id < vectorsize - 1 && vector[id + 1] != id + 1) printf("syncthreads does not work.\n");
}
#define BLOCKSIZE 1000
#define ... |
18,748 | //Transpuesta de una matriz
#include<iostream>
#include<stdio.h>
#include<malloc.h>
using namespace std;
__host__
void T(int *A, int filas, int columnas, int* B){
for(int j = 0; j < columnas; j++){
for(int i = 0; i < filas; i++){
B[j*filas+i] = A[i*columnas+j];
}
}
}
__global__
void TCU(int *A, in... |
18,749 | #include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <assert.h>
#include <time.h>
#define R 3
#define BLOCK_SIZE 5 // number of output elements calculated in one block
int iDivUp(int a, int b){ return ((a % b) != 0) ? (a / b + 1) : (a / b); }
__global__ void oneD_stencil_shared(int *in_arr, int *out_ar... |
18,750 | __device__ void rkck(float* y, float* dydx, const float x,
const float h, float* yout, float* yerr,
void derivs(const float, float* , float* ))
{
const float a2=0.2, a3=0.3, a4=0.6, a5=1.0, a6=0.875,
b21=0.2, b31=3.0/40.0, b32=9.0/40.0, b41=0.3, b42 = -0.9,
b43=1.2, b51 = -11.0/54.0, b52=2.5, b53 = -70.0/27.0,
... |
18,751 |
#include <stdio.h>
__global__ void kernel(){
}
int main(void){
kernel <<<1,1>>> ();
printf("Hola, soy tu esclavo!\n");
return 0;
}
|
18,752 | /* Example of using lodepng to load, process, save image */
#include <stdio.h>
#include <stdlib.h>
#define N 4 // grid side length
#define RHO 0.5 // related to pitch
#define ETA 2e-4 // related to duration of sound
#define BOUNDARY_GAIN 0.75 // clamped edge vs free edge
#define BLOCK_WIDTH 512
#define ind(i,j) ((j) ... |
18,753 | /********************************************************************/
/***** GPU Graph Cut ************************************************/
/********************************************************************/
////////////////////////////////////////////////////
// Copyright (c) 2018 Kiyoshi Oguri 2018.02.14 //
/... |
18,754 | #include "includes.h"
__global__ void update_old( float4 *__restrict__ newPos, float4 *__restrict__ oldPos )
{
int index = blockIdx.x * blockDim.x + threadIdx.x;
oldPos[index] = newPos[index];
} |
18,755 | #include "includes.h"
__device__ bool checkBoundary(int blockIdx, int blockDim, int threadIdx){
int x = threadIdx;
int y = blockIdx;
return (x == 0 || x == (blockDim-1) || y == 0 || y == 479);
}
__global__ void mJocobi_TwoDim(float *x_new, float *x_old, float* b, float alpha, float rBeta) {
if(checkBoundary(blockIdx.x,... |
18,756 | //=====================================================================
// MAIN FUNCTION
//=====================================================================
__device__ void kernel_ecc(float timeinst, float* d_initvalu, float *d_finavalu, int valu_offset,
float* d_params) {
//=================================... |
18,757 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include "curand.h"
#include <iostream>
#include <iomanip>
using namespace std;
__device__ int dCount = 0;
__global__ void countPoints(const float* xs, const float* ys)
{
int idx = blockIdx.x * blockDim.x + threadIdx.x;
float x = xs[idx] - 0.5f;
floa... |
18,758 | /*
* Hello world for CUDA, with access to the shared memory of the multiprocessors
*/
#include <stdio.h>
#include <stdlib.h>
__shared__ float sums[10];
// Define a kernel function
__global__ void vector_sum(float* A, float* B, int length, const int N) {
// Take a vector A of length "length" and sum it, putting th... |
18,759 | #include "includes.h"
__global__ void hotspotOpt1(float *p, float* tIn, float *tOut, float sdc, int nx, int ny, int nz, float ce, float cw, float cn, float cs, float ct, float cb, float cc)
{
float amb_temp = 80.0;
int i = blockDim.x * blockIdx.x + threadIdx.x;
int j = blockDim.y * blockIdx.y + threadIdx.y;
int c = i... |
18,760 | // System includes
#include <stdio.h>
#include <cuda_runtime.h>
#include<device_launch_parameters.h>
#include<curand.h>
#define _USE_MATH_DEFINES
#include<math.h>
__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 t, floa... |
18,761 | /*
*
* Authors: Steven Faulkner, Blaine Oakley, Felipe Gutierrez
*
* Final Project for CIS 4930, Implementation of K-means clustering
* optimized with shared memory and reduction methods.
*
* To compile nvcc kmeans.cu
* To run ./a.out "input.txt" "K" "iterations"
*
* @data file: is the specified input file
* @k: is th... |
18,762 | //Save data to array
// bool Cstmd1Sim::save_data_to_array(thrust::device_vector<float> &v, int** result, int T, int N){
//
// result = NULL;
//
// try {
//
// result = new int*[N];
// for(int i = 0; i < T; i++) {
// result[i] = new int[T];
// }
//
// } catch (std::bad_alloc& ba) {... |
18,763 | #include "includes.h"
__global__ void kApplyTanh(float* mat, float* target, unsigned int len) {
const unsigned int idx = blockIdx.x * blockDim.x + threadIdx.x;
const unsigned int numThreads = blockDim.x * gridDim.x;
float mat_i, exp2x;
for (unsigned int i = idx; i < len; i += numThreads) {
mat_i = mat[i];
exp2x = __exp... |
18,764 | #include "includes.h"
__global__ void sway_and_flip_weights_kernel(const float *src_weight_gpu, float *weight_deform_gpu, int nweights, int n, int kernel_size, int angle, int reverse)
{
const int index = blockIdx.x*blockDim.x + threadIdx.x;
const int kernel_area = kernel_size * kernel_size;
const int i = index * kerne... |
18,765 | #include <stdio.h>
#include <cuda.h>
__global__ void gpu_reduce(int *c, 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;
... |
18,766 | #include <thrust/device_vector.h>
#include <thrust/sequence.h>
#include <thrust/reduce.h>
#include <thrust/count.h>
#include <thrust/functional.h>
#include <thrust/execution_policy.h>
#include <thrust/scan.h>
#include <iostream>
using namespace std;
#define N 10
int main()
{
thrust::device_vector<int> D(N);
thrust:... |
18,767 | #include <stdio.h>
#include <sys/time.h>
#include <iostream>
#include <fstream>
using namespace std;
#define ALPHA 19e-5
#define DELTA_T 120
#define ROUNDS 3*60*60/DELTA_T
#define DISTANCE 0.1
/**
* O argumento deve ser double
*/
#define GET_TIME(now) { \
struct timespec time; \
clock_gettime(CLOCK_MONOTONIC_RAW,... |
18,768 | #include "includes.h"
__global__ void getPredicate_kernel(unsigned int * d_inVal, unsigned int * d_predVal, unsigned int numElems, unsigned int bitMask)
{
unsigned int gIdx = blockIdx.x * blockDim.x + threadIdx.x;
if (gIdx < numElems)
{
// if bitmask matches inputvale then assign 1 to the position otherwise set to 0
... |
18,769 | #include <iostream>
#include <stdlib.h> /* srand, rand */
#include <time.h> /* time */
#include <math.h>
using namespace std;
//4000x4000 8
#define row 50
#define column 65
#define THREADS_PER_BLOCK 1024//64//1024//8
// Funcion para generar numeros randoms en mi matrix:
void randomsInt(int **& matrix){
... |
18,770 | #include "cudamat_kernels.cuh"
#include "float.h"
/* ------------------------- Random number generation ------------------------- */
__global__ void cudamat_kSeedRandom(unsigned int* rndMults, unsigned long long* rndWords, unsigned int seed) {
const unsigned int idx = blockIdx.x * blockDim.x + threadIdx.x;
/... |
18,771 | #include "includes.h"
__global__ void cuConvertC3ToC4Kernel(const float3* src, size_t src_stride, float4* dst, size_t dst_stride, int width, int height)
{
const int x = blockIdx.x*blockDim.x + threadIdx.x;
const int y = blockIdx.y*blockDim.y + threadIdx.y;
int c_src = y*src_stride + x;
int c_dst = y*dst_stride + x;
if... |
18,772 | #include<stdio.h>
#define SIZE 100
__global__
void max(int *a,int *b,int *c)
{
int i = blockIdx.x*blockDim.x + threadIdx.x;
int id;
switch(i)
{
case 0:
for(id = 0 ; id<SIZE/10 ; id++)
{
if(a[id] > c[i])
c[i] = a[id];
}
b[i] = c[i];
break;
case 1:
... |
18,773 | #include "thrust_all.cuh"
__global__
void device_add(int *a,int *b,int N)
{
auto index = blockIdx.x * blockDim.x + threadIdx.x;
auto stride = blockDim.x * gridDim.x;
for (auto i = index; i < N; i += stride)
b[i] = a[i] + b[i];
}
int main(void)
{
constexpr int N = 1<<10;
using vec_type = int;
thrust::d... |
18,774 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <iostream>
using namespace std;
int main(){
cudaDeviceProp prop;
int counted;
cudaGetDeviceCount(&counted);
for(int i=0; i<counted; i++){
cudaGetDeviceProperties(&prop,i);
cout<<"---Some Information for the Device---"<<endl;
cout<... |
18,775 |
/* This is a automatically generated test. Do not modify */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
__global__
void compute(float comp, int var_1,int var_2,int var_3,float var_4,float var_5,float var_6,float var_7,float var_8,float* var_9,float var_10,float var_11,float var_12,float var_13,float var... |
18,776 | //============================================================================
// Name : TCcalcJacobiParallel.cpp
// Author : Niklas Bergh
//============================================================================
#include <iostream>
#include <fstream>
#include <sstream>
#include <unordered_map>
#inclu... |
18,777 | /////////////////////////
// convolution.cu //
// Andrew Krepps //
// Module 5 Assignment //
// 3/5/2018 //
/////////////////////////
#include <chrono>
#include <stdio.h>
#include <stdlib.h>
#define MAX_WEIGHTS 4096
//////////////////////////////////////////////////////////////////////////////... |
18,778 | #include <stdio.h>
// For the CUDA runtime routines (prefixed with "cuda_")
#include <cuda_runtime.h>
__global__ void
rng(int *I, int seed)
{
int tx = threadIdx.x;
int ty = threadIdx.y;
int bx = blockIdx.x;
int by = blockIdx.y;
int i = ((by * blockDim.y + ty) * gridDim.x * blockDim.x) + (bx * blockDim.x +... |
18,779 | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
__global__ void VecAdd(float* A, float* B, float* C, int N){
int i = threadIdx.x + blockDim.x * blockIdx.x;
if (i < N)
C[i] = A[i] * A[i] + B[i] * B[i];
}
int main(int argc, char** argv){
srand(2634);
int N = atoi(argv[1]);
char* out... |
18,780 | #include <stdio.h>
__global__ void mykernel(){
}
int main(void) {
mykernel<<<1,1>>>();
printf("Hello World!\n");
return 0;
}
|
18,781 | // System includes
#include <stdio.h>
#include <assert.h>
// CUDA runtime
#include <cuda.h>
#include <cuda_runtime.h>
//#define STREAMS_NUM 8
#define BLOCKSIZE 1024
int STREAMS_NUM;
__global__ void vectorAddGPU(float *a, float *b, float *c, int N, int offset) {
int idx = blockIdx.x*blockDim.x + threadIdx.x + o... |
18,782 |
__global__ void
apply_rows_max(float* X, /** matrix to apply .. row major **/
float* y, /** result vector **/
int* iy,
int rows,
int cols
) {
unsigned int thidx = threadIdx.x;
unsigned int thidy = threadIdx.y;
unsigned int bid = blockIdx.x;
unsigned int b... |
18,783 |
// CUDA运行时头文件
#include <cuda_runtime.h>
#include <chrono>
#include <stdio.h>
#include <string.h>
using namespace std;
#define checkRuntime(op) __check_cuda_runtime((op), #op, __FILE__, __LINE__)
bool __check_cuda_runtime(cudaError_t code, const char* op, const char* file, int line){
if(code != cudaSuccess){ ... |
18,784 |
/* This is a automatically generated test. Do not modify */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
__global__
void compute(float comp, int var_1,float var_2,float var_3,float var_4,float var_5,float var_6,float var_7,float var_8,float var_9,float var_10,float var_11,float var_12,float var_13,float ... |
18,785 | /**
* For a matrix of size 32 x 32, computes (a_ij)^(pow) for each element a_ij
* and stores in res_ij.
*
* Shared memory is necessary here because we are reading and writing
* to memory many times...
*
* Note that __syncthreads is not needed here because each row in shared
* memory is exclusively read and writ... |
18,786 | #include "includes.h"
__global__ void stencil2DKernel(double* temperature, double* new_temperature, int block_x, int block_y, int thread_size) {
int i_start = (blockDim.x * blockIdx.x + threadIdx.x) * thread_size + 1;
int i_finish =
(blockDim.x * blockIdx.x + threadIdx.x) * thread_size + thread_size;
int j_start = (blo... |
18,787 |
//In theory, GPU accelerated code
#include <iostream>
#include <math.h>
using namespace std;
__global__ //Kernel function to add the elements of two arrays
void add(int n, float *x, float *y)
{
for(int i= 0; i < n; i++) y[i] = x[i] + y[i]; //Note: i is now the thread index, and each loop through changes to next... |
18,788 | // iamgroot42
// Code for reading files and loading into memory used from the CPU template provided with the assignment
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ctime>
#define LINEWIDTH 20
#define KEYWORD 32
#define CHUNKSIZE 4
__global__ void matchPattern(unsigned int... |
18,789 | #include "includes.h"
__global__ void MatrixMulKernel(int *d_x, int *d_y, int *d_z, int Block_Width, int M , int N) {
int row = blockIdx.y*blockDim.y+ threadIdx.y;
int col = blockIdx.x*blockDim.x+ threadIdx.x;
int kernelSum = 0;
if ((row<N) && (col<N)) {
for (int i = 0; i < Block_Width ; ++i) {
kernelSum+=d_x[col * B... |
18,790 | #include <math.h>
__global__
void kernel1(const float *input, const float *input2, float *output, int dataSize)
{
int blockNum = blockIdx.z*(gridDim.x*gridDim.y) + blockIdx.y*gridDim.x + blockIdx.x;
int threadNum = threadIdx.z*(blockDim.x*blockDim.y) + threadIdx.y*(blockDim.x) + threadIdx.x;
int i = blockNum*(block... |
18,791 | #include "includes.h"
__global__ void MSD_GPU_Interpolate_linear(float *d_MSD_DIT, float *d_MSD_interpolated, int *d_MSD_DIT_widths, int MSD_DIT_size, int *boxcar, int max_width_performed){
int tid = threadIdx.x;
if(boxcar[tid] <= max_width_performed) {
// int f = threadIdx.x;
int desired_width = boxcar[tid];
in... |
18,792 | #include <iostream>
#include <cuda.h>
using std::cout;
using std::endl;
__global__ void add_me(int *a, int* b, int *c) {
if(threadIdx.x < 8)
c[threadIdx.x] = a[threadIdx.x] + b[threadIdx.x];
}
int main(int argc, char *argv[])
{
int arr1[8] = {1, 2, 3, 4 , 5 ,6 ,7, 8};
int arr2[8] = {9, 10, 11,... |
18,793 | #include <iostream>
using std::cerr;
using std::endl;
// Error handling macro
#define CUDA_CHECK(call) \
if((call) != cudaSuccess) { \
cudaError_t err = cudaGetLastError(); \
cerr << "CUDA error calling \""#call"\", code is " << err << endl;}
#include<stdio.h>
#include<stdlib.h>
void init_mtx(flo... |
18,794 | #include <stdio.h>
#include <math.h>
#define MAX 8192
#define LOG_MAX 13
#define N 10
const int BLOCK_SIZE = 512;
void bit_reverse(float x_r[], float x_i[]);
__host__ void fftHost(float *x_r, float *x_i);
__global__ void fftKernel(float *dx_r, float *dx_i);
int main() {
float *x_r, *x_i, *xr, *xi;
float... |
18,795 | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define BLOCK_SIZE 3
int w=3, h=3;
int size = w*h;
int memsize = sizeof(float)*size;
__global__ void matrixMultiply(float *a, float *b, float *c, int w, int h){
int tx = (blockIdx.x * blockDim.x) + threadIdx.x;
int ty = (blockIdx.y * blockDim.y) + threadIdx.... |
18,796 | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <cuda_runtime_api.h>
#define BASE_TYPE float
__global__ void add(BASE_TYPE *a, BASE_TYPE *b, BASE_TYPE *result, const int N)
{
int threads_count = blockDim.x * gridDim.x;
int elem_per_thread = N / threads_count;
int k = (blockIdx.x * blockD... |
18,797 | #include "includes.h"
// helper for CUDA error handling
__global__ void getLowerAAt( const double* A, double* S, std::size_t imageNum, std::size_t pixelNum )
{
std::size_t row = blockIdx.x;
std::size_t col = blockIdx.y * blockDim.x + threadIdx.x;
if(row >= imageNum || col >= imageNum)
{
return;
}
S[row * imageNum ... |
18,798 | /**
* Alemdar Salmoor
* */
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <limits.h>
#include <float.h>
#include <math.h>
//The following implementation of the atomicAdd for devices with compute capabilities lower
//than 6.0 is provided on the NVidia Cuda Toolkit Documentation ... |
18,799 | /*
* Matrix is a PHP extension. It can do parallel computing base on CUDA.
*
* GitHub: https://github.com/BourneSuper/matrix
*
* Author: Bourne Wong <cb44606@gmail.com>
*
* */
#include <stdio.h>
// For the CUDA runtime routines (prefixed with "cuda_")
#include <cuda_runtime.h>
#include "math.cuh"
int getM... |
18,800 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
__global__
void add(int n, float *x, float *y)
{
int index = blockIdx.x * blockDim.x + threadIdx.x;
int stride = blockDim.x * gridDim.x;
for (int i = index; i < n; i += stride) {
y[i] = x[i] + y[i];
}
}
int main(void) {
i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.