Giter Site home page Giter Site logo

Comments (4)

DuncanMcBain avatar DuncanMcBain commented on May 30, 2024

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.

wdx04 avatar wdx04 commented on May 30, 2024

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.

DuncanMcBain avatar DuncanMcBain commented on May 30, 2024

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.

wdx04 avatar wdx04 commented on May 30, 2024

Added the underscores and it works as expected. Thank you.

from computecpp-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.