Skip to content

Instantly share code, notes, and snippets.

SUBROUTINE SEARCH1(IDATA,IDX,INPUT,IOUT,N)
IMPLICIT NONE
INTEGER IDATA,IDX,INPUT,IOUT,I,N,IL,IR,IC
DIMENSION IDATA(N),IDX(N),INPUT(N),IOUT(N)
DO 20 I=1,N
IL=1
IR=N
30 IC=(IL+IR)/2
IF(IDATA(IDX(IC)).EQ.INPUT(I))THEN
IOUT(I)=IC
@nattoheaven
nattoheaven / gist:9369884
Last active August 29, 2015 13:57
Test for HSA Example
#include <iostream>
#include <string>
#include <ctime>
#define _mm_malloc(a, b) _aligned_malloc(a, b)
#include <CL/cl.h>
const char triad_kernel[] =
"__kernel void\n"
@nattoheaven
nattoheaven / gist:e7c67a2abef884b8319c
Created May 19, 2014 23:39
Test for Precision with Vectorization
#include <stdio.h>
#include <xmmintrin.h>
int
main()
{
int i;
float fi;
union {
int i;
@nattoheaven
nattoheaven / glclinterop.cpp
Created February 7, 2015 04:47
Test for OpenGL-OpenCL Interoperations
#if defined(__APPLE__)
#include <OpenGL/CGLCurrent.h>
#include <GLUT/glut.h>
#include <OpenCL/cl_gl_ext.h>
#else
#if defined(_WIN32) || defined(_WIN64)
#include <GL/glew.h>
#else
#include <GL/glxew.h>
#endif
#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