Comments (4)
Hi,
There is! SYCL_DEVICE_ONLY is defined when the device compiler is compiling the code, and not otherwise. You should be careful though, there can be some real problems if you use conditional compilation where the device compiler is concerned (for example, if you capture a variable but only inside the scope of SYCL_DEVICE_ONLY, you're going to get at least weird behaviour but probably just crashes). If you can tell me, what's your use case?
from computecpp-sdk.
I'm using computecpp 0.5.0 with Visual Studio 2015+CMake 3.10 and I also use the https://github.com/sakra/cotire module for precompiled header management. Unfortunately cotire will remove the /FI(force include) option added by add_sycl_to_target function(the reason is unclear for now). So I try to include the generated .sycl header in another way:
#include "stdafx.h"
#ifndef __clang__
#include "mysource.cpp.sycl"
#endif
If the source code is being compiled by the compute++ compiler, then do not include the .sycl file, and if the source code is being compiled by the Visual C++ compiler, then include it.
Above code works for me, but it would be better to use a SYCL or ComputeCpp specific definition. SYCL_DEVICE_ONLY seems to have no effect for this use case.
from computecpp-sdk.
There aren't any ComputeCpp specific ones. This didn't work because I'm a victim of highlighting!
#ifndef __SYCL_DEVICE_ONLY__
#include "thefile.sycl"
#endif
I've never used cotire, kind of annoying that it removes the force include. Something that might be interesting to you is the include-after property as documented in the CMake files and in the "using function objects" sample code. It changes the actual target of the compilation to the sycl file, it might work but I'm guessing it might also just totally fail as a force include is still used to make everything work properly.
from computecpp-sdk.
Added the underscores and it works as expected. Thank you.
from computecpp-sdk.
Related Issues (20)
- terminate called after throwing an instance of 'cl::sycl::invalid_object_error' HOT 6
- CE1.3.0 ptxas fatal : Ptx assembly aborted due to errors (VS2015 + Win10) HOT 8
- Using compute++ with compiler different from /usr/bin/c++ HOT 7
- Terminated after throwing instance of cl::sycl::invalid_object_error HOT 13
- Can't compile samples: missing standard c++ headers HOT 12
- error: no matching function for call to 'clCreateProgramWithSource' HOT 5
- Enabling __CUDACC__ is a bold move HOT 3
- is_accessor trait requires exactly 5 template arguments HOT 4
- Error when running SYCL program with ComputeCpp on CMake : 'cl::sycl::invalid_object_error' HOT 5
- simple-vector-add.cpp throws cl::sycl::compile_program_error exception HOT 4
- Running SYCL program in MSVC Debug mode throws std::bad_array_new_length HOT 9
- cmath not found: Missing Header HOT 5
- atomic add for double HOT 1
- can't download computecpp HOT 1
- samples about atomic op
- about __SYCL_DEVICE_ONLY__ macro HOT 1
- Has ComputeCpp_DIR worked, ever? HOT 4
- Missing ComputeCpp.props error HOT 4
- Exception when running VS example code HOT 5
- MSVC new project not running HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from computecpp-sdk.