serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
901 | #include "includes.h"
/*This file is part of quantumsim. (https://github.com/brianzi/quantumsim)*/
/*(c) 2016 Brian Tarasinski*/
/*Distributed under the GNU GPLv3. See LICENSE.txt or https://www.gnu.org/licenses/gpl.txt*/
//kernel to transform to pauli basis (up, x, y, down)
//to be run on a complete complex density ... |
902 | #include<iostream>
#define THREADS_PER_BLOCK 256
#define BLOCKS 128
#define N (1 << 16)
using namespace std;
__global__ void add_array(float A[], float blocks[])
{
__shared__ int array_per_block[THREADS_PER_BLOCK];
int global_thread_ID = blockIdx.x * THREADS_PER_BLOCK + threadIdx.x, step = gridDim.x * THREAD... |
903 | /*#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include<opencv2\imgproc.hpp>
#include <iostream>
float mallocTest(unsigned int size,bool up)
{
cudaEvent_t start, stop;
unsigned int *d_va... |
904 | #include<stdio.h>
#include<cuda.h>
#include<math.h>
__global__
void Matmultkernel(int* A , int* b, int* C)
{
int col = blockIdx.x * blockDim.x + threadIdx.x;
int P = 0;
for(int k= 0; k<32; k++)
{
int MA = A[col * 32 + k];
int Mb = b[k];
P = P + MA * Mb;
}
C[col] = P;
}
int main()
{... |
905 | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <time.h>
#include <curand.h>
#include <curand_kernel.h>
#define BLOCK_SIZE 768
//-------- Save values to dat file --------//
void saveFrequenciesToFile(int *array, int size){
FILE *filePointer = fopen("freq.dat", "w");
for (... |
906 | #include<stdio.h>
#include<cuda.h>
#include<time.h>
#include<math.h>
#define row 43500
#define col 10
#define test_row 14500
#define test_col 10
__global__
void KminNeighbourFind(double *distance1, int *d_kneighbours,int k,int set,int *res_class)
{
int i=blockDim.x*blockIdx.x+threadIdx.x;
int set_i;
if(i<test_row... |
907 | #include "includes.h"
__global__ void cuArraysCopyExtractFixedOffset(const float *imageIn, const int inNX, const int inNY, float *imageOut, const int outNX, const int outNY, const int nImages, const int offsetX, const int offsetY)
{
int outx = threadIdx.x + blockDim.x*blockIdx.x;
int outy = threadIdx.y + blockDim.y*blo... |
908 | /****
File: findRedsDriver.cu
Date: 5/3/2018
By: Bill Hsu
Compile: nvcc findRedsDriver.cu -o frgpu
Run: ./frgpu
****/
#include <stdio.h>
#include <math.h>
#include <... |
909 | #include <stdio.h>
#include <math.h>
#define THREADS_PER_BLOCK 256
__global__ void MatrixMul( float *Md , float *Nd , float *Pd , const int WIDTH )
{
int COL = threadIdx.x + blockIdx.x * blockDim.x;
int ROW = threadIdx.y + blockIdx.y * blockDim.y;
if (ROW < WIDTH && COL < WIDTH) {
for (int ... |
910 | #include <stdio.h>
#define CHECK(call)\
{\
const cudaError_t error = call;\
if (error != cudaSuccess)\
{\
fprintf(stderr, "Error: %s:%d, ", __FILE__, __LINE__);\
fprintf(stderr, "code: %d, reason: %s\n", error,\
cudaGetErrorString(error));\
exit(EXIT_FAILURE);\
}\
}
struct GpuTimer
{
cudaEvent_t start;... |
911 | /*
* Ускорение программы с помощью CUDA.
* Вариант: 7
* Бизнес логика: Умножение матрицы на вектор
*
* Считывание данных происходит из файла.
* Программа выполняет бизнес-логику и записывает результат в выходной файл.
* В конце файла с результатами сохраняется информация о времени выполнения вычислений
* и р... |
912 | __global__ void mandelgpu(int disp_width, int disp_height, int *array, int max_iter) {
double scale_real, scale_imag;
double x, y, u, v, u2, v2;
int i, j, iter;
scale_real = 3.5 / (double)disp_width;
scale_imag = 3.5 / (double)disp_height;
i = blockIdx.x * blockDim.x + threadIdx.x;
x = ((double)i *... |
913 | #include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <iostream>
struct variance{
int N;
double mean;
variance(int n, double m): N(n), mean(m) {};
__host__ __device__
double operator()(const double &x){
double v = (x - mean) * (x - mean)/N;
return v;
}
... |
914 | #include "includes.h"
/////////////////////////////////////////////////////////
// Computes the 1-stencil using GPUs.
// We don't check for error here for brevity.
// In your implementation - you must do it!
#define BLOCK_SIZE 1024
#define WARP_SIZE 32
#ifndef k
#define k 3
#endif
#ifndef OUTPUT_PER_THREAD
#define O... |
915 | /**
* Copyright © 2018 - 2019 Sergei Iurevich Filippov, 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
*
* Un... |
916 | #include <cuda.h>
#include <stdio.h>
void saxpy (float* X, float* Y, float* Z, int n);
float avg (float* arr, int n);
__global__
void saxpyKernel(float *x, float *y, float *z, float a, int n) {
int id = blockIdx.x * blockDim.x + threadIdx.x;
if (id < n)
z[id] = a*x[id] + y[id];
}
int main () {
int N = 1... |
917 | #include <stdio.h>
#include <cuda.h>
#include <cmath>
#include <iostream>
float cpu_array [25];
float cpu_output_array [25];
float *gpu_array_A;
float *gpu_array_B;
float *gpu_output_array;
const int mat_width = 5;
dim3 dimBlock(mat_width, mat_width);
dim3 dimGrid(1, 1);
void initCuda(int width) {
cudaMalloc((void*... |
918 | #include<stdio.h>
#include<stdlib.h>
#include<cuda.h>
#include<math.h>
#define N 512
__global__ void Sum (int *a,int *o)
{
int tid = blockDim.x*blockIdx.x+threadIdx.x;
for(int i = N/2; i > 0; i = i/2)
{
if(tid < i)
{
a[tid]+=a[tid+i];
}
}
o[0] = a[0];
}
__g... |
919 | #include <stdio.h>
#include <cuda_runtime_api.h>
#include <time.h>
#include <pthread.h>
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
__device__ int is_a_match (char *attempt) {
char plain_password1[] = "SH1234";
char plain_password2[] = "RE2345";
char plain_password3[] = "EJ3456";
char plain_password4[] = "... |
920 | /**
* Author: Zachariah Bryant
* Description: Generates the average plaquette of a SU(2) lattice
* vs equilibration steps for an unthermalized lattice.
*/
// ********************
// * Headers *
// ********************
#include <iostream>
#include <fstream>
#include <string.h>
#include ... |
921 | #include "includes.h"
__global__ void histogram( int * hist_out, unsigned char * img_in, int img_w,int img_h, int nbr_bin){
int tx=threadIdx.x;
int ty=threadIdx.y;
int bx=blockIdx.x;
int by=blockIdx.y;
__shared__ int smem[256];
smem[threadIdx.x]=0;
__syncthreads();
unsigned int col= tx + blockDim.x * bx;
unsign... |
922 | #include "includes.h"
__global__ void findCentroidsAtomicFreeLocal(int afLocal, int* responses, int nPixels, int* cluster, int* centroidMass, unsigned int* centroidCount)
{
int const af_id = blockIdx.x;
int const cluster_id = blockIdx.y;
int const filter_id = threadIdx.x;
int* filter_responses = &responses[filter_id*nP... |
923 | #include "includes.h"
__global__ void findMaxAbs(int nRxns, double *d_umat2, int nMets, int *d_rowVec, int *d_colVec, double *d_val, int nnz, double *points, int pointsPerFile, int pointCount, int index){
int newindex = blockIdx.x * blockDim.x + threadIdx.x;
int stride = blockDim.x * gridDim.x;
for(int k=newindex;k<nn... |
924 | //gpu_bench.cu
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#define CHECK_ERR(x) \
if (x != cudaSuccess) { \
fprintf(stderr,"%s in %s at line %d\n", \
cudaGetErrorString(err),__FILE__,__LINE__);... |
925 | #include "kernel.cuh"
#include <iostream>
#include <math.h>
#define TILE_SIZE 2
__global__ void matrixMulGpuNonShared(float *d_a, float *d_b, float *d_c,
const int size) {
int row, col;
col = TILE_SIZE * blockIdx.x + threadIdx.x;
row = TILE_SIZE * blockIdx.y + threadIdx.y;
... |
926 | #include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/time.h>
#include <cuda.h>
static int const height = 521,
width = 428,
maxLineLength = 200,
maxHeaderSize = 5,
maxX = width - 1,
maxY = height - 1,
... |
927 | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int are_vectors_equal(int* a, int* b, int n);
/* The old-fashioned CPU-only way to add two vectors */
void add_vectors_host(int *result, int *a, int *b, int n) {
for (int i=0; i<n; i++)
result[i] = a[i] + b[i];
}
/* The kernel that will execute on ... |
928 | //pass
//--blockDim=1024 --gridDim=1 --no-inline
#include <cuda.h>
#include <stdio.h>
#define N 2 //1024
__global__ void definitions (int* A, unsigned int* B)
{
atomicSub(A,10);
atomicSub(B,5);
}
|
929 | #include "BaseNode.cuh"
BaseNode::BaseNode() {
}
BaseNode::~BaseNode() {
}
__device__ double BaseNode::sigmoid(double input) {
return 1 / (1 + exp(-input));
}
__device__ double BaseNode::sigmoidPrime(double input) {
return sigmoid(input) * (1 - sigmoid(input));
}
__device__ double BaseNode::activationFunction(do... |
930 | #include <iostream>
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <stdio.h>
__global__ void Run_Me( int* The_Array , int size)
{
int ID = blockIdx.x;
if(ID < 4)
The_Array[ID] = The_Array[ID] * The_Array[ID];
}
void Test( thrust::device_vector<int> &A , void(*f)(int*,int) )
{
in... |
931 | #include "includes.h"
__global__ void profileSubphaseTruncateP_kernel() {} |
932 | #include <cuda.h>
#include <cuda_runtime_api.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
// checkCUDAError -------------------------------------------------------------
// Convience method to check for cuda errors.
// @param msg - Unique identifier to help debug.
//
// From Dr Dobbs "CUDA: Superco... |
933 | #include <iostream>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <cassert>
#include <cuda.h>
#include <curand.h>
#include <curand_kernel.h>
#include <math.h>
/**
* This kernel essentially serves as a "srand(seed)" on the GPU
*/
__global__ void setup_kernel(curandState * st... |
934 | #include "includes.h"
//Training of the CNN is done using Keras. After training for 10 epochs, the obtained accuracy on the training data set is 99.70 and on the test data set is 99.14.
//This model implements the following layes in order- 2DConvolution---->Maxpooling---->2D Convolution---->Maxpooling---->Fully_connect... |
935 | /* Copyright (c) 2001-2018, The Ohio State University. All rights
* reserved.
*
* This file is part of the MVAPICH2 software package developed by the
* team members of The Ohio State University's Network-Based Computing
* Laboratory (NBCL), headed by Professor Dhabaleswar K. (DK) Panda.
*
* For detailed copyrigh... |
936 | //
// Created by Peter Rigole on 2019-05-24.
//
#include "Timer.cuh"
Timer::Timer() : beg_(clock_::now()) {}
void Timer::reset() { beg_ = clock_::now(); }
double Timer::elapsed() const {
return std::chrono::duration_cast<second_> (clock_::now() - beg_).count();
}
|
937 | #include "includes.h"
__global__ void OPT_4_HIST(int *d_lcmMatrix, int *d_LCMSize, int *d_histogram, int n_vertices)
{
int i = threadIdx.x + blockIdx.x * blockDim.x;
int count = 0, countMax = -1;
if(i<n_vertices)
{
int iStart = 0;
if(i>0)
iStart = d_LCMSize[i - 1]; //Offset
count = 0;
int iSize = d_LCMSize[i] - iStart... |
938 | #include <stdio.h>
__global__ void add( int a, int b, int *c ){
*c = a + b;
}
int main(void){
int c;
int *dev_c; // pointer to device
cudaMalloc( (void**)&dev_c, sizeof(int) );
add<<<1, 1>>>( 2, 8, dev_c);
cudaMemcpy( &c, dev_c, sizeof(int), cudaMemcpyDeviceToHost);
printf( "2 + 7 = %d\n", c );
cudaFree( dev_... |
939 | /** \file
*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <time.h>
#include <sys/time.h>
#include <stdint.h>
int nextPower(int);
void die(const char *);
void warn(const char *);
void read_from_file(int *, char *, int);
void write_to_file(int *, char *, int);
/**
* play - Plays the game for one ... |
940 | /**********************************************************************
* DESCRIPTION:
* Serial Concurrent Wave Equation - C Version
* This program implements the concurrent wave equation
**********************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <m... |
941 | __device__ float multiplyByTwo(float number)
{
return number*2.0f;
}
__device__ float divideByTwo(float number)
{
return number*0.5f;
}
|
942 | #include "includes.h"
__global__ void Return64( unsigned long long *sum, unsigned long long *out, const unsigned long long *pIn )
{
out[threadIdx.x] = atomicAdd( &sum[threadIdx.x], *pIn );
} |
943 | /*
* Copyright 2016 Alexander Terenin
*
* 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 agr... |
944 | #include <stdio.h>
#include <sys/time.h>
#define EPSILON 1.0e-6
struct Particle
{
float3 position;
float3 velocity;
};
__host__ __device__ uint gen_random(uint a, uint b, uint c = 10, uint seed = 10)
{
return (seed*a+b) % c;
}
__device__ void update_position(Particle* part_array_gpu, float dt, uint i)
{
part_a... |
945 | //Based on the work of Andrew Krepps
#include <chrono>
#include <fstream>
#include <random>
#include <stdio.h>
#include <string>
#include <iostream>
typedef struct {
unsigned int a;
unsigned int b;
} MathStruct;
typedef struct {
int add;
int sub;
int mult;
int mod;
int cipher;
} ResultsSt... |
946 | #include <stdio.h>
#include <stdlib.h>
#define SIZE 10
int main(int argc , char **argv){
int * p;
cudaError_t err;
// Should be cudaMalloc((void**)&p,SIZE*sizeof(int))
err=cudaMalloc((void**)&p,SIZE);
if( err != cudaSuccess)
{
printf("CUDA error: %s\n", cudaGetErrorString(err));
exit(-1);
}
cudaF... |
947 | /*
Compiling with nvcc:
nvcc 3d_matrix_allocte.cu -o 3d_matrix_allocte -std=c++11
./3d_matrix_allocte
Sample Output:
Matrix Allocated
Time taken for matrix allocation : 9 microseconds
*/
#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <iostream>
using namespace std;
// The f... |
948 | /******************************************************************************
*
*Computer Engineering Group, Heidelberg University - GPU Computing Exercise 04
*
* Group : TBD
*
* File : kernel.cu
*
* Purpose : Memory Operations Benchmark
*
******************... |
949 | #include "includes.h"
__global__ void prefSumBinTreeCudaMulti(float *a, int n) {
__shared__ float shm[CUDA_THREAD_NUM];
int tid=threadIdx.x;
int bid=blockIdx.x;
int dot=2;//depth of tree
if((tid+1)%dot==0) {
shm[tid]=a[CUDA_THREAD_NUM*bid+tid]+a[CUDA_THREAD_NUM*bid+tid-1];
}
dot*=2;
__syncthreads();
while(dot<=n) {
i... |
950 |
#include"cuda_runtime.h"
#include"device_launch_parameters.h"
#include<stdio.h>
#include<string.h>
#include<time.h>
__global__ void Toggle(char *a, char *b, int n)
{
int tid;
tid = threadIdx.x;
if(a[tid]>='A' && a[tid]<='Z')
{
b[tid]=a[tid]+32;
}
else
{
b[tid]=a[tid]-32;
}
}
int main()
{
clock_t t;
t ... |
951 |
/* Ocelot 0.4.72 issue.
Steve Worley Oct 27 2009
sw@worley.com
Ocelot fails when running kernels using dynamic shared memory, in 32 bit only.
32 bit (ONLY!) Ubuntu 9.04.
CUDA 2.3
Compile with:
nvcc ocbug.cu -lOcelotExecutive -lOcelotTrace -lOcelotIr -lOcelotParser -lhydrazine -lcudart
ru... |
952 | #include <stdio.h>
#include <cuda.h>
#include <stdlib.h>
#include <time.h>
#include <cuda_runtime_api.h>
void printDevProp(cudaDeviceProp devProp)
{
printf("GPU card name - %s\n",devProp.name);
printf("GPU Computation Minor Capability - %d\n",devProp.minor);
printf("GPU Computation Major Capab... |
953 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
__global__ void hello_cuda()
{
printf("Hello World from CUDA!\n");
}
/*
int main()
{
int nx = 16, ny = 4;
//Limit for block size x <= 65536, y <= 2^32-1, z <= 65536
dim3 block(8, 2); //Number of Dimension 3 blocks/threads within ... |
954 | void __global__ calcU_GPU(float3* r, float* u){
//float3* r = (float3*) r_data;
//float* u = (float*) u_data;
//if(threadIdx.x != blockIdx.x){
if(blockIdx.x != threadIdx.x){
float3 r_i = r[blockIdx.x];
float3 r_j = r[threadIdx.x];
int pointer = blockDim.x * blockIdx.x * 9 + (threadIdx.x * 9);
//cuPrint... |
955 | #include <stdio.h>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <cuda_runtime_api.h>
#include <unistd.h>
/******************************************************************************
* This program takes an initial estimate of m and c and finds the associated
* rms error. It is then as a base... |
956 | #include<thrust/host_vector.h>
#include<thrust/device_vector.h>
#include<thrust/sort.h>
#include<thrust/copy.h>
#include<thrust/generate.h>
#include<cstdlib>
int main()
{
thrust::host_vector<int> arr(12);
thrust::generate(arr.begin(),arr.end(),rand);
thrust::device_vector<int> device_array=arr;
thrust:... |
957 | //
// Created by kindr on 2021/4/29.
//
#include "zeroCopyMemory.cuh"
#include "../../common/utils.cuh"
#include <cstdio>
#include <vector>
__global__
void addOne(float *vec, size_t N) {
unsigned idx = blockDim.x * blockIdx.x + threadIdx.x;
if (idx < N) vec[idx] = vec[idx] + 1.f;
}
void zeroCopyMemory(size_t... |
958 | /*
This program counts the number of occurrences of a pattern in a string.
Benchmarking is done between the CPUs sequential execution and GPUs parallel execution to compare the
two approaches to solving the problem.
*/
/*
Note that there is a considerable dependency of the ratio of execution times of the CPU and GPU o... |
959 | #include "includes.h"
__global__ void ReluBackKernel(float* Z, float* dZ, int size){
int id = blockIdx.x * blockDim.x + threadIdx.x;
if(id < size){
if(Z[id] <= 0) dZ[id] = 0;
}
} |
960 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <malloc.h>
__global__ void add(int *x, int *y, int *z)
{
*z = *x + *y;
printf("z is %d\n", *z);
}
int main()
{
//Declaration
int *a, *b, *c;
int *deva, *devb, *devc;
//Dynamic Memory Allocation in H... |
961 | /*
* The code has been written by Karan Bhanot, Abolaji Adesoji, Aditya Joshi and Dhyanjyoti Nath.
*
* Some function definitions are referenced from
* sample code provided by Christopher D. Carothers,
* provided as part of his class assignment of Parallel Computing
* Spring 2020.
*/
// Include headers (including CUD... |
962 | #include <cuda_runtime_api.h>
#include <stdint.h>
__global__ void rect_fwd_kernel(
const float *in_act,
int dim,
float *out_act)
{
int idx = threadIdx.x + blockIdx.x * blockDim.x;
if (idx < dim) {
float x = in_act[idx];
if (x > 0.0f) {
out_act[idx] = x;
} else {
out_act[idx] = 0... |
963 | #include "includes.h"
__global__ void Copy3DKernel ( const unsigned short *d_src, float *d_dst, float min_intensity, const int width, const int height, const int depth ) {
const int baseX = blockIdx.x * blockDim.x + threadIdx.x;
const int baseY = blockIdx.y * blockDim.y + threadIdx.y;
const int baseZ = blockIdx.z * blo... |
964 | #include "lambert_implement.h"
#include "brdf_common.h"
__global__ void
lambert_kernel(float3* pos, unsigned int width, float reflectance)
{
unsigned int x = blockIdx.x*blockDim.x + threadIdx.x;
unsigned int y = blockIdx.y*blockDim.y + threadIdx.y;
float3 pin = pos[y*width+x];
float r = reflectance ... |
965 | //raytracer.mustafaisik.net//
#include "timer.cuh"
Timer::Timer()
: m_start_time(std::chrono::system_clock::now())
{}
//start
void Timer::start()
{
m_start_time = std::chrono::system_clock::now();
}
//getTime
double Timer::getTime()
{
using second = std::chrono::duration<double, std::ratio <1>>;
ret... |
966 | #include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <cuda.h>
#include <cuda_runtime.h>
#define PAGESIZE 32
#define PHYSICAL_MEM_SIZE 32768
#define STORAGE_SIZE 131072
#define DATAFILE "./data.bin"
#define OUTFILE "./snapshot.bin"
typedef unsigned char uchar;
typedef uint32_t u32;... |
967 | /* número por una constante C, se deben realizar dos implementaciones:
a.Tanto C como N deben ser pasados como parámetros al kernel.
b.Tanto C como N deben estar almacenados en la memoria de constantes de la GPU*/
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <stdlib.h>
#i... |
968 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/time.h>
// Comment out this line to enable debug mode
#define NDEBUG
/* time stamp function in milliseconds */
__host__ double getTimeStamp()
{
struct timeval tv;
gettimeofday(&tv, NULL);
return (double)tv.tv_usec / 1000000 + tv.tv_sec... |
969 | #include <cuda_runtime.h>
#include <stdio.h>
#define TILE_SIZE 4
#define INPUT_SIZE 12
#define MASK_WIDTH 5
__constant__ float M[MASK_WIDTH];
__global__ void convolution_shared_memory(float *N, float *P){
int i = blockIdx.x*blockDim.x+threadIdx.x;
__shared__ float N_s[TILE_SIZE];
N_s[threadIdx.x]=N[i];
__syn... |
970 | struct DummyComplexFloat
{
public: float Real;
public: float Imag;
__device__ DummyComplexFloat()
{
Real = 0;
Imag = 0;
}
// Methods
__device__ DummyComplexFloat(float r, float i)
{
Real = r;
Imag = i;
}
__device__ DummyComplexFloat Add(DummyComplexFloat c)
{
return DummyComplexFloat((Real ... |
971 | __global__ void sum_kernel(float *g_odata, float *g_idata, int N)
// Naive kernel
{
// YOUR TASKS:
// - Write a naive kernel where parallel sum reduction is done on a per block basis
// and reduction sum is returned in g_odata.
// - For simplicity, assume kernel only considers a dataset within each block of size... |
972 | #include "includes.h"
__global__ void scale2DArray ( const int dim, const int nwl, const float *zr, const float *xx, float *xx1 ) {
int i = threadIdx.x + blockDim.x * blockIdx.x;
int j = threadIdx.y + blockDim.y * blockIdx.y;
int t = i + j * dim;
if ( i < dim && j < nwl ) {
xx1[t] = zr[j] * xx[t];
}
} |
973 | #include "includes.h"
__global__ void divMat(float *a, int N)
{
int idx = threadIdx.x + blockIdx.x * blockDim.x;
if((idx*N) < (N*N))
a[idx *N] /= N;
} |
974 | #include <stdio.h>
__global__ void jacobi(double * uold, double * unew, double * f, int N, double lambda2){
int blockId = blockIdx.x + blockIdx.y * gridDim.x;
int index = blockId * (blockDim.x * blockDim.y) + (threadIdx.y * blockDim.x) + threadIdx.x;
if(index < N*N){
int M = N+2;
int i = index + M + 1 + 2 * (in... |
975 | #include <chrono>
#include <cuda.h>
#include <fstream>
#include <iostream>
#include <stdint.h>
#include <stdio.h>
__global__ void WakeGpuKernel(int reps)
{
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx >= reps) return;
}
// Calculate one element of matrix per thread
__global__ void FloydSimple(ui... |
976 | #include <stdio.h>
__global__ void hello_GPU(int index){
printf("Hello from GPU%d[%d]!\n", index, threadIdx.x);
}
int main(void) {
printf("Hello from CPU!\n");
hello_GPU<<<1,4>>>(1);
hello_GPU<<<1,6>>>(2);
cudaDeviceSynchronize();
return 0;
}
|
977 | #include <cmath>
#include <fstream>
#include <iomanip>
#include <limits>
#include <stdexcept>
#include <string>
#include <vector>
#include <iostream>
#define N_STEPS 200000
#define DT 60.
#define EPS 1e-3
#define G 6.674e-11
#define GRAVITY_DEVICE_MASS(M0, T) (M0 + 0.5 * M0 * fabs(sin(T/6000)))
#define PLANET_RADIUS (... |
978 | //{{{ save_data_from_device_to_host
//void save_data(cudaStream_t stream, float *device_pointer, float *host_pointer, size_t size) {
void save_data(float *device_pointer, float *host_pointer, size_t size)
{
//{{{ Copy data and set up the GPU constants/variables.
cudaMemcpy(host_pointer, device_pointer, size, cudaM... |
979 | #include <stdio.h>
#include <cuda_runtime.h>
__global__ void checkGlobalVariable();
#define CHECK(call) { \
const cudaError_t error = call; \
if (error != cudaSuccess) { ... |
980 | #include <stdio.h>
#include <math.h>
// sin(x*x)*cos(x)*x - x*x
#define XMIN 0.0
#define XMAX 10.0
#define N 10000
double vh[N], vd[N];
__device__ __host__ double funcion(double x) {
return sin(x*x)*cos(x)*x - x*x;
}
__global__ void kernelEvaluaFuncion(double *v, double xmin, double xmax, int n){... |
981 | // Programação Paralela e Distribuída (Programação paralela em GPUs) (MAB622) (DCC/UFRJ)
// Outubro de 2012
// Prof.: Silvana Rossetto
// Laboratório 1: Introducao ao ambiente de programação CUDA no Linux
// Multiplica duas float*es: A * B = C
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <cstring>
... |
982 | /**
* Copyright 1993-2012 NVIDIA Corporation. All rights reserved.
*
* Please refer to the NVIDIA end user license agreement (EULA) associated
* with this source code for terms and conditions that govern your use of
* this software. Any use, reproduction, disclosure, or distribution of
* this software and relate... |
983 | // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa \
// RUN: -aux-triple x86_64-unknown-linux-gnu \
// RUN: -fcuda-is-device -verify -fsyntax-only %s
// RUN: %clang_cc1 -triple nvptx \
// RUN: -aux-triple x86_64-unknown-linux-gnu \
// RUN: -fcuda-is-device -verify -fsyntax-only %s
// expected-no-diagnostics
#define ... |
984 | #include <stdio.h>
#include "cuda.h"
#define max(x,y) ((x) > (y)? (x) : (y))
#define min(x,y) ((x) < (y)? (x) : (y))
#define ceil(a,b) ((a) % (b) == 0 ? (a) / (b) : ((a) / (b)) + 1)
void check_error (const char* message) {
cudaError_t error = cudaGetLastError ();
if (error != cudaSuccess) {
printf ("CUDA error :... |
985 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include "curand_kernel.h"
#include <stdio.h>
#include <time.h>
__global__ void kernel_set_random(curandState *curand_states,int width,int height,long clock_for_rand)
{
int x = threadIdx.x + blockIdx.x*blockDim.x;
if(x<0 || x>width)
{
... |
986 | #include "includes.h"
__global__ void ComputeSpeQtyKernel (double *Label, double *Dens, double *ExtLabel, int nrad, int nsec)
{
int j = threadIdx.x + blockDim.x*blockIdx.x;
int i = threadIdx.y + blockDim.y*blockIdx.y;
if (i<nrad && j<nsec){
Label[i*nsec + j] = ExtLabel[i*nsec + j]/Dens[i*nsec + j];
/* Compressive flow... |
987 | #include <stdio.h>
#define RADIUS 3
#define BLOCK_SIZE 256
//#define BLOCK_SIZE 8
#define NUM_ELEMENTS (4096*2)
//#define NUM_ELEMENTS (8*2)
// CUDA API error checking macro
#define cudaCheck(error) \
if (error != cudaSuccess) { \
printf("Fatal error: %s at %s:%d\n", \
cudaGetErrorString(er... |
988 | #include <stdio.h>
#define X 9
#define Y 8
#define THREAD_X 3
#define THREAD_Y 2
#define A(i, j) A[i*Y + j]
__global__ void index(int *A){
int i = blockDim.x * blockIdx.x + threadIdx.x;
int j = blockDim.y * blockIdx.y + threadIdx.y;
//A(i, j) = threadIdx.x;
A(i, j) = threadIdx.y;
//A(i ,j) = bloc... |
989 | #include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#include<fstream>
#include<vector>
using namespace std;
// #define num_threads 50
// #define num_edges 700000
// #define num_vertices1 10000
// #define num_vertices2 10000
// #define num_edges 1000000
// #define num_vertices1 ... |
990 | /*
* ExUpdater.cpp
*
* Created on: 01 февр. 2016 г.
* Author: aleksandr
*/
#include "ExUpdater.h"
#include "SmartIndex.h"
// indx - индекс вдоль правой или левой границы по y от firstY до lastY
__host__ __device__
void ExUpdater::operator() (const int indx) {
// correct Ex along the bottom
/*nn = firstY... |
991 | #include "includes.h"
__global__ void deviceAddVector(int *d_a, int *d_b, int *d_c, int size) {
int i = blockIdx.x * blockDim.x + threadIdx.x;
if (i < size) {
d_c[i] = d_a[i] + d_b[i];
// printf("Tread %d make sum %d + %d = %d", i, d_a[i], d_b[i], d_c[i]);
}
} |
992 | #include "includes.h"
__global__ void A_for_lightning_estimation(float* rho, float* N, int npix, float* A) {
int i = blockIdx.x*blockDim.x + threadIdx.x; // pixel index
int c = blockIdx.y*blockDim.y + threadIdx.y; // channel index
int h = blockIdx.z*blockDim.z + threadIdx.z; // harmonic index
if (i < npix) {
A[c*npix *... |
993 | #include <iostream>
#include <math.h>
#include <cuda_runtime.h>
// #include <helper_cuda.h>
// the __global__ keyword changes the function to a CUDA Kernel
__global__
void add(int n, float *x, float *y, float *z)
{
// index of the current thread within it's block
int index = blockIdx.x * blockDim.x + threadIdx... |
994 | #include<iostream>
#include<string>
#include<sstream>
#include<fstream>
#include <cstdio>
#include <vector>
#include <set>
#define SIZE 5 //Matrix size
#define INPUTSIZE 2306451
//THIS IS how many constraints per instance (at max): 60
//THIS IS how many grids: 144000
__device__ bool FindUnassignedLocation(int* matri... |
995 | #include "includes.h"
__global__ void findAdjacencySizesKernel(int size, int *adjIndexes, int *output)
{
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if(idx < size)
{
output[idx] = adjIndexes[idx + 1] - adjIndexes[idx];
}
} |
996 | #include "includes.h"
__global__ void tile_MatrixMul(int* a, int* b, int* c, int n, int tile_size) {
//statically-sized memory
__shared__ int A[Shared_Mem_Size];
__shared__ int B[Shared_Mem_Size];
int tx = threadIdx.x;
int ty = threadIdx.y;
int bx = blockIdx.x;
int by = blockIdx.y;
//cal global row and col postions f... |
997 | #include <thrust/device_vector.h>
#include <thrust/transform.h>
#include <thrust/sequence.h>
#include <thrust/fill.h>
#include <thrust/copy.h>
struct saxpy_functor
{
const float a;
saxpy_functor(float _a) : a(_a) {}
__host__ __device__
int operator()(const int& x, const int& y) const
{
return a * x + ... |
998 | #include "cuda.h"
#include <cassert>
#include <chrono>
#include <iostream>
#include <stdio.h>
#define N 800
#define TPB 16
#define RED_NB 50
#define BigN 4000
#define BigTPB 20
#define memN 200000000
#define memTPB 500
using namespace std;
using chrono_clock = std::chrono::high_resolution_clock;
using sec_dur = std... |
999 | #include "cuda_runtime.h"
#include"stdio.h"
//#include "matrixmul.cuh"
#define BLOCK_SIZE 16
#define A_HEIGHT 128
#define A_WIDTH 128
#define B_HEIGHT 128
#define B_WIDTH 128
#define C_HEIGHT A_HEIGHT
#define C_WIDTH B_WIDTH
__global__ void matrix_mulKernel(int *c, int *a, int *b,
int a_height,int a_width, ... |
1,000 | #include "includes.h"
__device__ int position; //index of the largest value
__device__ int largest; //value of the largest value
int lenString = 593;
int maxNumStrings = 1000000;
int threshold = 2;
__global__ void anyLeft(int *d_c, int *remaining, int size) {
int my_id = blockDim.x * blockIdx.x + threadIdx.x;
if... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.