serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
19,001 | #include "includes.h"
__global__ void merge(unsigned char * img_all, unsigned char * img, float * selection, int n, int stride)
{
int x = blockIdx.x * TILE_DIM + threadIdx.x;
int y = blockIdx.y * TILE_DIM + threadIdx.y;
int width = gridDim.x * TILE_DIM;
int idx = 0;
float sum = 0;
float weight = 0;
for (int j = 0; j < ... |
19,002 | #include <float.h>
#include <cstdlib>
#include "../device/device.cu"
// __global__ void
// reduce0(float* g_idata,float* g_odata, unsigned int n) {
// extern __shared__ float temp[];
// int thid = threadIdx.x;
// temp[thid] = g_idata[thid];
// __syncthreads();
// for(int offset = 1;offset < n; offs... |
19,003 | #include "includes.h"
__global__ void kernel_fill(float4* d_dx1, float val, int numel) {
size_t col = threadIdx.x + blockIdx.x * blockDim.x;
if (col >= numel) { return; }
d_dx1[col].x = val;
d_dx1[col].y = val;
d_dx1[col].z = val;
d_dx1[col].w = val;
} |
19,004 | #include "includes.h"
#define UMUL(a, b) ( (a) * (b) )
#define UMAD(a, b, c) ( UMUL((a), (b)) + (c) )
typedef unsigned int uint;
typedef unsigned short ushort;
typedef unsigned char uchar;
#define SHARED_MEMORY_SIZE 49152
#define MERGE_THREADBLOCK_SIZE 128
static uint *d_PartialHistograms;
/*
* Function that maps... |
19,005 | #include "CommonDataStructure.cuh"
#pragma region GraphStructure_Part
GraphStructure::GraphStructure()
{
vertexNum = 0;
adjList.clear();
}
GraphStructure::GraphStructure(int num)
{
vertexNum = 0;
adjList.clear();
ReserveSpace(num);
}
GraphStructure::~GraphStructure()
{
}
void GraphStructure::ReserveSpace(int... |
19,006 |
/* check-thread-index.cu */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cuda_runtime.h>
#define CHECK_CUDA_CALL(call) \
{ \
const cudaError_t error = call; \
\
if (error != cudaSuccess) { \
fprintf(stderr, "Error (%s:%d), code: %d, reason: %s\n", \
... |
19,007 | #include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
#include <sys/mman.h>
static void HandleError( cudaError_t err, const char *file, int line ) {
if (err != cudaSuccess) {
printf( "%s in %s at line %d\n", c... |
19,008 | #include "includes.h"
__global__ void erosionRows3DKernel ( unsigned short *d_dst, unsigned short *d_src, int w, int h, int d, int kernel_radius )
{
__shared__ unsigned short smem[ER_ROWS_BLOCKDIM_Z][ER_ROWS_BLOCKDIM_Y][(ER_ROWS_RESULT_STEPS + 2 * ER_ROWS_HALO_STEPS) * ER_ROWS_BLOCKDIM_X];
unsigned short *smem_thread =... |
19,009 | #include <curand.h>
#include <curand_kernel.h>
#define DIM 1600
#define PI 3.14159265
__global__ void erode(unsigned char *R_input, unsigned char *G_input,
unsigned char *B_input, size_t i_size,
unsigned char *r_dataC, unsigned char *g_dataC,
uns... |
19,010 | #include <stdio.h>
#include <math.h>
#include <cuda.h>
// void Radix(int* array, int array_size, int max_digit); /* Thread function */
__host__ void rng(int* arr, int n); /* Seed function */
__host__ int max_el(int * vec, int n);
__host__ int num_digit(int el);
__device__ int to_digit(int el, int divider);
__host__ int... |
19,011 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <string>
#include <stdio.h>
static const int DIM = 128;
static const int NODES = DIM * DIM;
static const double L = 1.0 * NODES;
static const double TIME_OVERALL = 30.0; // second... |
19,012 | #include <stdio.h>
#include <stdlib.h>
#include "cuda_runtime.h"
// Defines
#define GridWidth 60
#define BlockWidth 128
// Variables for host and device vectors.
__global__ void AddVectors(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]... |
19,013 | #include "includes.h"
//Bibliotecas Basicas
//Biblioteca Thrust
//Biblioteca cuRAND
//PARAMETROS GLOBAIS
const int QUANT_PAIS_AVALIA = 4;
int POP_TAM = 200;
int N_CIDADES = 20;
int BLOCKSIZE = 1024;
int TOTALTHREADS = 2048;
int N_GERA = 100;
const int MUT = 10;
const int MAX = 19;
const int MIN = 0;
const int ELI... |
19,014 | #include "includes.h"
__global__ void sobelEdgeDetectionSharedMemUnrollCoalsed(int *input, int *output, int width, int height, int thresh) {
__shared__ int shMem[4 * _TILESIZE_2 * _TILESIZE_2 ];
int num = _UNROLL_;
int size = num * _TILESIZE_2;
int i = blockIdx.x * (num * _TILESIZE_) + threadIdx.x;
int j = blockIdx.... |
19,015 | #include "includes.h"
__global__ void box_iou_cuda_kernel(float * box_iou, float4 * box1, float4 * box2, long M, long N, int idxJump) {
int idx = blockIdx.x*blockDim.x + threadIdx.x;
size_t b1_idx, b2_idx, b1_row_offset, b2_row_offset;
float xmin1, xmin2, xmax1, xmax2, ymin1, ymin2, ymax1, ymax2, x_tl, y_tl, x_br, y_b... |
19,016 | float h_A[]= {
0.7213110389323074, 0.7036072892760992, 0.7972208480899733, 0.5153771118746243, 0.9216180039321551, 0.9615308379788774, 0.6739112073326918, 0.7155256159701121, 0.79258098175816, 0.9020993892924711, 0.8466942281531666, 0.5537511206889679, 0.5438491782768006, 0.7116611841848426, 0.5345733881172183, 0.63054... |
19,017 | /**
* @author Eddie Davis (eddiedavis@u.boisestate.edu)
* @author Jeff Pope (jeffreymithoug@u.boisestate.edu)
* @file mandelbrot.cu
* @brief CS530 PA4: Mandelbrot-CUDA Impementation
* @date 12/4/2016
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <cud... |
19,018 |
#include <cstdio>
#include "kernel.cuh"
__global__ void matmul_basic(const float* A, const float* B, float* C, const int len) {
int i = blockIdx.y * blockDim.y + threadIdx.y;
int j = blockIdx.x * blockDim.x + threadIdx.x;
if (i<len&&j<len) {
float sum=0;
for (int k=0; k<len; k++) {
... |
19,019 | #include <iostream>
#include <thrust/device_vector.h>
#include <thrust/execution_policy.h>
#include <thrust/host_vector.h>
#include <thrust/scan.h>
using namespace std;
int main(int argc, const char *argv[]) {
string N;
if (argc > 1) {
N = string(argv[1]);
}
unsigned int n = atoi(N.c_str());
thrust::host... |
19,020 | #include <stdio.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cuda_runtime_api.h>
#include <algorithm>
#include <cstring> //memset
#define MAX_INT_BITS 32
#define checkCudaErrors(call) \
{ ... |
19,021 | /*
#include "patchBasedObject.cuh"
template <typename T>
__host__ void PatchBasedObject<T>::generateSuperpixels(uint2 & pbbsize, uint2 & stride)
{
int spx_sz = 0; // initialize the superpixel size
float noLabels = 2; // control number of superpixels using-> (int)(noLabels * sqrt( [width * height] /2 )) ;
... |
19,022 | // a cuda app. we will convert this to opencl, and run it :-)
#include <iostream>
#include <memory>
#include <cassert>
using namespace std;
#include <cuda_runtime.h>
__global__ void setValue(char *data, int idx, char value) {
if(threadIdx.x == 0) {
data[idx] = value;
// data[idx] = 15;
}
}
... |
19,023 | #include "includes.h"
__global__ void differenceImg(float *d_Octave0,float *d_Octave1,float *d_diffOctave,int pitch,int height){
int x = blockIdx.x*blockDim.x+threadIdx.x;
int y = blockIdx.y*blockDim.y+threadIdx.y;
int index = y * pitch + x;
if(y<height)
d_diffOctave[index] = (d_Octave1[index] - d_Octave0[index]);
} |
19,024 | #include "includes.h"
#define BLOCK_SIZE 16
#define BLOCKSIZE_X 16
#define BLOCKSIZE_Y 16
// STD includes
// CUDA runtime
// Utilities and system includes
static // Print device properties
__global__ void writeChannelKernel( unsigned char* image, unsigned char* channel, int imageW, int imageH, int channelToMerge... |
19,025 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include<stdio.h>
__global__ void unique_grid_id_calculation_2d_2d(int* data)
{
int thread_id = blockDim.x * threadIdx.y + threadIdx.x;
int num_threads_in_a_block = blockDim.x * blockDim.y;
int block_offset = blockIdx.x * num_threads_in_a_block;
int... |
19,026 | #include "includes.h"
__global__ void softmax_trivial(float* softmaxP, float* b, int rows, int cols){
int tid = threadIdx.x;
int bid = blockIdx.x;
float _max = -100000000.0;
float sum = 0.0;
if(tid * cols + bid < rows * cols){
for(int i = 0 ; i < rows ; i++) _max = max(_max, b[i * cols + bid]);
for(int i = 0 ; i < ro... |
19,027 | #include "includes.h"
__global__ void LessThan(float * xf, bool * xb, size_t idxf, size_t idxb, size_t N)
{
for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < N; i += blockDim.x * gridDim.x)
{
//printf("From less than %f %f %d \n", xf[(idxf-1)*N+i], xf[(idxf-2)*N+i], xf[(idxf-1)*N+i] < xf[(idxf-2)*N+i]);
xb[idxb*N... |
19,028 | #include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
#include <string.h>
#define DATA_LENGTH 100
#define CUDA_CALL(X) X; // {if(cudaError == X){printf("Error Calling %s at line %s\n", #X, __LINE__);}}
float * genInput(int l);
void verify(float *a, float *b, float *c, int l);
__global__ v... |
19,029 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cuda.h>
// CUDA kernel. Cada thread ejecuta la operación sobrte un elemencto de c
__global__ void vecAdd(double *a, double *b, double *c, int n)
{
// Obtención del Id global
int id = blockIdx.x*blockDim.x+threadIdx.x;
// Nos aseguramos de... |
19,030 | /*
* CUDA kernel for convolution in 2D, corresponding to conv2 in Matlab
* Sofie Lovdal 5.6.2018
*/
__global__ void conv2(double * output, double * const input, unsigned int const numRows,
unsigned int const numCols, double * const kernel,
unsigned int const height_kernel, unsigned int const width_kerne... |
19,031 | /*
*
* Last name: Will
* First name: Peter
* Net ID: pcw276
*
*/
#include <cuda.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <curand.h>
#include <curand_kernel.h>
#include <math.h>
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#define N_WALKERS 1000
#define MAX_THETA_SIZ... |
19,032 |
// Babak Poursartip
// 09/14/2020
// Udemy Cuda
// unique index calculation
#include <cstdio>
// ===========================================
// 2d grid, 2d block
__global__ void unique_gid_calculation_3d_3d(int *input) {
int threadsPerBlock = blockDim.x * blockDim.y * blockDim.z;
int threadPositionInBlo... |
19,033 | #include "includes.h"
__global__ void kernel(unsigned int rows, unsigned int cols , float* ddata,float* vdata ,float *results){
/* unsigned char y;
int m, n ;
unsigned int p = 0 ;
int cases[3];
int controls[3];
int tot_cases = 1;
int tot_controls= 1;
int total = 1;
float chisquare = 0.0f;
float exp[3];
float Conexpec... |
19,034 | #include <cmath>
#include <cstdio>
#include <iostream>
#include "sobel.cuh"
using namespace std;
__global__ void conv_kernel_no_shmem(const float* image, const float* mask, float* output, unsigned int r, unsigned int c) {
int tidx = threadIdx.x, tidy = threadIdx.y;
int bidx = blockIdx.x, bidy = blockIdx.y;
int bdy... |
19,035 | // includes, system
#include <stdio.h>
using namespace std;
#include <float.h>
#include <sys/stat.h>
#include <limits>
//#include "cuPrintf.cu"
// includes CUDA
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
// includes, project
//#include <helper_cuda.h>
//#include <helper_functions.h> //... |
19,036 | #include "includes.h"
__global__ void group_point_grad_gpu(int b, int n, int c, int m, int nsample, const float *grad_out, const int *idx, float *grad_points) {
int index = threadIdx.x;
idx += m*nsample*index;
grad_out += m*nsample*c*index;
grad_points += n*c*index;
for (int j=0;j<m;++j) {
for (int k=0;k<nsample;++k) ... |
19,037 | #include "includes.h"
__global__ void OPT_4(int *d_adjList, int *d_sizeAdj, int *d_lcmMatrix, int *d_LCMSize, int n_vertices)
{
int i = threadIdx.x + blockDim.x * blockIdx.x;
if(i<n_vertices)
{
int indexUsed = 0, indexOffset = 0;
int iStart = 0, iEnd = 0;
int k = 0;
if(i > 0)
{
k = d_sizeAdj[i-1];
indexOffset = d_LCMS... |
19,038 |
#include<iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
__global__ void kernel( float* r_gpu, float* g_gpu, float* b_gpu, int N, int n_m) {
int tId = threadIdx.x + blockIdx.x * blockDim.x;
int i=n_m;
while(i < N && tId < n_m) {
r_gpu[tId] += r_gpu[t... |
19,039 | /*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.75
Copyright (C) 2022 GOMC Group
A copy of the MIT License can be found in License.txt
along with this program, also can be found at <https://opensource.org/licenses/MIT>.
********************************... |
19,040 |
__device__ int findRoot(const int equivalenceMatrix[], int elementIndex){
while(equivalenceMatrix[elementIndex] != elementIndex)
elementIndex = equivalenceMatrix[elementIndex];
return elementIndex;
}
__global__ void finalUpdate(const int* input, int* output, const int height, const int width){
... |
19,041 | #include <stdio.h>
__global__ void helloFromGPU() {
printf("Hello World from GPU! %d %d\n", threadIdx.x, blockIdx.x);
}
int main(int argc, char**argv) {
printf("Hello World from CPU!\n");
int blocks = 1024;
int threads = 1;
helloFromGPU<<<blocks, threads>>>();
cudaDeviceReset();
return 0;
}
|
19,042 | // Copyright (c) 2018 John Biddiscombe
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include "cuda_runtime.h"
__global__
void saxpy(int n, float a, float *x, float *y)
{
int i = blockIdx.x * blockDim.... |
19,043 | #include "Descriptor.cuh"
Descriptor::Descriptor(int32_t size, int32_t type, bool normalized, int32_t stride, int32_t pointer) : size(size), type(type), normalized(normalized), stride(stride), pointer(pointer)
{
} |
19,044 | /*
* hw04p02.cu
*
* Created on: Oct 04, 2015
* Author: Kazi
* Usage:
* It performs integer multiplication of a 16x32 matrix with a 32x1 vector
* on a GPU. Does not take any arguments. Just generates predefined matrices
* and reports the time taken to do the multiplication.
*/
#include <stdio.h>
#inclu... |
19,045 | /**
* University of Pittsburgh
* Department of Computer Science
* CS1645: Introduction to HPC Systems
* Instructor: Xiaolong Cui
* This is a skeleton for implementing prefix sum using GPU, inspired
* by nvidia course of similar name.
*/
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#incl... |
19,046 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cufft.h>
typedef float2 CComplex;
typedef double2 ZComplex;
template<typename T>
static __device__ __host__ inline T operator+(const T a, const T b);
template<typename T>
static __device__ __host__ inline T operator*(const T a, const T b);
// Complex... |
19,047 | #include "includes.h"
__global__ void suma(int a, int b, int *c){
*c = a+b;
} |
19,048 | #include "includes.h"
__global__ void cu_relu(const float* src, float* dst, int n){
int tid = threadIdx.x + blockIdx.x * blockDim.x;
int stride = blockDim.x * gridDim.x;
while(tid < n){
if(src[tid] > 0.0) dst[tid] = src[tid];
else dst[tid] = 0.0;
tid += stride;
}
} |
19,049 | #include <cstdio>
#include <cstdlib>
#include <math.h>
// Assertion to check for errors
#define CUDA_SAFE_CALL(ans) { gpuAssert((ans), __FILE__, __LINE__); }
inline void gpuAssert(cudaError_t code, char *file, int line, bool abort=true)
{
if (code != cudaSuccess)
{
fprintf(stderr,"CUDA_SAFE_CALL: %s %s %d\n", cuda... |
19,050 | //source: https://github.com/lzhengchun/matrix-cuda/blob/master/matrix_cuda.cu
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <assert.h>
#define TYPE float
#define TILE_DIM 32
/*
Returns the current time in miliseconds.
*/
double getMilitime(){
struct timeval ret;
gettimeofday... |
19,051 | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <cuda_runtime_api.h>
#define restrict __restrict__
#define PADDINGCLASS -2
#define OUTPUT_FILE "ocuda"
#define INPUT_FILE "data"
#define KMAX 20
#define CLASSESMAX 100
void check_error(cudaError_t err, const char *msg);
void printStats(cudaEvent_t befor... |
19,052 | #include <stdio.h>
#include <stdlib.h>
__global__ void multAdd(float *d_in, float *d_out)
{
int idx = blockIdx.x * blockDim.x + threadIdx.x;
int f = d_in[idx];
d_out[idx] = ((2*f) + 1);
}
int main(int argc, char** argv)
{
int ARRAY_SIZE = 128;
int ARRAY_MEM = ARRAY_SIZE*sizeof(float);
float*... |
19,053 | #include "includes.h"
__global__ void dirtyFixWindowsVarScaleKernel( float *xMin, float *xMax, float *yMin, float *yMax, const int size, const float h, const float w, const float minWidth) {
int idx = BLOCK_SIZE * BLOCK_SIZE * blockIdx.x + threadIdx.x;
if (idx < 2*size) {
float paramMin, paramMax;
if (idx < size) {
... |
19,054 |
extern "C" __global__
void histgramMakerKernel_SharedMemAtomics(int *d_histgram,
const unsigned char *d_text, int textLength) {
__shared__ int sh_histgram[256];
for (int histPos = threadIdx.x; histPos < 256; histPos += blockDim.x)
sh_histgram[histPos] = 0;
__syncthreads();
int stride = gri... |
19,055 | #include <stdio.h>
#include <curand_kernel.h>
#include <curand.h>
// Adapted from
// https://stackoverflow.com/questions/26650391/generate-random-number-within-a-function-with-curand-without-preallocation
__global__ void myfunc(double *vals, size_t n) {
int tId = threadIdx.x + (blockIdx.x * blockDim.x);
curand... |
19,056 | #include <iostream>
#include <assert.h>
// Here you can set the device ID that was assigned to you
#define MYDEVICE 0
// Simple utility function to check for CUDA runtime errors
void checkCUDAError(const char *msg);
// Part 2 of 4: implement the kernel
__global__ void kernel( int *a, int dimx, int dimy )
{
dim3 in... |
19,057 | #include<bits/stdc++.h>
using namespace std;
#define pi (2.0*acos(0.0))
#define eps 1e-6
#define ll long long
#define inf (1<<29)
#define vi vector<int>
#define vll vector<ll>
#define sc(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin() , v.end()
#define me(a,val) memset( a , val ,sizeof(a) )
#... |
19,058 | #include "includes.h"
__device__ inline float stableLogit(float x) {
if(x >= 0) {
float z = expf(-x);
return 1.0 / (1.0 + z);
} else {
float z = expf(x);
return z / (1.0 + z);
}
}
__global__ void gLSTMCellBackward(float* outCell, float* outXW, float* outSU, float* outB, const float* cell, const float* xW, const float* ... |
19,059 | #include <iostream>
#include <numeric>
#include <stdlib.h>
#include <stdio.h>
#include<thrust/scan.h>
/*
Somethings so confuse me, why i can't get same correct result every time.
*/
/*
These two kernel could be used on large array, but slow
Best advice: use __syncthreads() before you want to use different index
*/
__... |
19,060 | /*
Simple Monte Carlo Pi Simulation using CUDA Primatives
*/
#include <curand.h>
#include <iostream>
#include <iomanip>
__device__ int total_device_points{};
__global__ void measure_points(const float* random_x,
const float* random_y)
{
const int i = blockIdx.x * blockDim.x + threadIdx.x;
const float x = random_x... |
19,061 | #include "conv2d-transpose-input-grad.hh"
#include "graph.hh"
#include "../runtime/graph.hh"
#include "../runtime/node.hh"
#include "../memory/alloc.hh"
namespace ops
{
Conv2DTransposeInputGrad::Conv2DTransposeInputGrad(Op* y, Op* kernel,
const int strides[], const int input_si... |
19,062 | //******************************************************************************
//
// File: ModCubRoot.cu
//
// Version: 1.0
//******************************************************************************
// Number of threads per block.
#define NT 1024
// Overall counter variable in global memory.
__device__ un... |
19,063 | //
// Created by Peter Rigole on 2019-03-08.
//
#include "Managed.cuh"
__host__
void *Managed::operator new(size_t len) {
void *ptr;
cudaMallocManaged(&ptr, len);
return ptr;
}
__host__
void Managed::operator delete(void *ptr) {
cudaFree(ptr);
}
|
19,064 | #include <iostream>
#include <random>
#include <iomanip>
#include <cuda.h>
#define MASK_DIM_SIZE 10 // Number of elements for one spacial dimension
#define TILE_SIZE 16
__constant__ float d_mask[MASK_DIM_SIZE * MASK_DIM_SIZE];
/*---------------------------------------------------------------------------------------... |
19,065 | #include <array>
#include <cassert>
#include <chrono>
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
float lb = 0;
float ub = 2;
const int nx = 41;
const int ny = 41;
int nt = 500;
int nit = 50;
int c = 1;
float dx = ub / float(nx - 1);
float dy = ub / float(ny - 1);
float rho = 1;
floa... |
19,066 | #include <cuda.h>
#include <stdio.h>
#define N 32
void printMatrix (unsigned* matrix) {
for (unsigned i = 0; i < N * N; i++) {
printf(" %u ", matrix[i]);
if (i % N == (N-1)) {
printf("\n");
}
}
}
void createMatrix(unsigned* matrix) {
for (unsigned i = 0; i < N; i++) {
for (unsigned j = 0; j < N; j++) ... |
19,067 | #include "includes.h"
#define TILE_WIDTH = 16;
__global__ void matrixMultiply(float *A, float *B, float *C, int numARows, int numAColumns, int numBRows, int numBColumns, int numCRows, int numCColumns) {
//@@Y-axis matrix dimension
int row = blockIdx.y*blockDim.y + threadIdx.y;
//@@X-axis matrix Dimension
int column... |
19,068 | #include "includes.h"
__global__ void binaryCrossEntropyCost(float* cost, float* predictions, float* target, int size) {
int index = blockIdx.x * blockDim.x + threadIdx.x;
if (index < size) {
float partial_cost = target[index] * logf(1.0e-15+predictions[index])
+ (1.0f - target[index]) * logf(1.0e-15+(1.0f - prediction... |
19,069 | #include<stdio.h>
#include <time.h>
#define TRUE 1
#define FALSE 0
#define MIN(a,b) (a < b?a:b )
static const int N = 150;
__global__ void cerca_array_device(int *array,int *valor,int *res)
{
int b;
int id = threadIdx.x + blockIdx.x * blockDim.x;
if(*res == FALSE && *valor == array[id]){
*res = TRUE;
... |
19,070 | #include<stdio.h>
#include<cuda.h>
__global__ void sq(float *d_out, float* d_in)
{
int idx = threadIdx.x;
float f = d_in[idx];
d_out[idx] = f*f;
}
int main(int argc, char** argv)
{
const int ARRAY_SIZE = 64;
const int ARRAY_BYTES = ARRAY_SIZE * sizeof(float);
float h_in[ARRAY_SIZE];
for(int i=0; i < ARRAY_SIZE... |
19,071 | #ifdef __NVCC__
// __device__ volatile int PQ[MAX_NODE];
//K in parallel
template <class U>
__global__ void extractMin(unsigned int* PQ, unsigned int* PQ_size, int* expandNodes,int* expandNodes_size,U* Cx,int* openList,int N,int K){
int id = blockIdx.x*blockDim.x+threadIdx.x;
if(id<K && PQ_size[id]... |
19,072 | #include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <cuda.h>
#include <cuda_runtime.h>
//#define WRITE_TO_FILE
#define NX 4
#define NY 256
using namespace std;
typedef double(*func2)(double,double);
typedef double(*func3)(double,double,double);
//Обработчик ошибок
sta... |
19,073 | // #include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <climits>
#include <thrust/swap.h>
#include <thrust/extrema.h>
#include <thrust/functional.h>
#include <thrust/host_vector.h>
#include <thrust/devic... |
19,074 | /*
CUDA kernels and functions
Kurt Kaminski 2016
*/
#ifndef __FLUID_KERNELS__
#define __FLUID_KERNELS__
#include <cuda_runtime.h>
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////... |
19,075 | #include <cuda_runtime.h>
#include <device_launch_parameters.h>
#include <cufft.h>
#include <stdio.h>
#include <stdlib.h>
__global__ void DianCheng(cufftDoubleComplex *a, cufftDoubleComplex *b, cufftDoubleComplex *c,int M, int L)//˵GPU
{
int tx = threadIdx.x;
int by = blockIdx.y;
int i=by*L+tx;
... |
19,076 | #define t_max 1
#define t 1
/*
(w1_a[0][0]=((a[0][0][0][0][1]*(a[0][0][0][0][1]+1.0))*((a[0][0][0][0][1]+2.0)*0.16666666666666666)))
(w2_a[0][0]=(((a[0][0][0][0][1]-1.0)*(a[0][0][0][0][1]+1.0))*((a[0][0][0][0][1]+2.0)*-0.5)))
(w3_a[0][0]=(((a[0][0][0][0][1]-1.0)*a[0][0][0][0][1])*((a[0][0][0][0][1]+2.0)*0.5)))
(w4_a... |
19,077 | #include "includes.h"
__global__ void sqr_norm_kernel(const float *in, float *block_res, int total)
{
extern __shared__ float sdata[];
int in_idx = 2 * (blockIdx.x * blockDim.x + threadIdx.x);
int i = threadIdx.x;
unsigned ins = blockDim.x;
if (in_idx >= total * 2)
sdata[i] = 0;
else
sdata[i] = in[in_idx] * in[in_i... |
19,078 | #include <iostream>
#include <string>
#include <fstream>
#include <chrono>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
const int FILTER_WIDTH = 7;
const int BLOCK_SIZE = 256;
int FILTER[FILTER_WIDTH*FILTER_WIDTH] = {
1,4,7,10,7,4,1,
4,12,26,33,26,12,4,
7,26,55,71,55,26,7,
10,33,71,91,71,33,10,
... |
19,079 | #include <cuda_runtime.h>
#include <stdio.h>
/*
*
*/
__global__ void poly_div1(float* poli, const int N) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < N) {
float x = poli[idx];
poli[idx] = 5 + x * ( 7 - x * (9 + x * (5 + x * (5 + x))))+x/5.0;
}
}
__global__ vo... |
19,080 | /*
This version of my sudoku solver will make use of cuda to attemp to gain speedups
*/
#include <iostream>
#include <fstream>
//#include <chrono>
#define boardSize 81
#define sideSize 9
using namespace std;
struct Board{
int values[81];
bool isFixedValue[81];
bool isPossibleValue[81][9];
//int coordinates;
};
v... |
19,081 | /*
Jaitirth Jacob - 13CO125 Vidit Bhargava - 13CO151
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define ITERATIONS 4 //Repeat the experiment for greater accuracy
__global__ void add(int *a, int *b, int *c, int tpb)
{
//Find the correct thread index in the grid
int i = blockIdx.x * tpb + ... |
19,082 | #include <stdio.h>
// Prints info about the device
// Takes in the device number and a pointer to the properties
void printProperties(int i, cudaDeviceProp *prop){
printf( " --- General Information for device %d ---\n", i );
printf( "Name: %s\n", prop->name );
}
int main( void ) {
cudaDeviceProp ... |
19,083 | extern "C"{
__global__ void convolution_1D_basic_kernel(int *N, int *M, int *P,
int Mask_Width, int Width){
int i = blockIdx.x*blockDim.x + threadIdx.x;
float Pvalue = 0;
int N_start_point = i - (Mask_Width / 2);
for (int j = 0; j < Mask_Width; j++){
... |
19,084 | #include <cstdio>
template<typename T>
__device__ __inline__ void add(T& val) {
val += 1;
}
template<typename T>
__global__ void func(T* ptr) {
add<T>(ptr[blockIdx.x]);
}
int main() {
cudaStream_t stream;
cudaStreamCreate(&stream);
int *h_ptr, *d_ptr;
cudaHostAlloc(&h_ptr, 20, cudaHostAllocDefault);
for(int i=... |
19,085 | #include <stdio.h>
#include <stdlib.h>
#define MAX_ITER 100
#define MAX 100 //maximum value of the matrix element
#define TOL 0.000001
// Generate a random float number with the maximum value of max
float rand_float(int max){
return ((float)rand()/(float)(RAND_MAX)) * max;
}
// Allocate 2D matrix
void allocate_in... |
19,086 | // This is the naive implementation of in box check with all matrices squeezed to vector
__global__ void inBoxKernel(const float *A, const float *B, int *C, int numElements){
int i = (blockDim.x * blockIdx.x + threadIdx.x)*2;
float t11;
float t12;
float t21;
float t22;
if (i/2 < numElements)
... |
19,087 | // The code which is causing the pointer pointer address space error:
// %"struct.Eigen::half_impl::__half" = type { i16 }
// %"struct.Eigen::half_impl::half_base" = type { %"struct.Eigen::half_impl::__half" }
// %"struct.Eigen::half" = type { %"struct.Eigen::half_impl::half_base" }
// %"struct.Eigen::DSizes" = type {... |
19,088 | /******************************************************************************
*cr
*cr (C) Copyright 2010 The Board of Trustees of the
*cr University of Illinois
*cr All Rights Reserved
*cr
*****************************************************************... |
19,089 | /* nqueens.cu
* Jonathan Lehman
* February 26, 2012
*
* Compile with: nvcc -o nqueens nqueens.cu
* to get default with _N_ = 4 and numBX = 1 numBY = 1 sumOnGPU = 0
*
* Or specify _N_ by compiling with: nvcc -o nqueens nqueens.cu -D_N_=x
* where x is the board size desired where x must be >= 4 and <= 22
*
* ... |
19,090 | /*
Final project of NVIDIA Fundamentals of CUDA in C/C++
Consits of a simulation of the n-body problem.
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define SOFTENING 1e-9f
/*
* Each body contains x, y, and z coordinate positions,
* as well as velocities in the x, y, and z directio... |
19,091 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int row_counter(FILE* fp);
int col_counter(FILE* fp);
void read_matrix(FILE* fp,int *data);
void print_matrix(int *data,int mRr, int mRc);
__global__ void matrix_multiplication(int *m1,int *m2, int *mR, int m1r, int m1c, int m2c)
{
int row = blockIdx.y * b... |
19,092 | #include <cuda_runtime.h>
#include <stdio.h>
__global__ void add_one(int n, float* x) {
int i = threadIdx.x;
if (i < n) {
x[i] = x[i] + 1;
printf("thread %d, value=%f\n", i, x[i]);
}
}
void initialize_input(float* h_A, int n) {
for (int i = 0; i < n; i++) {
h_A[i] = i;
}
}
... |
19,093 | #include "includes.h"
__global__ void inverse_kernel(double* d_y, double* d_x) {
double x = *d_x;
*d_y = 1. / x;
} |
19,094 | #include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <curand_kernel.h>
#include <fstream>
#include <iostream>
__device__ __host__ unsigned int bitreverse(unsigned int number) {
number = ((0xffff0000 & number) >> 16) | ((0x0000ffff & number) << 16);
number = ((0xff00ff00 & number)... |
19,095 | __global__ void hadamardProductKernel(float *a, float *b, int l)
{
int index = blockIdx.x * blockDim.x + threadIdx.x;
int stride = blockDim.x * gridDim.x;
for (int i = index; i < l; i += stride)
a[i] = a[i] * b[i];
}
extern "C" void hadamard_wrapper(float *a, float *b, int l)
{
int blockSize = ... |
19,096 | #include <stdio.h>
#include <iostream>
#include <sys/time.h>
#define CHECK(call) \
{ \
const cudaError_t error = call; \
if(error!=cudaSuccess) { ... |
19,097 | #include "includes.h"
__global__ void CudaPermuteWeightsPVToCudnn( float *dest, float *src, int outFeatures, int ny, int nx, int inFeatures, int manyScaleX, int manyScaleY) {
// Parameter dimensions are PV source dimensions
int kSrc = (blockIdx.x * blockDim.x) + threadIdx.x;
if (kSrc < outFeatures * manyScaleX * manySc... |
19,098 | /************************************************************************************\
* *
* Copyright � 2014 Advanced Micro Devices, Inc. *
* Copyright (c) 2015 Mark D. Hill and David A. Wood ... |
19,099 | #include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <iostream>
#include <chrono>
int main() {
std::vector<double> stocks;
int n = 0;
while (std::cin){
n = n + 1;
double stock_day;
std::cin >> stock_day;
stocks.push_back(stock_day);
}
au... |
19,100 | // Copyright 2013 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.