serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
3,501 |
#include <cuda_runtime.h>
#include <vector>
#include <iterator>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <ncurses.h>
#ifndef gpuErrchk
#define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); }
#endif
static inline void gpuAssert(cudaError_t code, const char *file, int line, bool abo... |
3,502 | // Vector addition: r = a + b.
#include <stdio.h>
#include <iostream>
#include <iomanip>
using std::cout;
using std::cerr;
using std::endl;
// Handle CUDA errors
void handle_error(cudaError_t err, const char *file, int line) {
if (err != cudaSuccess) {
cout << cudaGetErrorString(err) << " in " << file << " at li... |
3,503 | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include "vector_types.h"
#include <unistd.h>
#include <time.h>
#include "device_functions.h"
#include "cuda.h"
#include <cuda_runtime.h>
#define fix1 3.14 / (60 * 180)
using namespace std;
__global__ void angles(volatile ... |
3,504 | #include<stdio.h>
__global__ void printId(){
int blockId = blockIdx.x;
int threadId = threadIdx.x;
printf("I come from block %d - thread %d.\n", blockId, threadId);
}
int main(){
printId<<<2, 4>>>();
return 0;
} |
3,505 | #include "includes.h"
__global__ void scatter(unsigned int *d_inVals, unsigned int *d_outVals, unsigned int *d_inPos, unsigned int *d_outPos, unsigned int *d_zerosScan, unsigned int *d_onesScan, unsigned int *d_zerosPredicate, unsigned int *d_onesPredicate, size_t n)
{
int tx = threadIdx.x;
int bx = blockIdx.x;
int ind... |
3,506 | #include <cuda.h>
// Kernel that executes convolution. Nothing fancy is done. We don't even try to avoid
// block effects here.
__global__ void KernConvolve(float *data,
float *kernels,
float *dataOut,
int signalLength,
... |
3,507 | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <time.h>
#include <string.h>
int xpixels = 17500;
int ypixels = 10000;
int currentPixel = 0; //counter for calculations
int totalPixels; //the total number of pixels in the image
double xmin; // ranges for the calculating the ... |
3,508 |
/* 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... |
3,509 | #define N 512
#define NUM_BLOCKS 16
#define NUM_THREADS 48
//Do not change above three lines.
//Submission should be named as <RollNumber>_Prog.cu
//Upload just this cu file and nothing else. If you upload it as a zip, it will not be evaluated.
/*Remember the following guidelines to avoid losing marks
This exercise... |
3,510 | __global__ void interp3_cuda(
float * vOutput,
int nPoints,
int xSize,
int ySize,
int zSize,
float * gridX,
float * gridY,
float * gridZ,
float * vInput,
float * xInterp,
float * yInterp,
float * zInterp)
{
int idx = blockDim.x * (gridDim.x * blockIdx.y + blockIdx.x) + threadIdx.x;
if (idx... |
3,511 | #include "includes.h"
__global__ void PictureKernell(unsigned char *imageInput, int width, int height, unsigned char *imageOutput){
int row = blockIdx.y*blockDim.y+threadIdx.y;
int col = blockIdx.x*blockDim.x+threadIdx.x;
if((row < height) && (col < width)){
imageOutput[row*width+col] = imageInput[(row*width+col)*3+RE... |
3,512 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <iostream>
__global__ void sum (int a, int b)
{
printf ("sum of a + b = %d\n", a + b);
}
int main ()
{
int a, b;
std::cout << "Enter num a:";
std::cin >> a;
std::cout << "Enter num b:";
std::cin >> b;
sum <<<1, 1>>>(a, b);
getchar ();
re... |
3,513 | /*
* Copyright 1993-2010 NVIDIA Corporation. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and * proprietary rights in and to this software and related documentation.
* Any use, reproduction, disclosure, or distribution of this software
* and related documentatio... |
3,514 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <time.h>
__global__ void mem_trd_test(int *input)
{
int gid = blockIdx.x * blockDim.x + threadIdx.x;
printf("threadIdx.x : %d, gid : %d - data : %d \n",threadIdx.x , gid, input[g... |
3,515 | #include "includes.h"
__global__ void sgemvn_kernel1_fermi(int n, int m, int n1, float alpha, float* A, int lda, float *x, float *y)
{
int ind = blockIdx.x*num_threads + threadIdx.x;
A += ind;
float res = 0.f;
for(int i=0; i<n1; i += sgemv_bs ){
#pragma unroll
for(int j=0; j < sgemv_bs ; j++){
res += A[0] * x[j];
A... |
3,516 | #include <stdio.h>
#include <cuda.h>
#define HANDLE_ERROR(apiFuncCall) \
do { \
cudaError_t _status = apiFuncCall; \
if (_status != cudaSuccess) { ... |
3,517 | #include "includes.h"
extern "C" {
}
__global__ void fill_u32(unsigned int *y, unsigned int elem, unsigned int len) {
int tid = blockIdx.x * blockDim.x + threadIdx.x;
if (tid < len) {
y[tid] = elem;
}
} |
3,518 | #include "includes.h"
__global__ void set_valid_pos_flag(int32_t* pos_buff, const int32_t* count_buff, const int32_t entry_count) {
const int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
const int32_t step = blockDim.x * gridDim.x;
for (int32_t i = start; i < entry_count; i += step) {
if (count_buff[i]) {
pos_buf... |
3,519 | /* MD5
Original algorithm by RSA Data Security, Inc
Adapted for NVIDIA CUDA by Matthew McClaskey
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorit... |
3,520 | #include <stdio.h>
#define NX 200
#define NY 100
__global__ void saxpy2D(float scalar, float * x, float * y)
{
int row = blockIdx.x * blockDim.x + threadIdx.x;
int col = blockIdx.y * blockDim.y + threadIdx.y;
if ( row < NX && col < NY ) // Make sure we don't do more work than we have data!
y[... |
3,521 | #include <stdio.h>
#include <cuda.h>
#include <math.h>
__global__ void somaMatrizGPU(int *d_vetA, int indice, int passo){
int id = blockDim.x * blockIdx.x + threadIdx.x;
if((id % indice) == 0)
d_vetA[id] += d_vetA[id+passo];
}
int main(){
int h_Size = 16;
int j, i = 0;
int h_vetA[16]={1,2,3,4,5,6,7,8,9,1... |
3,522 | //pass
//--blockDim=256 --gridDim=2 -DWIDTH=2064 --no-inline
#include <cuda.h>
#include <stdio.h>
#define GRIDDIM 1
#define BLOCKDIM 2//256
#define WIDTH 2//2048
#define N WIDTH
/*
* This kernel demonstrates a blockwise strength-reduction loop.
* Each block is given a disjoint partition (of length WIDTH) of A.
* T... |
3,523 | /*
Program name: MatrixTranspose.cu
Author name: Dr. Nileshchandra Pikle
Email: nilesh.pikle@gmail.com
Contact Number: 7276834418
Webpage: https://piklenileshchandra.wixsite.com/personal
Purpose: To perform Matrix Transpose using CUDA
Description: Matrix transpo... |
3,524 | #include <stdio.h>
__global__ void addk()
{ }
int main()
{
//float out[], in[];
addk<<<1,10>>>();
printf("Hello world from CPU");
return 0;
}
|
3,525 | /*
compile : nvcc malloc_test.cu -o malloc_test
exec : ./malloc_test 512 1
starting 512MB , increase 1MB
if you have multiple GPU, use below
export CUDA_VISIBLE_DEVICES=3;./malloc_test 512 1
MB convert table would be :
GB MB
1 1024
2 2048
3 3072
4 4096
5 5120
6 6144
7 7168
8 8192
9 9216
10 10240
11 11264
12 12288
13... |
3,526 |
__device__
unsigned long long int combin(int m, int k) {
unsigned long long int comb = 1;
for (int j = m; j > m - k; j--) {
comb = comb * j;
}
for (int q = k; q > 0; q--) {
comb = comb / q;
}
return comb;
}
__device__
void queenGen(unsigned int* queensList, unsigned long long i... |
3,527 | #include <stdio.h>
#define X 12
#define THREAD_X 4
__global__ void index(int *A){
int i = blockDim.x*blockIdx.x+threadIdx.x;
//int i = threadIdx.x;
A[i] = i;
// A[i] = gridDim.x;
//A[i] = blockDim.x;
// A[i] = threadIdx.x;
}
int main(){
int A[X], *A_d;
int i;
//dim3 dimBlock(THREAD_X, THR... |
3,528 | //ECGR 6090 Heterogeneous Computing Homework 0
// Problem 1 a - Vector Add on GPU
//Written by Aneri Sheth - 801085402
// Reference taken from Lecture Slides by Dr. Tabkhi
// Other references taken from - http://ecee.colorado.edu/~siewerts/extra/code/example_code_archive/a490dmis_code/CUDA/cuda_work/samples/0_Simple/... |
3,529 | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <functional>
#include <stdlib.h> /* srand, rand */
#include <time.h> /* time */
#include <chrono>
#include <list>
#include <cuda.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
using namespace std... |
3,530 | #include "includes.h"
__global__ void Fprop2(const float* layer1, const float* syn2, float* out, const int offset)
{
int i = blockDim.x*blockIdx.x + threadIdx.x; //4
//int j = blockIdx.x; //Data.count
int k = blockDim.y*blockIdx.y + threadIdx.y; //256
atomicAdd(&out[i], layer1[256*offset + k] * syn2[k*4 + i]);
} |
3,531 | #include <cmath>
#include <iostream>
#define N 25600
#define M 1024
using namespace std;
#define CHECK(value) { \
cudaError_t _m_cudaStat = value; \
if (_m_cudaStat != cudaSuccess) { \
... |
3,532 | #include <thrust/transform.h>
#include <thrust/inner_product.h>
#include <thrust/sequence.h>
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <thrust/functional.h>
#include <iostream>
#include <iterator>
#include <algorithm>
void saxpy_slow(float A, thrust::device_vector<float>& X, thrust::de... |
3,533 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
static cudaStream_t *streams;
// CUDA kernel to pause for at least num_cycle cycles
__global__ void sleep(int64_t num_cycles)
{
int64_t cycles = 0;
int64_t start = clock64();
while(cycles < num_cycles) {
cycles = clock64()... |
3,534 | #include <stdio.h>
#include <stdlib.h>
#define DATASIZE 64
__global__ void get_average(double *in, double *out, int width)
{
int id=threadIdx.x;
if(id==0||id==width-1)
{
out[id]=in[id];
}
else
{
out[id]=(in[id-1]+in[id]+in[id+1])/3;
... |
3,535 | //
// Created by smallflyfly on 2021/5/18.
//
#include <stdio.h>
#include <cuda_runtime.h>
int main(int argc, char **argv) {
int deviceCount = 0;
cudaError_t errorId = cudaGetDeviceCount(&deviceCount);
if (errorId != cudaSuccess) {
printf("cudaDeviceCount returned %d\n -> %s\n", (int)errorId, cuda... |
3,536 | /* CUDA finite difference wave equation solver, written by
* Jeff Amelang, 2012
*
* Modified by Kevin Yuh, 2013-14 */
#include <cstdio>
#include <cuda_runtime.h>
#include "Cuda1DFDWave_cuda.cuh"
/*
* Wave solver kernel.
*/
__global__
void
cudaWaveSolverKernel(const float *old_displacements,
... |
3,537 | #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 numElemPerThread = N / blockDim.x;
int k = threadIdx.x * numElemPerThread;
for (int i = k; i < k + numEl... |
3,538 | /*
* Compile with
* nvcc -arch=sm_11 bitonic_sort.cu
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
/* Every thread gets exactly one value in the unsorted array. */
#define THREADS 512 // 2^9
#define BLOCKS 128 // 2^15
#define NUM_VALS THREADS*BLOCKS
double getElapsedTime(clock_t start, clock_t stop... |
3,539 | __global__ void run_bidding(
const int num_nodes, float *data, int *person2item, float *bids, int *bidders, int *sbids, float *prices, float auction_eps){
int i = blockDim.x * blockIdx.x + threadIdx.x; // person index
if(i < num_nodes){
if(person2item[i] == -1) {
int fi... |
3,540 | /*
* CSE 5441 : Lab 4 part1
* Filename : biswas_rajarshi_part1.cu
* Author : Rajarshi Biswas (biswas.91@osu.edu)
* The Ohio State University.
*/
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <stdio.h>
using namespace std;
#define SIZE 1024
#define THREADS_X 32
#define THREADS_Y 3... |
3,541 | /***************************************************************************//**
* \file intermediateVelocity.cu
* \author Christopher Minar (minarc@oregonstate.edu)
* \brief kernels to generate the right hand side for the initial velocity solve
*/
#include "intermediateVelocity.h"
/**
* \namespace kernels
* \... |
3,542 | #include "includes.h"
__global__ void stretch_weights_kernel(const float *src_weight_gpu, float *weight_deform_gpu, int nweights, int n, int kernel_size, float scale, int reverse)
{
const int index = blockIdx.x*blockDim.x + threadIdx.x;
const int kernel_area = kernel_size * kernel_size;
const int i = index * kernel_ar... |
3,543 | #include <bits/stdc++.h>
using namespace std;
#define THREADS_PER_BLOCK 1024//1024
void initData(int* M, int rows, int cols){
for (int i=0; i<rows; i++){
for(int j=0; j<cols; j++){
M[cols * i + j] = 2;
}
}
}
void displayData(int *M, int rows, int cols){
for (int i=0; i<rows; i++){
for(int j=0; j<cols;... |
3,544 | #include "includes.h"
namespace ann {
// CUDA2
}
__global__ void kernel_feedforward( int layer_id, int *l, int *s, int *sw, float *z_arr, float *a_arr, float *w_arr ){
volatile int idx = threadIdx.x + blockDim.x*blockIdx.x;
int neuron_count = l[layer_id];
int neuron_count_prev = l[layer_id-1];
//printf... |
3,545 | #include "includes.h"
__global__ void WriteClockValues( unsigned int *completionTimes, unsigned int *threadIDs )
{
size_t globalBlock = blockIdx.x+blockDim.x*(blockIdx.y+blockDim.y*blockIdx.z);
size_t globalThread = threadIdx.x+blockDim.x*(threadIdx.y+blockDim.y*threadIdx.z);
size_t totalBlockSize = blockDim.x*blockDi... |
3,546 | #include <iostream>
#include <math.h>
#include <cstdint>
#include <time.h>
#include <cstdio>
#include <stdio.h>
#include <stdlib.h>
void cpuProcess(int n, double *arr){
double localMax = -1;
for (int i = 0; i < n; i ++){
if (arr[i] > localMax) localMax = arr[i];
}
arr[0] = localMax;
}... |
3,547 | #include <iostream>
#include <cuda.h>
#include <cuda_runtime.h>
#include<stdlib.h>
#include<stdio.h>
#define min(a,b) (a<b?a:b)
const int threadsPerBlock = 256;
int blocksPerGrid = 32;
__global__ void reduce(float *data, float *output, int N){
__shared__ float scratch[threadsPerBlock];
int global_index =... |
3,548 | #include "memory.h"
#define USE_CUDA_MEMALLOC 0
#define USE_WC 1
void memalloc_host(int imgWidthF, int imgHeightF, unsigned char **input,
int imgWidth, int imgHeight, unsigned char **output)
{
cudaError_t cuda_ret;
#if USE_CUDA_MEMALLOC == 0
*input = (unsigned char *)malloc(3*imgWidthF*imgHeight... |
3,549 | /*
# compile
$ nvcc -o matrix_dot_product matrix_dot_product.cu
# numpy counterpart
import numpy as np
m1 = np.array(((0, 1, 2), (3, 4, 5), (6, 7, 8)))
m2 = np.array(((3, 4), (5, 6), (7, 8)))
m1.dot(m2)
*/
#include <stdio.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cuda_runtime_api.h>
// kernel of pro... |
3,550 | #include <stdio.h>
#include <iostream>
#include <math.h>
__global__
void stream_triad(int n, int scalar, float *x, float *y, float *z)
{
int index = blockIdx.x * blockDim.x + threadIdx.x;
int stride = blockDim.x * gridDim.x;
for (int i = index; i < n; i += stride)
z[i] = scalar * x[i] + y[i];
}
int main(i... |
3,551 | #include <cuda_runtime.h>
__global__ void empty() {}
void benchmark_gpu_init() {
cudaFree(0);
empty<<<1,1>>>();
cudaDeviceSynchronize();
}
|
3,552 | #include "includes.h"
__global__ void add(int* in, int d, int n){
int gid = threadIdx.x + blockIdx.x * blockDim.x;
if(gid >= n) return ;
int pre = (d==0) ? 1 : (2<<(d-1));
if(gid >= pre) {
in[gid] += in[gid-pre];
}
} |
3,553 | /*
nvcc flagg.cu -o flagg
file = open("noise.bin", "wb");
file.write(np.random.normal(0.,10.,2000000,dtype=np.float32));
file.close()
*/
#include <iostream>
#include <math.h>
#define NCHANS 1000 // # of channels -- assume no more than 2048 channels for now, see blinest call in main{}
#define NANTS 2000 // # of anten... |
3,554 | #include <stdio.h>
__global__
void transposeReadRow(float* out, float* in, int rowCount, int columnCount) {
int idx = (blockIdx.x * blockDim.x) + threadIdx.x;
int idy = (blockIdx.y * blockDim.y) + threadIdx.y;
if (idx < columnCount && idy < rowCount) {
out[idx*columnCount+idy] = in[idy*rowCount+idx];
}
}
__glo... |
3,555 | /**
File name: graph_to_csr.cu
Author: Yuede Ji
Last update: 15:52 10-09-2015
Description: convert current normal graph file to scr and begin position stored file
**/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 65536 // vertex number
//Using arrays to implement queue
/**
char filein[] = "... |
3,556 | /* CSCI 563 Programming Assignment 2
Clayton Kramp
*/
#include <iostream>
#include <fstream>
using namespace std;
// Main Device Function to be used to count number of ones
__global__ void countOnes(int* A, int* count, int row, int col) {
int j = blockIdx.x * blockDim.x + threadIdx.x;
int i = blockIdx.y ... |
3,557 | #include "includes.h"
__global__ void unmarshalling(int *input_itemsets, int *tmp, int max_rows, int max_cols)
{
int i, j;
i = blockIdx.y*blockDim.y+threadIdx.y;
j = blockIdx.x*blockDim.x+threadIdx.x;
if( i >= max_rows || j >= max_cols) return;
if( (i+j) < max_rows) {
input_itemsets[i*max_cols+j] = tmp[(i+j)*max_col... |
3,558 | #include "includes.h"
__global__ void shiftRightPixels(int16_t *bayImg, size_t width, size_t height, int bppMult)
{
int2 pixelCoord = make_int2(blockIdx.x * blockDim.x + threadIdx.x, blockIdx.y * blockDim.y + threadIdx.y);
if (pixelCoord.x < width && pixelCoord.y < height)
{
bayImg[pixelCoord.y * width + pixelCoord.x]... |
3,559 | //
// Created by Sowmya Parameshwara on 11/10/16.
//
/**
*
* 1) Input is stored by transposing the matrix, so that the attributes of a column are stored in a single row. This
* will optimise the algorithm since all threads in a block will access nearby elements, while normalising.
* 2) Each row is normalise... |
3,560 | #include <cuda_runtime.h>
#include <stdio.h>
#include <assert.h>
#define ROUND8_(x) (((x)+7)&~7)
#define panic(fmt, ...) { printf(fmt, __VA_ARGS__); asm("trap;"); }
#ifdef __cplusplus
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#else
#define __BEGIN_DECLS
#define __END_DECLS
#endif
__BEGIN_DECLS;
#ifnd... |
3,561 | #include <stdio.h>
#include <stdexcept>
#include <algorithm>
#include <cuda_runtime.h>
#include <iostream>
#include <vector>
#include <stdlib.h>
#include <time.h>
void saxpySerial(int n, float alpha, float *x, float *y) {
for ( int i = 0 ; i<n ; ++i ){
y[i] = alpha*x[i] + y[i];
}
}
__global__
void s... |
3,562 | /**
* @file processQuatJulEle_linux.cu
*
* Calculate julia sets for quaternions.
*
*/
/** Work out which piece of the global array this thread should operate on */
__device__ size_t calculateGlobalIndex() {
// Which block are we?
size_t const globalBlockIndex = blockIdx.x + blockIdx.y * gridDim.x;
... |
3,563 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include<iostream>
using namespace std;
int main()
{
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, 0);
printf("Device name:%s\n", deviceProp.name);
printf("Multiprocessor count:%d\n", deviceProp.multiProcessorCoun... |
3,564 |
// Babak Poursartip
// 09/15/2020
// udemy CUDA
//
#include <cstdio>
// =================================
__global__ void func(){
}
// =================================
int main(){
printf(" starts ... \n");
cudaDeviceReset();
printf(" finished. \n");
return 0;
}
|
3,565 | #include "includes.h"
__global__ void kernel( void ) {
} |
3,566 |
#ifndef __CUDACC__
#define __CUDACC__
#endif
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <cuda.h>
#include <device_functions.h>
#include <cuda_runtime_api.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include <string.h>
#define WEI 11
#define ITEN 5
void inserirPeso(int vet[]... |
3,567 | #include "includes.h"
__global__ void matrix_multiply_tiling_cuda(int* A, int* B, int* C, int m, int n) {
// Block index
int bx = blockIdx.x;
int by = blockIdx.y;
// Thread index
int tx = threadIdx.x;
int ty = threadIdx.y;
// Index of the first sub-matrix of A processed by the block
int aBegin = n * blockDim.y * by;
... |
3,568 | // Corresponding header file: /include/square_ops.h
#include <cuda_runtime.h>
#include <float.h>
float *d_x, *d_y, *d_logY;
__global__
void separateChannels(const uchar4* const inputImageRGBA,
int numRows,
int numCols,
float* const redChannel,
... |
3,569 | #include "cuda_runtime.h"
#include <stdio.h>
#include <time.h>
const int Row = 2 * 2;
const int Col = 2 * 2;
//2维网格2维线程块 最常用
__global__ void VectorAdd(float** a, float** b, float** c) {
int thread_x_id = blockIdx.x * blockDim.x + threadIdx.x; //x是线程块的x做行 线程的x做列
int thread_y_id = blockIdx.y * blockDim.y + t... |
3,570 | #include <stdio.h>
#include "cuda.h"
#include <assert.h>
#define N 2 //16
__device__ int bar(int x) {
return x + 1;
}
__global__ void foo(int *A) {
A[threadIdx.x] = bar(threadIdx.x);
}
|
3,571 | #include <math.h>
#include <stdio.h>
#include <cuda_runtime.h>
#define f_(i,j) f_[(i) + (j)*(m)]
#define Z(i,j) Z[(i) + (j)*m]
__constant__ float s_H[121];
//B is a partition of the images with dimensions thread number + patchSize
//A our extended array with padding
__global__ void Zcalc(float const * const A,f... |
3,572 | // m0 m1 m2
// m3 m4 m5
// m6 m7 m8
__global__ void sfilter(float *src, float *dst, long ldc,
float m0, float m1, float m2, float m3, float m4, float m5, float m6, float m7, float m8)
{
long x = blockIdx.x;
long y = blockIdx.y;
float i0 = src[(x-1)+(y-1)*ldc]*m0;
float i1 = src[(x) +(y-1)*ldc]*m1;
float... |
3,573 |
#include "main.cuh"
#include <stdio.h>
void test(){
printf("\n");
} |
3,574 |
#include <stdio.h>
const int N = 128;
const int blocksize = 2;
__global__
void matrix_add(float *a, float *b, float* c)
{
int y = (blockIdx.x * blockDim.x + threadIdx.x);
int x = (blockIdx.y * blockDim.y + threadIdx.y);
int offset = x + (y * N);
//printf("x: %d, y: %d \n", x, y);
c[offset] = a[offset]+b[... |
3,575 | #include <cstdio>
#include <string>
#include <cassert>
#include <iostream>
#include <cstddef>
#include <vector>
#include <thrust/device_vector.h>
#include <thrust/extrema.h>
#include <limits>
using namespace std;
#define int8_t char
#define int16_t short
#define int32_t int
#define int64_t long long... |
3,576 | #include "Utils.cuh"
#include "cp4Conv2d.cuh"
#include "cp4Conv2dBackwardData.cuh"
#include "cp4Conv2dBackwardFilter.cuh"
#include "cp4Conv2dForward.cuh"
#include <iostream>
#include <stdlib.h>
using namespace std;
/*******************************************************************************
* Unified memory Tens... |
3,577 | /*
* vim: ts=8:sw=8:tw=79:noet
*
* Copyright (c) 2013, Colin Patrick McCabe
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyr... |
3,578 | #include <iostream>
__global__ void normal(int *a, int *b, int *c, int len)
{
int myrow = blockIdx.x;
__shared__ int smem[256];
while(myrow <len)
{
for (int i = 0; i < len; i ++)//which col of right matrix
{
int tid = threadIdx.x;
int res = 0;
while( tid < len ) // vector vector multiplication
{
... |
3,579 | #include <cuda_runtime.h>
#include <device_launch_parameters.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
__global__ void sinw(float *a, float *b) {
int i = blockIdx.x;
b[i]=sinf(a[i]);
}
int main(void)
{
int MAX = 10;
float a[MAX], b[MAX];
float *d_a, *d_b;
int size = sizeof(int)*MAX;
cudaMall... |
3,580 | #include <stdio.h>
#include <cuda_runtime.h>
#include <iostream>
#include <fstream>
int main(int argc,char **argv)
{
std::ofstream myfile;
myfile.open ("seq_reduce.csv");
const unsigned int times = 10;
for (unsigned int i = 0; i<30; i++)
{
const unsigned int IN_SIZE = 1<<i;
const un... |
3,581 | #include "includes.h"
__global__ void gpu_distance(int* data, float* distance, int* point, int n, int dim) {
int i = blockIdx.x * blockDim.x + threadIdx.x;
if (i >= n)
return;
float d = 0;
for(int j = 0; j<dim; j++)
d += abs(data[i*dim + j] - point[j]);
distance[i] = d;
} |
3,582 | #include <stdio.h>
#include <math.h>
#define N 2047
#define T 1024
__global__ void vecAdd(int *a, int *b, int *c);
int main() {
int *a, *b, *c;
int *d_a, *d_b, *d_c;
// initialize a and b with real values (NOT SHOWN)
int size = N * sizeof(int);
cudaMalloc((void**)&d_a, size);
cu... |
3,583 | #include "ParamsCarrier.cuh"
ParamsCarrier* ParamsCarrier::INSTANCE;
ParamsCarrier::ParamsCarrier(){
} |
3,584 | #include <math.h>
#include <stdio.h>
// Array access macros
#define b(i,j) B[(i) + (j)*m*m]
__global__ void Denoising(double *I,double *B, int m, int n, int patchSize, double filtSigma) {
// Get pixel (x,y) in input
// I: image as a vector
// B: neighborCube
int i = blockIdx.x * blockD... |
3,585 | #include <stdio.h>
#include <cuda.h>
class A {
public:
__host__ __device__ A(unsigned ongpu = 1) { printf("in A's constructor: on %s.\n", (ongpu ? "GPU" : "CPU")); }
};
__global__ void dkernel(unsigned n) {
A a;
//printf("in dkernel %d\n", blockIdx.x * blockDim.x + threadIdx.x);
}
#define BLOCKSIZE 32
int main() {... |
3,586 | #include "includes.h"
__global__ void ConvolutionColGPU(float *d_Dst,float *d_Src,float *d_Filter,int filterR){
int x =threadIdx.x;
int y =threadIdx.y;
float sum=0;
for (int k = -filterR; k <= filterR; k++) {
int d = y + k;
if (d >= 0 && d < blockDim.y) {
sum += d_Src[d * blockDim.x + x] * d_Filter[filterR - k];
}
... |
3,587 | #include <cuda.h>
__global__ void kernel() {}
extern "C" void cuda_kernel() { kernel<<<1, 1>>>(); }
|
3,588 | #include <iostream>
using namespace std;
__global__
void lambdaTestKernel(int *num)
{
auto func = [&] () { *num = 5; };
func();
}
void testDevice()
{
int num = 0;
int *d_num;
cudaMalloc(&d_num, sizeof(int));
cudaMemcpy(d_num, &num, sizeof(int), cudaMemcpyHostToDevice);
lambdaTestKer... |
3,589 | #include<stdio.h>
#include<cuda.h>
#include<math.h>
#include<sys/time.h>
__global__
void Matadd(char* A,int N)
{
}
int main()
{
for(int j=0;j<=30;j++)
{
cudaEvent_t start1,stop1;
float time1;
int i;
int N = pow(2,j);
size_t size = N;
printf ("\n The value of N... |
3,590 | #include <stdio.h>
#include <sys/time.h>
#define SAMPLE_TEST_LEN 2048
#define SCALER 4096
#define LUT_SIZE 1024
__device__
short lut_sigmoid[LUT_SIZE] = {
2048,2056,2064,2072,2080,2088,2096,2104,
2112,2120,2128,2136,2144,2152,2160,2168,
2176,2184,2192,2200,2208,2216,2224,2232,
2239,2247,2255,2263,2271... |
3,591 | #include<stdio.h>
#include<sys/time.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
//----------------------------------- Structures and Globals---------------------------------------------
typedef struct {
int width;
int height;
} ArrayMetadata2D;
// metadata variables describing dimensionalities ... |
3,592 | #include "includes.h"
#define RED 2
#define GREEN 1
#define BLUE 0
using namespace std;
extern "C"
__global__ void img2gray(unsigned char *imageInput, int width, int height, unsigned char *imageOutput){
int row = blockIdx.y*blockDim.y+threadIdx.y;
int col = blockIdx.x*blockDim.x+threadIdx.x;
if((row < height) && (... |
3,593 | /*
Implementing Sparse Matrix Vector multiplication (SpMV) in CUDA with one thread per row.
The matrix uses a Compressed Sparse Row (CSR) representation.
*/
#include <stdio.h>
#define MATRIX_SIZE 4
#define NON_ZERO_ELEMENTS 6
#define NUM_BLOCKS 2
#define NUM_THREADS 2
void print_vector(int* array){
for(unsigned ... |
3,594 | #include "includes.h"
/*
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GT 320M"
CUDA Driver Version / Runtime Version 5.0 / 5.0
CUDA Capability Major/Minor version number: 1.2
Total amount of global memory: 1024 MBytes (1073741824 bytes)
( 3) Multiprocessors x ( 8) CUDA Cores/MP: ... |
3,595 | // ----------------------------------------------------------------------------
// CUDA code to compute minimun distance between n points
//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits>
#include <float.h>
#define MAX_POINTS 1048576
// ----------------------------------... |
3,596 | ////////////////////////////////////////////////////////////////////////////////
// Set Device
////////////////////////////////////////////////////////////////////////////////
void setdevice(void){
// variables
int num_devices;
int device;
cudaGetDeviceCount(&num_devices);
if (num_devices > 1) {
// variabl... |
3,597 | /*
* JCuda - Java bindings for NVIDIA CUDA driver and runtime API
* http://www.jcuda.org
*
*
* This code is based on the NVIDIA 'reduction' CUDA sample,
* Copyright 1993-2010 NVIDIA Corporation.
*/
#include <math.h>
extern "C"
__global__ void normalize(double *g_idata, double *g_odata, unsigned int n, int ma... |
3,598 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
void query_device() {
int deviceCount = 0;
cudaGetDeviceCount(&deviceCount);
if (deviceCount == 0)
printf("No CUDA support devices found!\n");
for (int devNo = 0; devNo < deviceCount; devNo++) {
cudaDeviceProp iProp;... |
3,599 | /* datatools.c - support functions for the matrix examples
*/
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
// Using single indexed arrays
void init_matrix(int m, int n, double *A, double value) {
int i, j;
for (i = 0; i < m; i++)
for (j = 0; j < n; j++) {
A[i * n + j] =... |
3,600 | #include <stdio.h>
#define N 578 // size of vectors
#define T 275 //number of threads per block
//Need to show array of a and b
__global__ void vecAdd(int *A ,int *B,int *C){
int i = blockIdx.x * blockDim.x + threadIdx.x;
if (i < N)
C[i] = A[i] + B[i];
}
int main(int argc, char *argv[]){
int b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.