Skip to content

Commit

Permalink
hostside_openclfuncs_assure_initialized was being inlined, not sure w…
Browse files Browse the repository at this point in the history
…hy...
  • Loading branch information
hughperkins committed Oct 13, 2016
1 parent f2d890f commit 27d14f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ easycl:
cd build && make -j 4

build/hostside_opencl_funcs.o: src/hostside_opencl_funcs.cpp
$(CLANG) -c -o $@ -std=c++11 -O3 -I$(COCL_HOME)/src/EasyCL $<
$(CLANG) -c -o $@ -std=c++11 -O2 -I$(COCL_HOME)/src/EasyCL $<

build/libcocl.a: build/hostside_opencl_funcs.o
ar rcs $@ $^
Expand Down Expand Up @@ -73,8 +73,8 @@ build/test-%.o: test/%.cu
$(COCL_HOME)/bin/cocl -I$(EIGEN_HOME) -I$(EIGEN_HOME)/test -I$(COCL_HOME)/test/eigen -c -o $@ $<

# executables
build/cuda_sample: build/test-cuda_sample.o build/hostside_opencl_funcs.o test/generated/cuda_sample-device.cl
g++ -o $@ $< build/hostside_opencl_funcs.o -lOpenCL -Lbuild -lEasyCL
build/cuda_sample: build/test-cuda_sample.o build/libcocl.a test/generated/cuda_sample-device.cl
g++ -o $@ $< -lcocl -lOpenCL -Lbuild -lEasyCL

build/eigen-%: build/eigen-%.o build/libcocl.a
g++ -o $@ $< -lcocl -lOpenCL -Lbuild -lEasyCL
Expand Down
6 changes: 3 additions & 3 deletions src/hostside_opencl_funcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ static map<void *, int> idxByAddr;
static bool initialized = false;

extern "C" {
void hostside_opencl_funcs_assure_initialized();
void hostside_opencl_funcs_assure_initialized(void);
}

static void hostside_opencl_funcs_init() {
void hostside_opencl_funcs_init() {
cout << "initialize cl context" << endl;
cl.reset(EasyCL::createForFirstGpuOtherwiseCpu());
ctx = cl->context;
queue = cl->queue;
}

void hostside_opencl_funcs_assure_initialized() {
void hostside_opencl_funcs_assure_initialized(void) {
// yes this is not threadsafe. or anything safe really...
if(!initialized) {
hostside_opencl_funcs_init();
Expand Down

0 comments on commit 27d14f4

Please sign in to comment.