Merge pull request #36 from wyaneva/master
Updated the Makefile for SYCL
This commit is contained in:
commit
18c20efbfe
@ -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
|
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
|
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
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
@ -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 << "Driver: " << getDeviceDriver(device_index) << std::endl;
|
||||||
std::cout << "Reduction kernel config: " << dot_num_groups << " groups of size " << dot_wgsize << 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 */
|
/* Pre-build the kernels */
|
||||||
p = new program(queue->get_context());
|
p = new program(queue->get_context());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user