Merge pull request #36 from wyaneva/master

Updated the Makefile for SYCL
This commit is contained in:
James Price 2017-08-01 11:22:54 +01:00 committed by GitHub
commit 18c20efbfe
2 changed files with 23 additions and 4 deletions

View File

@ -1,11 +1,11 @@
COMPUTECPP_FLAGS = $(shell computecpp_info --dump-device-compiler-flags)
COMPUTECPP_FLAGS = $(shell $(COMPUTECPP_PACKAGE_ROOT_DIR)/bin/computecpp_info --dump-device-compiler-flags)
sycl-stream: main.cpp SYCLStream.cpp SYCLStream.sycl
$(CXX) -O3 -std=c++11 -DSYCL main.cpp SYCLStream.cpp -include SYCLStream.sycl $(EXTRA_FLAGS) -lComputeCpp -lOpenCL -o $@
$(CXX) -O3 -std=c++11 -DSYCL main.cpp SYCLStream.cpp -I$(COMPUTECPP_PACKAGE_ROOT_DIR)/include -include SYCLStream.sycl $(EXTRA_FLAGS) -L$(COMPUTECPP_PACKAGE_ROOT_DIR)/lib -lComputeCpp -lOpenCL -Wl,--rpath=$(COMPUTECPP_PACKAGE_ROOT_DIR)/lib/ -o $@
SYCLStream.sycl: SYCLStream.cpp
compute++ SYCLStream.cpp $(COMPUTECPP_FLAGS) -c
$(COMPUTECPP_PACKAGE_ROOT_DIR)/bin/compute++ SYCLStream.cpp $(COMPUTECPP_FLAGS) -c -I$(COMPUTECPP_PACKAGE_ROOT_DIR)/include -o $@
.PHONY: clean
clean:

View File

@ -47,7 +47,26 @@ SYCLStream<T>::SYCLStream(const unsigned int ARRAY_SIZE, const int device_index)
std::cout << "Driver: " << getDeviceDriver(device_index) << std::endl;
std::cout << "Reduction kernel config: " << dot_num_groups << " groups of size " << dot_wgsize << std::endl;
queue = new cl::sycl::queue(dev);
queue = new cl::sycl::queue(dev, [&](cl::sycl::exception_list l)
{
bool error = false;
for(auto e: l)
{
try
{
std::rethrow_exception(e);
}
catch (cl::sycl::exception e)
{
std::cout << e.what();
error = true;
}
}
if(error)
{
throw std::runtime_error("SYCL errors detected");
}
});
/* Pre-build the kernels */
p = new program(queue->get_context());