Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <pgm.h>
#define MAXITER 255
#define CUDA_SAFE_CALL(E) do { \
cudaError_t e = (E); \
if (e != cudaSuccess) { \
printf("line %d: CUDA error: %s\n", __LINE__, cudaGetErrorString(e)); \
exit(-2); \
@nattoheaven
nattoheaven / gist:4075195
Created November 14, 2012 22:09
CUDA himenoBMT using Bindless Texture
/********************************************************************
This benchmark test program is measuring a cpu performance
of floating point operation by a Poisson equation solver.
If you have any question, please ask me via email.
written by Ryutaro HIMENO, November 26, 2001.
Version 3.0
----------------------------------------------
Ryutaro Himeno, Dr. of Eng.
#include <stdio.h>
#include <omp.h>
#include <sys/time.h>
#ifdef RDRAND
typedef char seed_t;
static inline unsigned int
myrand(seed_t *seed)
{
/********************************************************************
This benchmark test program is measuring a cpu performance
of floating point operation by a Poisson equation solver.
If you have any question, please ask me via email.
written by Ryutaro HIMENO, November 26, 2001.
Version 3.0
----------------------------------------------
Ryutaro Himeno, Dr. of Eng.
#include <stdio.h>
#include <omp.h>
#include <sys/time.h>
#ifdef CURAND
#include <curand.h>
typedef struct {
curandGenerator_t gen;
@nattoheaven
nattoheaven / gist:5863199
Created June 25, 2013 22:55
Test of Transactional Memory
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
static double zr = 0.0;
static double zi = 0.0;
static const double cr = 0.1;
static const double ci = 0.1;
#ifndef TSX
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <immintrin.h>
static volatile double zr = 0.0;
static volatile double zi = 0.0;
static const double cr = 0.1;
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <immintrin.h>
static volatile double zr = 0.0;
static volatile double zi = 0.0;
static const double cr = 0.1;
@nattoheaven
nattoheaven / gist:8114862
Created December 24, 2013 15:39
Test for CUDA overheads with varying numbers of arguments.
#!/usr/bin/ruby
for narg in 0..10 do
File.open('kernel' + narg.to_s + '.cu', 'w') do |kernel|
kernel.write('extern "C" __global__ void kernel(');
for iarg in 0...narg do
if (iarg != 0) then
kernel.write(',');
end
kernel.write('void *a');
@nattoheaven
nattoheaven / gist:8285191
Created January 6, 2014 16:17
Test for CUDA overheads when using Dynamic Parallelism.
#!/usr/bin/ruby
for narg in 0..10 do
File.open('kernel_dp' + narg.to_s + '.cu', 'w') do |kernel|
kernel.write('extern "C" __global__ void kernel(');
for iarg in 0...narg do
if (iarg != 0) then
kernel.write(',');
end
kernel.write('void *a');