From d7d3e04b80fe04412d9b08214ceb129817fcac12 Mon Sep 17 00:00:00 2001 From: Christopher Di Bella Date: Wed, 11 Oct 2017 13:30:48 +0100 Subject: [PATCH 1/5] Made changes to build system so that it can compile with MSVC. Disabled testing for MSVC --- CMakeLists.txt | 5 ++++- cmake/Modules/FindComputeCpp.cmake | 20 +++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fcaad1..ce9ec9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,10 @@ include_directories("include") add_subdirectory (src) add_subdirectory (examples) -add_subdirectory (tests) + +if (NOT WIN32) + add_subdirectory (tests) +endif() if (PARALLEL_STL_BENCHMARKS) add_subdirectory (benchmarks) diff --git a/cmake/Modules/FindComputeCpp.cmake b/cmake/Modules/FindComputeCpp.cmake index 5e08902..ac23aa0 100644 --- a/cmake/Modules/FindComputeCpp.cmake +++ b/cmake/Modules/FindComputeCpp.cmake @@ -97,15 +97,29 @@ else() endif() # Obtain the path to the ComputeCpp runtime library -find_library(COMPUTECPP_RUNTIME_LIBRARY ComputeCpp PATHS ${COMPUTECPP_PACKAGE_ROOT_DIR} + +if (WIN32) + set(COMPUTECPP_RUNTIME_LIBRARY_ID "ComputeCpp_vs2015") + set(EXT ".lib") + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(COMPUTECPP_RUNTIME_LIBRARY_ID "${COMPUTECPP_RUNTIME_LIBRARY_ID}_d") + endif() + +else() + set(COMPUTECPP_RUNTIME_LIBRARY_ID "ComputeCpp") + set(EXT ".so") +endif() + + +find_library(COMPUTECPP_RUNTIME_LIBRARY ${COMPUTECPP_RUNTIME_LIBRARY_ID} PATHS ${COMPUTECPP_PACKAGE_ROOT_DIR} HINTS ${COMPUTECPP_PACKAGE_ROOT_DIR}/lib PATH_SUFFIXES lib DOC "ComputeCpp Runtime Library" NO_DEFAULT_PATH) if (EXISTS ${COMPUTECPP_RUNTIME_LIBRARY}) mark_as_advanced(COMPUTECPP_RUNTIME_LIBRARY) - message(STATUS "libComputeCpp.so - Found") + message(STATUS "${COMPUTECPP_RUNTIME_LIBRARY_ID}${EXT} - Found") else() - message(FATAL_ERROR "libComputeCpp.so - Not found!") + message(FATAL_ERROR "${COMPUTECPP_RUNTIME_LIBRARY_ID}${EXT} - Not found!") endif() # Obtain the ComputeCpp include directory From 8c765c4d33b4f097239e86b06449e76f14ad2acc Mon Sep 17 00:00:00 2001 From: Christopher Di Bella Date: Mon, 16 Oct 2017 17:53:25 +0100 Subject: [PATCH 2/5] Updated FindComputeCpp.cmake to the most recent version --- benchmarks/CMakeLists.txt | 4 +- cmake/Modules/FindComputeCpp.cmake | 187 +++++++++++++++++++++-------- examples/CMakeLists.txt | 4 +- tests/CMakeLists.txt | 4 +- 4 files changed, 143 insertions(+), 56 deletions(-) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 63769c0..7d3e26b 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -12,8 +12,8 @@ foreach(file ${EXAMPLE_FILES}) target_link_libraries(${SOURCE_NAME} PUBLIC ${CMAKE_THREAD_LIBS_INIT}) - add_sycl_to_target(${SOURCE_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp - ${CMAKE_CURRENT_BINARY_DIR}) + add_sycl_to_target(${SOURCE_NAME} ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp) endforeach() diff --git a/cmake/Modules/FindComputeCpp.cmake b/cmake/Modules/FindComputeCpp.cmake index ac23aa0..e73d417 100644 --- a/cmake/Modules/FindComputeCpp.cmake +++ b/cmake/Modules/FindComputeCpp.cmake @@ -18,14 +18,14 @@ # limitations under the License. ######################### -# FindComputeCpp.cmake +# FindComputeCpp.cmake ######################### # # Tools for finding and building with ComputeCpp. # -# User must define COMPUTECPP_PACKAGE_ROOT_DIR pointing to the ComputeCpp +# User must define COMPUTECPP_PACKAGE_ROOT_DIR pointing to the ComputeCpp # installation. -# +# # Latest version of this file can be found at: # https://github.com/codeplaysoftware/computecpp-sdk @@ -38,11 +38,6 @@ if(CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) message(FATAL_ERROR "host compiler - Not found! (gcc version must be at least 4.8)") - # Require the GCC dual ABI to be disabled for 5.1 or higher - elseif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.1) - set(COMPUTECPP_DISABLE_GCC_DUAL_ABI "True") - message(STATUS - "host compiler - gcc ${CMAKE_CXX_COMPILER_VERSION} (note pre 5.1 gcc ABI enabled)") else() message(STATUS "host compiler - gcc ${CMAKE_CXX_COMPILER_VERSION}") endif() @@ -54,9 +49,6 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") else() message(STATUS "host compiler - clang ${CMAKE_CXX_COMPILER_VERSION}") endif() -else() - message(WARNING - "host compiler - Not found! (ComputeCpp supports GCC and Clang, see readme)") endif() set(COMPUTECPP_64_BIT_DEFAULT ON) @@ -64,17 +56,29 @@ option(COMPUTECPP_64_BIT_CODE "Compile device code in 64 bit mode" ${COMPUTECPP_64_BIT_DEFAULT}) mark_as_advanced(COMPUTECPP_64_BIT_CODE) +option(COMPUTECPP_DISABLE_GCC_DUAL_ABI "Compile with pre-5.1 ABI" OFF) +mark_as_advanced(COMPUTECPP_DISABLE_GCC_DUAL_ABI) + +set(COMPUTECPP_USER_FLAGS "" CACHE STRING "User flags for compute++") +mark_as_advanced(COMPUTECPP_USER_FLAGS) + +# Platform-specific arguments +if(MSVC) + # Workaround to an unfixed Clang bug, rationale: + # https://github.com/codeplaysoftware/computecpp-sdk/pull/51#discussion_r139399093 + set (COMPUTECPP_PLATFORM_SPECIFIC_ARGS "-fno-ms-compatibility") +endif() + # Find OpenCL package find_package(OpenCL REQUIRED) -# Find ComputeCpp packagee +# Find ComputeCpp package if(NOT COMPUTECPP_PACKAGE_ROOT_DIR) message(FATAL_ERROR - "ComputeCpp package - Not found! (please set COMPUTECPP_PACKAGE_ROOT_DIR") + "ComputeCpp package - Not found! (please set COMPUTECPP_PACKAGE_ROOT_DIR)") else() message(STATUS "ComputeCpp package - Found") endif() -option(COMPUTECPP_PACKAGE_ROOT_DIR "Path to the ComputeCpp Package") # Obtain the path to compute++ find_program(COMPUTECPP_DEVICE_COMPILER compute++ PATHS @@ -97,29 +101,37 @@ else() endif() # Obtain the path to the ComputeCpp runtime library +find_library(COMPUTECPP_RUNTIME_LIBRARY + NAMES ComputeCpp ComputeCpp_vs2015 + PATHS ${COMPUTECPP_PACKAGE_ROOT_DIR} + HINTS ${COMPUTECPP_PACKAGE_ROOT_DIR}/lib PATH_SUFFIXES lib + DOC "ComputeCpp Runtime Library" NO_DEFAULT_PATH) -if (WIN32) - set(COMPUTECPP_RUNTIME_LIBRARY_ID "ComputeCpp_vs2015") - set(EXT ".lib") - if (CMAKE_BUILD_TYPE STREQUAL "Debug") - set(COMPUTECPP_RUNTIME_LIBRARY_ID "${COMPUTECPP_RUNTIME_LIBRARY_ID}_d") - endif() - +if (EXISTS ${COMPUTECPP_RUNTIME_LIBRARY}) + mark_as_advanced(COMPUTECPP_RUNTIME_LIBRARY) else() - set(COMPUTECPP_RUNTIME_LIBRARY_ID "ComputeCpp") - set(EXT ".so") + message(FATAL_ERROR "ComputeCpp Runtime Library - Not found!") endif() - -find_library(COMPUTECPP_RUNTIME_LIBRARY ${COMPUTECPP_RUNTIME_LIBRARY_ID} PATHS ${COMPUTECPP_PACKAGE_ROOT_DIR} +find_library(COMPUTECPP_RUNTIME_LIBRARY_DEBUG + NAMES ComputeCpp ComputeCpp_vs2015_d + PATHS ${COMPUTECPP_PACKAGE_ROOT_DIR} HINTS ${COMPUTECPP_PACKAGE_ROOT_DIR}/lib PATH_SUFFIXES lib - DOC "ComputeCpp Runtime Library" NO_DEFAULT_PATH) + DOC "ComputeCpp Debug Runtime Library" NO_DEFAULT_PATH) -if (EXISTS ${COMPUTECPP_RUNTIME_LIBRARY}) - mark_as_advanced(COMPUTECPP_RUNTIME_LIBRARY) - message(STATUS "${COMPUTECPP_RUNTIME_LIBRARY_ID}${EXT} - Found") +if (EXISTS ${COMPUTECPP_RUNTIME_LIBRARY_DEBUG}) + mark_as_advanced(COMPUTECPP_RUNTIME_LIBRARY_DEBUG) else() - message(FATAL_ERROR "${COMPUTECPP_RUNTIME_LIBRARY_ID}${EXT} - Not found!") + message(FATAL_ERROR "ComputeCpp Debug Runtime Library - Not found!") +endif() + +# NOTE: Having two sets of libraries is Windows specific, not MSVC specific. +# Compiling with Clang on Windows would still require linking to both of them. +if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + message(STATUS "ComputeCpp runtime (Release): ${COMPUTECPP_RUNTIME_LIBRARY} - Found") + message(STATUS "ComputeCpp runtime (Debug) : ${COMPUTECPP_RUNTIME_LIBRARY_DEBUG} - Found") +else() + message(STATUS "ComputeCpp runtime: ${COMPUTECPP_RUNTIME_LIBRARY} - Found") endif() # Obtain the ComputeCpp include directory @@ -167,8 +179,21 @@ else() endif() endif() +# This property allows targets to specify that their sources should be +# compiled with the integration header included after the user's +# sources, not before (e.g. when an enum is used in a kernel name, this +# is not technically valid SYCL code but can work with ComputeCpp) +define_property( + TARGET PROPERTY COMPUTECPP_INCLUDE_AFTER + BRIEF_DOCS "Include integration header after user source" + FULL_DOCS "Changes compiler arguments such that the source file is + actually the integration header, and the .cpp file is included on + the command line so that it is seen by the compiler first. Enables + non-standards-conformant SYCL code to compile with ComputeCpp." +) + #################### -# __build_sycl +# __build_sycl #################### # # Adds a custom target for running compute++ and adding a dependency for the @@ -177,9 +202,12 @@ endif() # targetName : Name of the target. # sourceFile : Source file to be compiled. # binaryDir : Intermediate directory to output the integration header. +# fileCounter : Counter included in name of custom target. Different counter +# values prevent duplicated names of custom target when source files with the same name, +# but located in different directories, are used for the same target. # -function(__build_spir targetName sourceFile binaryDir) - +function(__build_spir targetName sourceFile binaryDir fileCounter) + # Retrieve source file name. get_filename_component(sourceFileName ${sourceFile} NAME) @@ -187,12 +215,16 @@ function(__build_spir targetName sourceFile binaryDir) set(outputSyclFile ${binaryDir}/${sourceFileName}.sycl) # Add any user-defined include to the device compiler + set(device_compiler_includes "") get_property(includeDirectories DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) - set(device_compiler_includes "") foreach(directory ${includeDirectories}) set(device_compiler_includes "-I${directory}" ${device_compiler_includes}) endforeach() + get_target_property(targetIncludeDirectories ${targetName} INCLUDE_DIRECTORIES) + foreach(directory ${targetIncludeDirectories}) + set(device_compiler_includes "-I${directory}" ${device_compiler_includes}) + endforeach() if (CMAKE_INCLUDE_PATH) foreach(directory ${CMAKE_INCLUDE_PATH}) set(device_compiler_includes "-I${directory}" @@ -200,6 +232,25 @@ function(__build_spir targetName sourceFile binaryDir) endforeach() endif() + # Obtain language standard of the file + set(device_compiler_cxx_standard) + get_target_property(targetCxxStandard ${targetName} CXX_STANDARD) + if (targetCxxStandard MATCHES 17) + set(device_compiler_cxx_standard "-std=c++1z") + elseif (targetCxxStandard MATCHES 14) + set(device_compiler_cxx_standard "-std=c++14") + elseif (targetCxxStandard MATCHES 11) + set(device_compiler_cxx_standard "-std=c++11") + elseif (targetCxxStandard MATCHES 98) + message(FATAL_ERROR "SYCL implementations cannot be compiled using C++98") + else () + set(device_compiler_cxx_standard "") + endif() + + set(COMPUTECPP_DEVICE_COMPILER_FLAGS + ${device_compiler_cxx_standard} + ${COMPUTECPP_DEVICE_COMPILER_FLAGS} + ${COMPUTECPP_USER_FLAGS}) # Convert argument list format separate_arguments(COMPUTECPP_DEVICE_COMPILER_FLAGS) @@ -214,22 +265,48 @@ function(__build_spir targetName sourceFile binaryDir) -o ${outputSyclFile} -c ${sourceFile} DEPENDS ${sourceFile} + IMPLICIT_DEPENDS CXX ${sourceFile} WORKING_DIRECTORY ${binaryDir} - COMMENT "Building ComputeCpp integration header file ${outputSyclFile}") + COMMENT "Building ComputeCpp integration header file ${outputSyclFile}") + # Name: + # (user-defined name)_(source file)_(counter)_ih + set(headerTargetName + ${targetName}_${sourceFileName}_${fileCounter}_ih) + # Add a custom target for the generated integration header - add_custom_target(${targetName}_integration_header DEPENDS ${outputSyclFile}) + add_custom_target(${headerTargetName} DEPENDS ${outputSyclFile}) # Add a dependency on the integration header - add_dependencies(${targetName} ${targetName}_integration_header) + add_dependencies(${targetName} ${headerTargetName}) # Force inclusion of the integration header for the host compiler - set(compileFlags -include ${outputSyclFile} "-Wall") - target_compile_options(${targetName} PUBLIC ${compileFlags}) + if(MSVC) + # NOTE: The Visual Studio generators parse compile flags differently, + # hence the different argument syntax + if(CMAKE_GENERATOR MATCHES "Visual Studio") + set(forceIncludeFlags "/FI\"${outputSyclFile}\"") + else() + set(forceIncludeFlags /FI ${outputSyclFile}) + endif() + else() + # This property can be set on a per-target basis to indicate that the + # integration header should appear after the main source listing + get_property(includeAfter TARGET ${targetName} + PROPERTY COMPUTECPP_INCLUDE_AFTER) + if(includeAfter) + # Change the source file to the integration header - i.e. + # g++ -c source_file_name.cpp.sycl + set_property(TARGET ${targetName} PROPERTY SOURCES ${outputSyclFile}) + # CMake/gcc don't know what language a .sycl file is, so tell them + set_property(SOURCE ${outputSyclFile} PROPERTY LANGUAGE CXX) + set(forceIncludeFlags -include ${sourceFile} -x c++) + else() + set(forceIncludeFlags -include ${outputSyclFile}) + endif() + endif() + target_compile_options(${targetName} PUBLIC ${forceIncludeFlags}) - # Set the host compiler C++ standard to C++11 - set_property(TARGET ${targetName} PROPERTY CXX_STANDARD 11) - # Disable GCC dual ABI on GCC 5.1 and higher if(COMPUTECPP_DISABLE_GCC_DUAL_ABI) set_property(TARGET ${targetName} APPEND PROPERTY COMPILE_DEFINITIONS @@ -246,17 +323,27 @@ endfunction() # target and sets a dependancy on that new command. # # targetName : Name of the target to add a SYCL to. -# sourceFile : Source file to be compiled for SYCL. # binaryDir : Intermediate directory to output the integration header. +# sourceFiles : Source files to be compiled for SYCL. # -function(add_sycl_to_target targetName sourceFile binaryDir) - +function(add_sycl_to_target targetName binaryDir sourceFiles) + + set(sourceFiles ${sourceFiles} ${ARGN}) + set(fileCounter 0) + target_include_directories( + ${targetName} SYSTEM + PRIVATE ${OpenCL_INCLUDE_DIR} + PRIVATE ${COMPUTECPP_INCLUDE_DIRECTORY} + ) # Add custom target to run compute++ and generate the integration header - __build_spir(${targetName} ${sourceFile} ${binaryDir}) + foreach(sourceFile ${sourceFiles}) + __build_spir(${targetName} ${sourceFile} ${binaryDir} ${fileCounter}) + MATH(EXPR fileCounter "${fileCounter} + 1") + endforeach() # Link with the ComputeCpp runtime library - target_link_libraries(${targetName} PUBLIC ${COMPUTECPP_RUNTIME_LIBRARY} - PUBLIC ${OpenCL_LIBRARIES}) - -endfunction(add_sycl_to_target) + target_link_libraries(${targetName} PUBLIC $<$,$>:${COMPUTECPP_RUNTIME_LIBRARY_DEBUG}> + $<$,$>>:${COMPUTECPP_RUNTIME_LIBRARY}> + ${OpenCL_LIBRARIES}) +endfunction(add_sycl_to_target) \ No newline at end of file diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 6d7ddb3..ac616c6 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -13,7 +13,7 @@ foreach(file ${BENCHMARK_FILES}) target_compile_options(${SOURCE_NAME} PUBLIC ${HOST_COMPILER_OPTIONS}) target_link_libraries(${SOURCE_NAME} PUBLIC ${CMAKE_THREAD_LIBS_INIT}) - add_sycl_to_target(${SOURCE_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp - ${CMAKE_CURRENT_BINARY_DIR}) + add_sycl_to_target(${SOURCE_NAME} ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp) endforeach() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f518412..de00e1a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -36,8 +36,8 @@ if (EXISTS ${GMOCK_LIB_PATH}) target_link_libraries(${TEST_NAME} PUBLIC ${CMAKE_THREAD_LIBS_INIT}) add_sycl_to_target(${TEST_NAME} - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp - ${CMAKE_CURRENT_BINARY_DIR}) + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_NAME}.cpp) add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) endforeach() From aeae34cea8808a5ce5dc6cf5a35e5c2a953bf002 Mon Sep 17 00:00:00 2001 From: Christopher Di Bella Date: Mon, 13 Nov 2017 13:32:07 +0000 Subject: [PATCH 3/5] Detailed how to setup for MSVC 2015 and WSL. --- README.md | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 94 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 4e87c9e..49d60cd 100644 --- a/README.md +++ b/README.md @@ -62,15 +62,16 @@ the amount of information copied in and out * the ability to specify a queue to the SYCL policy so that the queue is used for the various kernels (potentially enabling asynchronous execution of the calls). -Building the project ----------------------- +## Building the project This project currently supports the SYCL beta implementation from Codeplay, -ComputeCPP and the open-source triSYCL implementation. +ComputeCpp and the open-source triSYCL implementation. The project uses CMake 3.5 in order to produce build files, but more recent versions may work. +### Linux + In Linux, simply create a build directory and run CMake as follows: $ mkdir build @@ -81,7 +82,7 @@ In Linux, simply create a build directory and run CMake as follows: Usual CMake options are available (e.g. building debug or release). Makefile and Ninja generators are supported on Linux. -To simplify configuration, the `FindComputeCpp` cmake module from the ComputeCPP +To simplify configuration, the `FindComputeCpp` cmake module from the ComputeCpp SDK is included verbatim in this package within the `cmake/Modules/` directory. If Google Mock is found in external/gmock, a set of unit tests is built. @@ -135,6 +136,90 @@ features are used, you can ignore those messages as these features do not affect the benchmarks executions, if you wish you can also contribute to the triSYCL implementation to make those messages definitely disapear. +### Microsoft Windows + +**Note: this is still under development, and has only been tested on Microsoft Windows 10.** + +**Note: these steps assume the user will be using Microsfot Visual Studio 2017. Subtle details may +vary if you are using Microsoft Visual Studio 2015, or a version of Visual Studio released _after_ +2017. The supported compiler is Microsoft Visual C++ 2015, not Microsoft Visual C++ 2017.** + +1. Download and install the Microsoft Visual C++ 2015 compiler (typically achieved by installing +[Microsoft Visual Studio 2017 Community Edition](https://www.visualstudio.com/downloads)). +2. Download and install the [Codeplay ComputeCpp Community Edition SDK for Windows](). +3. Open _Developer Command Prompt for VS 2017_. +4. Enter the following commands +```bash +mkdir SyclParallelSTL +cd SyclParallelSTL +mkdir build-debug +git clone https://github.com/KhronosGroup/SyclParallelSTL.git +cd build-debug +cmake -G"Visual Studio 14 2015 Win64" -DCOMPUTECPP_PACKAGE_ROOT_DIR= ../SyclParallelSTL +``` + +where `` is the path to your ComputeCpp directory. For example, a default +installation of ComputeCpp on a 64-bit build of Windows 10 will be `C:\\Program Files\\Codeplay\\ComputeCpp`. + +5. Open `SyclSTL.sln` using Microsoft Visual Studio. If you are not using Visual Studio 2015, be + sure not to convert the solution to a later version. +6. Right-mouse click on `ALL_BUILD (Visual Studio 2015)` and select `Build`. + +### Microsoft Windows Subsystem for Linux (Bash on Windows) + +#### Prerequisites + +* Ensure that WSL has been installed after installing the Windows 10 Fall Creators Update (version + 1709). You can do this by opening Bash on Windows and typing the command `lsb_release -a` and +* CMake 3.5 or later (either installed natively or built from source) +* GCC 5 or later + +#### Installing Windows Subsystem for Linux (a.k.a. Bash for Windows) + +1. Ensure that you have installed Windows 10 Fall Creators Update (version 1709), or later. +2. Open Start Menu +3. Type 'Developers Settings' and press Enter +4. Under 'Use developer features', ensure that 'Developer mode' is selected. +5. If prompted to reboot your computer, do not reboot. +6. Open Computer +7. Under the Computer tab, select 'Uninstall or change a program' +8. In the left-hand pane, select 'Turn Windows features on or off' +9. Scroll to the very bottom and select 'Windows Subsystem for Linux (Beta)' +10. Reboot Windows +11. Open Start Menu +12. Type 'Bash' and press Enter. Make sure that you aren't opening a mintty client such as Git Bash or Cygwin. +13. A command prompt window should open, and take you through the final part of the installation process. + +#### Install developer tools + +1. Type the following commands into Bash. Replace `` with your Windows username. + +```bash +sudo apt update && sudo apt upgrade && sudo apt update +sudo apt install build-essentials binutils gdb git flex bison texlive-full +mkdir /mnt/c/Users//projects; cd /mnt/c/Users//projects +git clone https://github.com/Kitware/CMake.git +cd CMake +./bootstrap && make -j 4 && sudo make install +cd .. +sudo apt install ocl-icd-libopencl1 ocl-icd-dev opencl-headers clinfo lsb-core +``` + +2. [Download the latest OpenCL CPU driver for Ubuntu](https://software.intel.com/en-us/articles/opencl-drivers#latest_CPU_runtime). +3. Run the following commands to install the OpenCL driver. +```bash +cd +tar -xf .tar.gz +cd +sudo ./install.sh +``` +4. [Install OpenCL SDK for Windows](https://software.intel.com/en-us/intel-opencl). +5. Install [ComputeCpp-setup-v1.0](). + +#### Building SYCL ParallelSTL + +Once you have installed all the developer tools, follow the steps outlined for Ubuntu. + Building the documentation ---------------------------- @@ -150,16 +235,18 @@ This will generate the html pages inside the doc\_output directory. Limitations ------------ -* The Lambda functions that you can pass to the algorithms have the same +* The lambda expressions that you can pass to the algorithms have the same restrictions as any SYCL kernel. See the SYCL specification for details on the limitations. -* While using lambda functions, the compiler needs to find a name for that lambda -function. To provide a lambda name, the user has to do the following: +* When using lambdas, the compiler needs to find a name for that expression. +To provide a lambda name, the user has to do the following: +```cpp cl::sycl::queue q; sycl::sycl_execution_policy snp(q); sort(snp, v.begin(), v.end(), [=](int a, int b) { return a >= b; }); +``` * Be aware that some algorithms may run sequential versions if the number of elements to be computed are not power of two. The following algorithms have From c272c39065712f0650e0398c3ec2c770596a754b Mon Sep 17 00:00:00 2001 From: Christopher Di Bella Date: Mon, 13 Nov 2017 13:47:35 +0000 Subject: [PATCH 4/5] Added support for VS2015 x64 Native Tools Command Prompt --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 49d60cd..4020e17 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,7 @@ vary if you are using Microsoft Visual Studio 2015, or a version of Visual Studi 1. Download and install the Microsoft Visual C++ 2015 compiler (typically achieved by installing [Microsoft Visual Studio 2017 Community Edition](https://www.visualstudio.com/downloads)). 2. Download and install the [Codeplay ComputeCpp Community Edition SDK for Windows](). -3. Open _Developer Command Prompt for VS 2017_. +3. Open either _VS2015 x64 Native Tools Command Prompt_ or _Developer Command Prompt for VS 2017_. 4. Enter the following commands ```bash mkdir SyclParallelSTL From aea23a52b0266598718e6d14388418c3f414460c Mon Sep 17 00:00:00 2001 From: Christopher Di Bella Date: Mon, 13 Nov 2017 14:35:20 +0000 Subject: [PATCH 5/5] Added hints about Windows SDK --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4020e17..a434e41 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,10 @@ vary if you are using Microsoft Visual Studio 2015, or a version of Visual Studi 2017. The supported compiler is Microsoft Visual C++ 2015, not Microsoft Visual C++ 2017.** 1. Download and install the Microsoft Visual C++ 2015 compiler (typically achieved by installing -[Microsoft Visual Studio 2017 Community Edition](https://www.visualstudio.com/downloads)). + [Microsoft Visual Studio 2017 Community Edition](https://www.visualstudio.com/downloads)). When + installing the compiler, be sure to install the relevant SDK for your operating system (for + example, on Windows 8.1, you will install the Windows 8.1 SDK; on Windows 10, you install the + latest Windows 10 SDK). 2. Download and install the [Codeplay ComputeCpp Community Edition SDK for Windows](). 3. Open either _VS2015 x64 Native Tools Command Prompt_ or _Developer Command Prompt for VS 2017_. 4. Enter the following commands @@ -196,7 +199,7 @@ installation of ComputeCpp on a 64-bit build of Windows 10 will be `C:\\Program ```bash sudo apt update && sudo apt upgrade && sudo apt update -sudo apt install build-essentials binutils gdb git flex bison texlive-full +sudo apt install build-essentials binutils gdb git flex bison texlive-full git mkdir /mnt/c/Users//projects; cd /mnt/c/Users//projects git clone https://github.com/Kitware/CMake.git cd CMake