Skip to content

Instantly share code, notes, and snippets.

View ddemidov's full-sized avatar

Denis Demidov ddemidov

View GitHub Profile
@ddemidov
ddemidov / Makefile
Created June 13, 2012 18:38
Hello world in OpenCL
hello: hello.cpp
g++ -std=c++0x -o hello hello.cpp -lOpenCL
@ddemidov
ddemidov / Makefile
Created June 13, 2012 18:39
Hello world in VexCL
VEXCL_ROOT=/usr/include
hello: hello.cpp
g++ -std=c++0x -o hello hello.cpp -I$(VEXCL_ROOT) -lOpenCL -lboost_system
@ddemidov
ddemidov / gist:3992260
Created November 1, 2012 07:05 — forked from headmyshoulder/gist:3992253
sfinae enabler
/*
* third.cpp
* Date: 2012-11-01
* Author: Karsten Ahnert (karsten.ahnert@gmx.de)
*/
#include <iostream>
#include <boost/utility/enable_if.hpp>
#define tab "\t"
@ddemidov
ddemidov / a.h
Created January 14, 2013 05:15
static global vs static member
#ifndef A_H
#define A_H
template <class T>
struct A {
static int a;
};
template <class T>
int A<T>::a;
@ddemidov
ddemidov / vector_sum.cpp
Last active December 16, 2015 07:19
Bug in AMD OpenCL implementation
#include <iostream>
#include <vector>
#include <string>
#include <stdexcept>
#define __CL_ENABLE_EXCEPTIONS
#include <CL/cl.hpp>
//---------------------------------------------------------------------------
void precondition(bool cond, const std::string &msg) {
@ddemidov
ddemidov / compiler_bug.cpp
Created May 14, 2013 07:47
A bug in AMD OpenCL compiler
#include <iostream>
#include <vector>
#include <string>
#include <stdexcept>
#define __CL_ENABLE_EXCEPTIONS
#include <CL/cl.hpp>
//---------------------------------------------------------------------------
void precondition(bool cond, const std::string &msg) {
#if defined(cl_khr_fp64)
# pragma OPENCL EXTENSION cl_khr_fp64: enable
#elif defined(cl_amd_fp64)
# pragma OPENCL EXTENSION cl_amd_fp64: enable
#endif
typedef double real;
real read_x(
long g_id,
ulong n,
char has_left, char has_right,
@ddemidov
ddemidov / vecsum.cpp
Created September 8, 2013 13:29
Kernel caching performance test
#include <vexcl/vexcl.hpp>
#include <vexcl/external/boost_compute.hpp>
int main() {
const size_t n = 1 << 20;
const size_t m = 1 << 10;
vex::Context ctx( vex::Filter::Env && vex::Filter::Count(1) );
std::cout << ctx << std::endl;
@ddemidov
ddemidov / Makefile
Last active December 27, 2015 16:09
zero: zero.cpp
g++ -std=c++0x -o zero zero.cpp -lOpenCL