serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
23,301 | #include "includes.h"
__global__ void kContract(float *expanded_data, float* targets, int num_images, int num_input_channels, int image_size_y, int image_size_x, int num_modules_y, int num_modules_x, int kernel_size_y, int kernel_size_x, int padding_y, int padding_x, int stride_y, int stride_x, int num_modules_batch, i... |
23,302 | #include <stdio.h>
#include <assert.h>
#include <math.h>
#include <limits.h>
__global__ void operate(int *test, int *train, double *dist, int tr_num, int index, int dimen){
int tid = blockDim.x * blockIdx.x + threadIdx.x;
//printf("%d %d\n", tid, tr_num);
if(tid < tr_num)
{
double sum = 0.0;
/*
in... |
23,303 | #include "includes.h"
__global__ void set_array_double(double *a, double value, size_t len)
{
size_t idx = threadIdx.x + blockIdx.x * blockDim.x;
while (idx < len) {
a[idx] = value;
idx += blockDim.x * gridDim.x;
}
} |
23,304 | #include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <iostream>
#include <chrono>
#include <limits>
static double inf = std::numeric_limits<double>::max();
using namespace std::chrono;
int main() {
double s;
thrust::host_vector<double> host_AAPL;
thrust::host_vector<double> host_MSF... |
23,305 | #include <stdio.h>
#include <cuda.h>
#include <math.h>
__global__ void TwoDimPoisson(float *d_A, float *d_B, float *d_F, double dx, float* diff)
{
int threadId = threadIdx.x + (blockIdx.x * blockDim.x);
int threadAbove = threadId - blockDim.x;
int threadBelow = threadId + blockDim.x;
int N = gridDim.x * blockDim.x... |
23,306 | #include "includes.h"
__global__ void instance_iou_cuda_kernel( int64_t total_gt_instances, const int64_t* __restrict__ nInstance, int nProposal, const int64_t* __restrict__ proposals_idx, const int64_t* __restrict__ proposals_offset, const int64_t* __restrict__ instance_labels, const int64_t* __restrict__ offset_num_g... |
23,307 | #include "includes.h"
__global__ void solve_GPU(int a, int b, int c ,int *x1, int *x2)
{
int raiz = powf(b, 2) - (4 * a * c);
int i = -b / 2 * a;
int j = 2 * a;
*x1 = i + sqrtf(raiz) / j;
*x2 = i - sqrtf(raiz) / j;
} |
23,308 | /* Program : To find the matrix multiplication of rectangular matrices without tiling
* Author : Anant Shah
* Date : 11-9-2018
* Roll Number : EE16B105
**/
#include<stdio.h>
#define ERROR_HANDLER(error_msg,line) error_handler(error_msg,line)
#define ROWS_M 4096
#define COLS_M 8192
#define ROWS_N 8192
#define COLS... |
23,309 | #include "includes.h"
__global__ void change_theta(const int ncoord, const float3 *theta, float4 *thetax, float4 *thetay, float4 *thetaz) {
unsigned int pos = blockIdx.x*blockDim.x + threadIdx.x;
if (pos < ncoord) {
thetax[pos].x = theta[pos*4].x;
thetax[pos].y = theta[pos*4+1].x;
thetax[pos].z = theta[pos*4+2].x;
the... |
23,310 | /*
backup: v_backup = v
history update: v = m * v - learning_rate * dx
parameter update: x = x - m * v_backup + v + m * v
*/
__global__ void nesterovKernel (
int numberIterations,
float learningRate,
float momentum,
float* history,
float* backup,
int* parameterIndices,
int* coun... |
23,311 | //When wold using shared memory make sense ?
//So, let's say you have a big array in the host memory and you transfer it to
//GPU memory and the task is to square each element of this array - This won't
//be a very good usage of __shared__ memory as you would first have to load
//from global to shared memory and then f... |
23,312 | #include "includes.h"
//
// imgproc_main.cpp
//
//
// Created by Nathaniel Lewis on 3/8/12.
// Copyright (c) 2012 E1FTW Games. All rights reserved.
//
// GPU constant memory to hold our kernels (extremely fast access time)
__constant__ float convolutionKernelStore[256];
/**
* Convolution function for cuda. Dest... |
23,313 | #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 mGradient_TwoDim(float *u_dimX, float *u_dimY, float *scalar, float coeffX, float coeffY) {
if(checkBoundary(... |
23,314 | #include <stdio.h>
__global__ void kernel(int* a_d, int* b_d, int* c_d){
*c_d = *a_d + *b_d;
return;
}
int main(){
int a = 1, b = 2;
int *a_d, *b_d, *c_d;
cudaMalloc((void**) &a_d, sizeof(int));
cudaMalloc((void**) &b_d, sizeof(int));
cudaMalloc((void**) &c_d, sizeof(int));
cudaMemcpy(a_d, &a, sizeof... |
23,315 | #include <stdio.h>
#include <time.h>
#include <sys/time.h>
// CPU: marca o tempo
__host__ double wtime() {
struct timeval t;
gettimeofday(&t, NULL);
return t.tv_sec + (double) t.tv_usec / 1000000;
}
// CPU: Núcleo de execução (processamento)
__host__ void fhcalc(int n)
{
double v1=0;
for (int j=0; j < 1... |
23,316 | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#define MAX_CHAR 100
#define DATAFILE "data.txt"
#define RESULTSFILE "resultsCudal.txt"
#define G 6.674e-11
#define NUM_ITER 1000
#define NUM_ITER_SHOW 50
__device__ double atomicAddD(double* address, double val)
{
unsigned... |
23,317 | #include "includes.h"
#define BLOCK_SIZE 32
#define N 2048
__global__ void matMult(float* A, float* B, float* C){
// Индекс блока
int bx = blockIdx.x;
int by = blockIdx.y;
// Индекс нити
int tx = threadIdx.x;
int ty = threadIdx.y;
float sum = 0.0;
//Индекс A[i][0]
int ia = N * BLOCK_SIZE * by + N * ty;
// Индекс B[... |
23,318 | #include "quad_tree_node.cuh"
#include "points.cuh"
#include <iostream>
__host__ __device__ QuadTreeNode::QuadTreeNode(): m_id(0), m_begin(0), m_end(0), m_bounding_box() {}
__host__ __device__ int QuadTreeNode::id() const{
return m_id;
}
__host__ __device__ void QuadTreeNode::set_id(int new_id){
m_id= ne... |
23,319 | // Trivial array add example
// This is almost like "hello, world" in CUDA :-)
#include <iostream>
const size_t array_size = 1024;
// Good macro for making sure we know where things went wrong...
#define checkCudaErrors(val) check_cuda( (val), #val, __FILE__, __LINE__ )
void check_cuda(cudaError_t result, char const... |
23,320 | #include <cmath>
#include <cstdlib>
#include <cstdio>
#include <sys/time.h>
#define BLOCK 16
__global__ void matmul(float *A, float *B, float *C, int M, int N, int K) {
// Shared memory
__shared__ float s_A[BLOCK][BLOCK];
__shared__ float s_B[BLOCK][BLOCK];
int a_begin = N * BLOCK * blockIdx.y; // N * blockDim.y... |
23,321 | /*
Name: Matthew Matze
Date: 9/28/2016
Class: csc4310
Location: ~/csc3210/deviceq
General Summary of Program
The program is set up to show the various device properties to the screen
To Compile:
nvcc device_query.cu -o device_query
To Execute:
device_query
*/
#include<stdio.h>
void printDevProp(cu... |
23,322 | #include <iostream>
using namespace std;
#define Threads 3
#define Blocks 4
#define N Threads*Blocks
__global__ // GPU function
void add(int *a, int *b, int n)
{
// Get ID of thread being executed
int tid = threadIdx.x + blockIdx.x * blockDim.x;
// if the thread id is less than the number of loops required
... |
23,323 | #include <cstdio>
extern "C" {
__device__
static int THREADS_IN_BLOCK = 1024;
__device__
void min_max(int* tab, int for_min, int for_max, int size) {
if (for_min >= size || for_max >= size) {
return;
}
int min = tab[for_min];
int max = tab[for_max];
if (max < min) {
atomicExch(tab + for_max, min);
atomi... |
23,324 | /*
Copyright 2021 Fixstars Corporation
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 applicable law or agreed to in writing, software
... |
23,325 | /*
Collatz code for CS 4380 / CS 5351
Copyright (c) 2021 Texas State University. All rights reserved.
Redistribution in source or binary form, with or without modification,
is *not* permitted. Use in source or binary form, with or without
modification, is only permitted for academic use in CS 4380 or CS 5351
at Texas... |
23,326 | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
__device__ float logsumexp(float a, float b)
{
if(a <= -1e20f)
{
return b;
}
else
if(b <= -1e20f)
{
return a;
}
/*float diff = a-b;
if (diff < -20.0f)
{
return b;
}
else
if (diff > 20.0f)
{
return a;
}*/
if(a > b)
{
return a + log... |
23,327 | #define TILE_DIM 16
#define BLOCK_ROWS 16
#define FLOOR(a,b) (a-(a%b))
__global__ void transposeNaive(float* odata, float* idata, int width, int height)
{
int xIndex = blockIdx.x * TILE_DIM + threadIdx.x;
int yIndex = blockIdx.y * TILE_DIM + threadIdx.y;
int index_in = xIndex + width * yIndex;
i... |
23,328 | /*
* @Program: sync_async.cu
* @Description: Shows the common sync/async behaviour.
*
* @Author: Giacomo Marciani <gmarciani@acm.org>
* @Institution: University of Rome Tor Vergata
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
__host__ __device__ void waitClockCycles(const int cycles) {
clock_t ... |
23,329 | #include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/generate.h>
#include <thrust/sort.h>
#include <thrust/copy.h>
#include <algorithm>
#include <cstdlib>
int main(void)
{
// generate 100 random numbers serially
thrust::host_vector<int> h_vec(100);
std::generate(h_vec.begin()... |
23,330 | #include <stdio.h>
#include <stdlib.h>
typedef unsigned char uchar;
__global__ void calcGis(uchar* data, int n, int* height) {
int idx = threadIdx.x + blockIdx.x * blockDim.x;
int offsetx = gridDim.x * blockDim.x;
__shared__ int tmp[256];
for(int i = threadIdx.x; i<256; i+=blockDim.x){
... |
23,331 | #include "includes.h"
__global__ void transpose_smem(int * in, int* out, int nx, int ny)
{
__shared__ int tile[BDIMY][BDIMX];
//input index
int ix, iy, in_index;
//output index
int i_row, i_col, _1d_index, out_ix, out_iy, out_index;
//ix and iy calculation for input index
ix = blockDim.x * blockIdx.x + threadIdx.x;
... |
23,332 | #include "includes.h"
__global__ void update_population_lost( unsigned int * pop , unsigned int rows , unsigned int cols , unsigned int * fixed ) {
} |
23,333 | #include "includes.h"
__global__ void kSigmoid_d(const int nThreads, float const *input, float *output) {
/* Computes the value of the sigmoid function derivative f'(x) = f(x)(1 - f(x)),
where f(x) is sigmoid function.
Inputs:
input: array
output: array, the results of the computation are to be stored here:
x(1 - x) f... |
23,334 | /*
* CPU version of BackPropagation Neural Network written in CUDA. One can change the extension .cu to .c
* and compile the program with C compiler.
*
* This program is a rework of Source code for Neural Networks w/ JAVA (Tutorial 09) - Backpropagation 01
* from http://zaneacademy.com
*
* Author - Waylon L... |
23,335 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
int main()
{
return 0;
}
|
23,336 |
#include <cuda.h>
#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <ctime>
using namespace std;
//assignment constraints prevent the optimization of this function
//better approach would have been to take a max per block
//then sort the resulting maxes, with blocks of thread size 1024 you can cut ... |
23,337 | #include <stdio.h>
#define Width 31
#define TITE_WIDTH 16
__global__ void MatrixMulKernel (float* Md, float* Nd, float* Pd, int ncols) {
int row = blockIdx.y * blockDim.y + threadIdx.y;
int col = blockIdx.x * blockDim.x + threadIdx.x;
printf("Block ID X : %d and Block ID Y: %d\n", blockIdx.x,blockIdx.y);
float P... |
23,338 | #include "includes.h"
#define N 100000
#define THREAD_PER_BLOCK 1
/**
* This macro checks return value of the CUDA runtime call and exits
* the application if the call failed.
*/
__global__ void add(int *a, int *b, int *c) {
int tid = blockIdx.x; // handle the data at this index
if (tid < N) {
c[tid] = a[tid] + b[tid... |
23,339 | #include <stdio.h>
#include <cuda_runtime.h>
__global__ void checkIndex(void){
printf("ThreadIdx: (%d,%d,%d) BlockIdx: (%d,%d,%d) BockDim: (%d,%d,%d) gridDim: (%d,%d,%d)\n", \
threadIdx.x,threadIdx.y,threadIdx.z,
blockIdx.x,blockIdx.y,blockIdx.z,
blockDim.x,blockDim.y,blockDim.z,
gridDim.x,gri... |
23,340 |
#include "complex.h"
extern "C" {
__device__
double2 fetch_initial_point(unsigned long i) {
return (double2){0.0, 0.0};
}
__device__
double2 iterate_point(double2 val, unsigned long i, double2 ipnt, unsigned long func_n) {
if (func_n < 42949673) {
func_n = 0;
} else if (func_n < 3693671875) {
func_n =... |
23,341 |
#include <cuda.h>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <cuda_runtime_api.h>
#include "utils.cuh"
#include "rbm_helpers.cuh"
using namespace utils;
__global__
void contrastive_divergence(curandState *globalState,int *input, double *weights, double *bh, double *bv, bool *mask, doubl... |
23,342 | #include <stdio.h>
__global__ void mykernel(int* a, int* b, int* c) {
int idx = (blockIdx.x * blockDim.x) + threadIdx.x;
c[idx] = a[idx] * b[idx];
}
// Probably needs to be a define since we'll use it in <<<
#define NUM_BLOCKS 8
#define NUM_THREADS_PER_BLOCK 64
int main() {
// Host
int *a, *b, *c;
// Devic... |
23,343 | __constant__ int numFreqs;
__constant__ int numPoints;
__constant__ float centerFreq;
/*Finds the index of largest value among the input (size numFreqs)*/
__device__ int argmax(float* input) {
float max = input[0];
int best = 0;
for (int i = 1; i < numFreqs; i++) {
if (input[i] > max) {
... |
23,344 | #include<stdio.h>
#define N (1024*1024)
#define M 1024
__global__ void dot(float *a, float *b, float *c) {
int i = blockDim.x*blockIdx.x + threadIdx.x, j = threadIdx.x;
__shared__ float ab[M];
ab[j] = a[i]*b[i];
__syncthreads();
if (!j) {
float s = 0.;
for (i = 0; i < M; i++)
s += ab[i];
atomicAdd(c, s)... |
23,345 | #include "includes.h"
/* CUDA API header files*/
extern "C"
__global__ void matrixMult(const double *Md, const double *Nd, double *Pd, int size)
{
int row = blockDim.x * blockIdx.x + threadIdx.x;
int col = blockDim.y * blockIdx.y + threadIdx.y;
if (row < size) { // Don't do anything to the memory if we're above the ... |
23,346 | // seems my bitcasting is/was broken ('is', at time of writing this test, 'was' since I probably fixed it by now :-) )
// this code tests this, sortof
// (hmmm, edit, seems to be ok, in fact...)
#include "cuda.h"
#include <iostream>
#include <cassert>
using namespace std;
__global__ void mykernel(int *int1, float *... |
23,347 | #include "softmax.hh"
#include "graph.hh"
#include "../runtime/node.hh"
#include "../memory/alloc.hh"
namespace ops
{
Softmax::Softmax(Op* arg)
: Op("softmax", arg->shape_get(), {arg})
{}
void Softmax::compile()
{
auto& g = Graph::instance();
auto& carg = g.compiled(preds()[0]... |
23,348 | #include "includes.h"
__global__ void kernel4(int k, int n, int bias, float* searchPoints, float* referencePoints, float* dist)
{
float diff, squareSum;
int tid = blockDim.x * blockIdx.x + threadIdx.x;
if (tid < n) {
squareSum = 0;
for (int i = 0; i < k; i++) {
diff = searchPoints[k * bias + i] - referencePoints[k * ti... |
23,349 | /*
Below code is based on
https://github.com/NVIDIA-developer-blog/code-samples/tree/master/series/cuda-cpp/transpose.
nvcc transpose_any.cu -o transpose_any
*/
#include <assert.h>
#include <math.h>
#include <stdio.h>
#define DEBUG
// Convenience function for checking CUDA runtime API results
// can be wrapped around ... |
23,350 | #define N 536870912
#include <cuda_runtime.h>
#include <iostream>
#include <stdio.h>
#include <vector>
#include <cmath>
#define BLOCK_SIZE 1024
__global__ void reduceSum(int *ada, int *gabrys){
__shared__ int partialSum[2 * BLOCK_SIZE];
unsigned int t = threadIdx.x;
unsigned int start = 2 * blockIdx.x * BLOCK_SIZ... |
23,351 | #include "includes.h"
__global__ void MatrixMultiplication__CudaKernel(int* in_tabA, int* in_tabB, int* out_tabC, int outTabWidth)
{
int row = blockIdx.x * blockDim.x + threadIdx.x;
int col = blockIdx.y * blockDim.y + threadIdx.y;
//making sure that extra threads will do not any work
if (row < outTabWidth && col < out... |
23,352 | #include "includes.h"
__global__ void convertFloatToRGBAbinary_kernel(uchar4 *out_image, const float *in_image, int width, int height, float lowerLim, float upperLim) {
const int x = __mul24(blockIdx.x, blockDim.x) + threadIdx.x;
const int y = __mul24(blockIdx.y, blockDim.y) + threadIdx.y;
uchar4 temp;
if (x < width &&... |
23,353 | #include <stdio.h>
#ifdef __DEVICE_EMULATION__
#define EMUSYNC __syncthreads()
#else
#define EMUSYNC (void*)(0)
#endif
void checkCUDAError(const char *msg);
__device__ void sum_block(float *s, float *sdata)
{
int blockSize=blockDim.x;
int tid=threadIdx.x;
if (blockSize >= 512) { if (tid < 256)... |
23,354 | #include <stdio.h>
#include <curand.h>
#include <curand_kernel.h>
#include <math.h>
#include <assert.h>
#define MIN 2
#define MAX 7
#define ITER 10000000
__global__ void setup_kernel(curandState *state){
int idx = threadIdx.x+blockDim.x*blockIdx.x;
curand_init(1234, idx, 0, &state[idx]);
}
__global__ void gener... |
23,355 | #include<stdio.h>
//Device code
__global__ void addvec (float* a, float* b, float* c, int N)
{
int i = blockDim.x*blockIdx.x + threadIdx.x;
if (i<N)
c[i] = a[i]+b[i];
}
//Host code
int main()
{
int N = 10;
size_t size = N*sizeof(float);
//Allocate input vectors h_A and h_B in host memory
float* h_a = (floa... |
23,356 | #include <iostream>
#include <math.h>
#include <cstdlib>
#include <curand_kernel.h>
#include <thrust/random.h>
// add two arrays
template<typename T>
__global__ void add(T *output, T *inputA, T *inputB) {
int idx = (blockIdx.x * blockDim.x) + threadIdx.x;
output[idx] = inputA[idx] + inputB[idx];
}
template<typena... |
23,357 | #include <stdio.h>
__global__ void hello_kernel()
{
printf("Hello from GPU thread %d\n", threadIdx.x);
}
int main()
{
hello_kernel<<<1, 32>>>();
cudaDeviceSynchronize();
return 0;
}
|
23,358 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include "stdio.h"
int main()
{
double *matrix, *d_A;
matrix = (double *)calloc(1000, sizeof(double));
cudaMalloc( &d_A, 1000*sizeof(double));
cudaMemcpy(d_A, matrix, 1000*sizeof(double), cudaMemcpyHostToDevice);
printf("\nthe... |
23,359 | // From CUDA for engineers
// Listing 6.5: centroid_2d/kernel.cu
// 2d: reduction
#include <cuda_runtime.h>
#include <iostream>
#include <stdio.h>
__global__
void centroidKernel()
{
}
void centroidParallel()
{
}
int main()
{
return 0;
} |
23,360 | #include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#define GIGABYTE 1000000000
struct entry
{
int origIndex;
float xValue, yValue;
};//entry
int h_binarySearchLB(entry * data, float val, int n)
{
//return index of greatest leftmost xValue that is greater than val
int left = 0;
int right = n;
int mid;
... |
23,361 | /****************************************************************************
*
* cuda-rule30.cu - Rule30 Cellular Automaton with CUDA
*
* Written in 2017 by Moreno Marzolla <moreno.marzolla(at)unibo.it>
*
* To the extent possible under law, the author(s) have dedicated all
* copyright and related and neighbori... |
23,362 | #include "includes.h"
__global__ void calcSoftmaxMaxForwardGPU(float *array, float *max, int *mutex, int batch_size, int in_size_x, unsigned n)
{
unsigned int index = threadIdx.x + blockIdx.x * blockDim.x;
unsigned int stride = gridDim.x * blockDim.x; // = in_size_x
unsigned int offset = 0;
// __shared__ float cache[ ... |
23,363 | #include "includes.h"
__global__ void TwoNodesDifferenceKernel( int nodeOne, int nodeTwo, int vectorLength, float *referenceVector, float *twoNodesDifference )
{
int threadId = blockDim.x*blockIdx.y*gridDim.x //rows preceeding current row in grid
+ blockDim.x*blockIdx.x //blocks preceeding current block
+ threadId... |
23,364 | #include "includes.h"
__global__ void normalize_energy_gpu(float *ksn2e, float *ksn2f, double omega_re, double omega_im, float *nm2v_re, float *nm2v_im, int nfermi, int norbs, int nvirt, int vstart)
{
int i = blockIdx.x * blockDim.x + threadIdx.x; //nocc
int j = blockIdx.y * blockDim.y + threadIdx.y; //nvirt
float en=0... |
23,365 | #include "includes.h"
__global__ void matrixMulKernel(float* ans, float* M, float* N, int size) {
int row = blockIdx.y * blockDim.y + threadIdx.y;
int col = blockIdx.x * blockDim.x + threadIdx.x;
if(row < size && col < size) {
float pVal = 0;
for (int i = 0; i < size; ++i)
pVal += M[row*size + i] * N[i*size + col];
ans... |
23,366 | #include "my_device_func.cuh"
__global__ void make_ones(float *a, int n)
{
int tid = blockIdx.x*blockDim.x + threadIdx.x;
while(tid < n)
{
a[tid] = 1.0;
tid+= blockDim.x * gridDim.x;
}
}
__global__ void make_zeros(float *a, int n)
{
int tid = blockIdx.x*blockDim.x + threadIdx.x;
... |
23,367 |
__device__ void hsv_rgb_single(float h, float s, float v, unsigned char *r, unsigned char *g, unsigned char *b)
{
// Adapted and simplified from https://github.com/jakebesworth/Simple-Color-Conversions
/* Convert hue back to 0-6 space, floor */
const float hex = h * 6;
const unsigned char primary = (int) hex... |
23,368 | #include <cuda_runtime.h> //uchar4
__global__
void split_channels(uchar4 *input_image, uchar4 *red, uchar4 *green, uchar4 *blue){
int row = threadIdx.x;
int col = blockIdx.x;
int idx = col + row*360;
red[idx] = input_image[idx];
green[idx] = input_image[idx];
blue[idx] = input_image[idx];
... |
23,369 | #include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <math.h>
double dwalltime(){
double sec;
struct timeval tv;
gettimeofday(&tv,NULL);
sec = tv.tv_sec + tv.tv_usec/1000000.0;
return sec;
}
__global__ void vecMult(double *d_vecA,unsigned long n){
unsigned ... |
23,370 | #include "includes.h"
// Copyright (c) 2020, Michael Kunz. All rights reserved.
// https://github.com/kunzmi/ImageStackAlignator
//
// This file is part of ImageStackAlignator.
//
// ImageStackAlignator is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public Licens... |
23,371 | // Compile it with:
// nvcc blur_gpu.cu -o blur_gpu
// Run it with:
// CUDA_VISIBLE_DEVICES=1 ./blur_gpu
#include <iostream>
#include <cstdlib>
#include <math.h>
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <time.h>
__global__ void convolutionGPU(
float *d_Result,
float *d_Data,
int dataW,
int... |
23,372 | // REQUIRES: clang-driver
// REQUIRES: x86-registered-target
// REQUIRES: nvptx-registered-target
// Verify that DWARF version is properly clamped for nvptx, but not for the host.
// RUN: %clang -### -target x86_64-linux-gnu -c %s -gdwarf-5 -gembed-source 2>&1 \
// RUN: | FileCheck %s --check-prefix=DWARF-CLAMP
// RUN... |
23,373 | #include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/copy.h>
#include <thrust/fill.h>
#include <thrust/sort.h>
#include <thrust/scan.h>
#include <thrust/transform.h>
#include <thrust/functional.h>
#include <iostream>
#include <random>
#include <ctime>
#include <cstdio>
#include <cstdlib>
... |
23,374 | #include "includes.h"
__global__ void kernel_test1_write(char* _ptr, char* end_ptr, unsigned int* err)
{
unsigned int i;
unsigned long* ptr = (unsigned long*) (_ptr + blockIdx.x*BLOCKSIZE);
if (ptr >= (unsigned long*) end_ptr) {
return;
}
for (i = 0;i < BLOCKSIZE/sizeof(unsigned long); i++){
ptr[i] =(unsigned long) ... |
23,375 | #include "includes.h"
__global__ void MHDUpdatePrim_CUDA3_kernel(float *Rho, float *Vx, float *Vy, float *Vz, float *Etot, float *Bx, float *By, float *Bz, float *Phi, float *dUD, float *dUS1, float *dUS2, float *dUS3, float *dUTau, float *dUBx, float *dUBy, float *dUBz, float *dUPhi, float dt, float C_h, float C_p, in... |
23,376 | /*
* _et_clear_accumulator_gpu_kernels.cu
*
* NiftyRec
* Stefano Pedemonte, May 2012.
* CMIC - Centre for Medical Image Computing
* UCL - University College London.
* Released under BSD licence, see LICENSE.txt
*/
|
23,377 | /*
* JCudaVec - Vector operations for JCuda
* http://www.jcuda.org
*
* Copyright (c) 2013-2015 Marco Hutter - http://www.jcuda.org
*/
extern "C"
__global__ void vec_setf (size_t n, float *result, float value)
{
int id = threadIdx.x + blockIdx.x * blockDim.x;
if (id < n)
{
result[id] = value;... |
23,378 | #include "includes.h"
__global__ void IndexLeafNode(const char *text, bool *forest, int text_size, int step)
{
int idx = blockIdx.x * blockDim.x + threadIdx.x;
int offset = blockIdx.x*step+blockDim.x;
forest[offset+threadIdx.x] = (text[idx] != '\n' && idx < text_size);
} |
23,379 | #include<iostream>
#include<stdlib.h>
#include<cuda.h>
#include<time.h>
#define BLOCK_SIZE 64
#define SOA 512
void random_ints(int *data,int size)
{
int i;
for(i=0;i<size;i++)
{
data[i]=rand()%size;
}
}
__global__ void ReductionMax2(int *input,int *results,int n)
{
__shared__ int sdata[BLOCK_SIZE];
unsigned ... |
23,380 | #include <iostream>
#include "vector_summation.cuh"
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cuda.h>
#include <stdio.h>
GpuVector::GpuVector(int* vec_cpu,int N):N_(N)
{
//! Allocate GPU mem
int nbytes=N_*sizeof(int);
cudaMallocManaged((void **)&vec_gpu,nbytes);
cudaMallocManaged((void... |
23,381 | #include "warpStandard.cuh"
#include <cuda.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <iostream>
#include <numeric>
#include <sys/time.h>
#include <sstream>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd... |
23,382 | /*
* File: Complex.cu
*
* Created on June 24, 2012
*
* Purpose: Simple complex number class for use on GPU
*
* If it works, it was written by Brian Swenson.
* Otherwise, I have no idea who wrote it.
*/
class Complex
{
public:
float r;
float i;
__host__ __device__ Complex( float a, floa... |
23,383 | #include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#define M_PI 3.14159265359
#define MIN(a,b) (((a)<(b))?(a):(b))
typedef struct
{
float *matrix;
int n_landmarks;
int n_measurements;
} dist_matrix;
typedef struct
{
int *assignment;
bool *assigned_measurements;
} assignment;
typedef st... |
23,384 | #include <stdio.h>
#include <curand.h>
#include <curand_kernel.h>
#include <time.h>
#include <sys/time.h>
#define N (1<<12)
#define M (1<<12)
#define THREADBLOCKSIZE 1024
#define LENGTH (N*sizeof(point))
#define INDEX (blockIdx.x * blockDim.x + threadIdx.x)
#define D2H cudaMemcpyDeviceToHost
#define H2D cudaMemcpyHos... |
23,385 | #include "includes.h"
__global__ void ChangeOutputWeightsKernel( float *outputWeights, float *outputWeightDeltas, float *outputDeltas, float *hiddenActivations, float trainingRate, float momentum )
{
int weightId = blockDim.x*blockIdx.y*gridDim.x //rows preceeding current row in grid
+ blockDim.x*blockIdx.x //block... |
23,386 | #include <stdio.h>
#define TPB 256
#define BPG 1
__global__ void printing()
{
int myID = blockIdx.x *blockDim.x + threadIdx.x;
printf("Hello world! My thread ID is %d", myID);
}
int main()
{
printing<<<BPG, TPB>>>();
return 0;
} |
23,387 | #include <stdio.h>
#include <math.h>
#include <cuda.h>
#include <curand.h>
#include <curand_kernel.h>
#include <fstream>
// Definitions
#define CUDADEVICE 0
#define ARRAY_POWER_SIZE 30
#define RANDOM_SEED 1337
#define ENSEMBLES 50000
__global__
void generate_random_data(int* values, unsigned int values_n) {
// ... |
23,388 | #include "includes.h"
using namespace std;
#define D 3
#define N 200
#define K 512
#define Nt 20
#define Rt 0.1f
#define c 0.001f
#define ct 0.0001f
__global__ void addcuda(float* Q, float* P, float* Qt, float* Pt, float* Eg, float* Epg) {
for (int j = 0; j < 10; j++) {
int x = blockIdx.x;
int y = threadIdx.x;
... |
23,389 | #include "includes.h"
__global__ void partialSumKernel(int *X, int N)
{
__shared__ int partialSum[BLOCK_SIZE];
int tx = threadIdx.x;
int i = blockIdx.x * blockDim.x + tx;
if (i < N) {
partialSum[tx] = X[i];
partialSum[tx + blockDim.x] = X[i + gridDim.x * blockDim.x];
//printf("X[%d + %d * %d] = %d\n", i,gridDim.x, blo... |
23,390 | //
// TriggerSelection.cpp
// HiggsAnalysis_new
//
// Created by Joona Havukainen on 5/31/19.
// Copyright © 2019 Joona Havukainen. All rights reserved.
//
__device__
bool L1METTrigger(float L1MET_x, float L1MET_y, float L1MET_cut)
{
float L1MET = sqrtf(powf(L1MET_x, 2.f)+powf(L1MET_y, 2.f));
return L1MET>... |
23,391 | #include <stdio.h>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#define DEBUG 1
#define MAX_BLOCKS (32*1024)
// #define MAX_BLOCKS (13)
#define COPY_THREADS 128
#define max(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; })
#define min(a,b) \
({ _... |
23,392 | #include "includes.h"
__global__ void doubleToFloat(double* input, float* output, int numElements)
{
int i = blockDim.x * blockIdx.x + threadIdx.x;
if (i < numElements)
{
output[i] = (float)input[i];
}
} |
23,393 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cuda_runtime.h>
#define N (1 << 12)
#define tile_size 64
#define block_size 16
void checkCUDAError(const char *msg) {
cudaError_t err = cudaGetLastError();
if( cudaSuccess != err) {
fprintf(stderr, "Cuda error: %s: %s.\n", msg, cudaGet... |
23,394 |
/* This is a automatically generated test. Do not modify */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
__global__
void compute(float comp, float var_1,float var_2,float var_3,float var_4,float var_5,float var_6,int var_7,float var_8,float var_9,float var_10,float var_11,float var_12,float var_13,float ... |
23,395 | #include "cuda_runtime.h"
#include "stdio.h"
__device__ float devData;
__global__ void checkGlobalVariable(){
printf("Device: the value of the global variable is: %f\n", devData);
devData += 2.0f;
}
int main(void){
float value = 3.14f;
cudaMemcpyToSymbol(devData, &value, sizeof(float));
printf(... |
23,396 | #include "cuUtils.cuh"
// wczeniej nazywao si normalizeVectorSum
__global__ void reciprocal(double * v, int n){
// inverse values of elements in a vector
// grid stride loop
for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < n; i += blockDim.x * gridDim.x){
if (v[i] != 0.0){
v[i] = 1.0 / v[i];
}
... |
23,397 | #include <stdio.h>
#include <cuda_runtime.h>
__global__ void test_print_kernel(const float* pdata, int ndata){
int idx = threadIdx.x + blockIdx.x * blockDim.x;
/* dims indexs
gridDim.z blockIdx.z
gridDim.y blockIdx.y
gridDim.x blockId... |
23,398 | #include <stdio.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <assert.h>
__global__ void add(int *a, int *b, int *c) {
int idx = blockDim.x*blockIdx.x + threadIdx.x;
c[idx] = a[idx] + b[idx];
__syncthreads();
}
void random_ints(int* a, int N) {
for (int i=0; i<N; i++){
a[i] = rand()... |
23,399 | //
// kernel routine
//
__global__ void VecAdd_kernel(const float* A, const float* B, float* C, int N)
/* Naive kernel */
{
// Uncomment line below and define global index form block and thread indexes
// int i = ;
// Define C[i] below
}
|
23,400 | #include<stdio.h>
__global__ void interpolate(float * x, float * y, float a, float * k, int n){
int i,j;
i = blockIdx.x * blockDim.x + threadIdx.x;
__shared__ float ss[100], ts[100], ks[100];
if(i<n)
{
ss[i]=1;
ts[i]=1;
__syncthreads();
for(j=0;j<n;j++)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.