Skip to content

Commit 889bc7b

Browse files
committed
Added parallel implementations of initial algorithms
* License has been changed to Khronos Open Source License. * Parallel implementations for the initial algorithms are added. * Some fixes on CMake files will enable building on windows.
1 parent fe3a2d4 commit 889bc7b

17 files changed

+599
-398
lines changed

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ else(HEADER_ONLY)
4646

4747
if (NOT DEFINED DEVICE_COMPILER_NAME)
4848
if (WIN32)
49-
set(DEVICE_COMPILER_NAME "syclonecc.exe")
49+
set(DEVICE_COMPILER_NAME "compute++.exe")
5050
else(WIN32)
51-
set(DEVICE_COMPILER_NAME "syclonecc")
51+
set(DEVICE_COMPILER_NAME "compute++")
5252
endif(WIN32)
5353
endif (NOT DEFINED DEVICE_COMPILER_NAME)
5454
set(DEVICE_COMPILER "${DEVICE_COMPILER_PATH}/${DEVICE_COMPILER_NAME}"

LICENSE.txt

+21-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
Copyright (c) 2015, Codeplay Software Ltd.
2-
All rights reserved.
1+
Copyright (c) 2015 The Khronos Group Inc.
32

4-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
3+
Permission is hereby granted, free of charge, to any person obtaining a
4+
copy of this software and/or associated documentation files (the
5+
"Materials"), to deal in the Materials without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Materials, and to
8+
permit persons to whom the Materials are furnished to do so, subject to
9+
the following conditions:
510

6-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
11+
The above copyright notice and this permission notice shall be included
12+
in all copies or substantial portions of the Materials.
713

8-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
14+
MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
15+
KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
16+
SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
17+
https://www.khronos.org/registry/
918

10-
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11-
12-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19+
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25+
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ SyclSTL exposes a SYCL policy on the experimental::parallel namespace
4747
that can be passed to standard STL algorithms for them to run on SYCL.
4848
Currently, the following STL algorithms are implemented:
4949
50-
* sort (simple sequential implementation on the GPU)
51-
* transform (simple sequential implementation on the GPU)
50+
* sort : Bitonic sort for ranges which size is power of two, sequential sort
51+
otherwise.
52+
* transform : Parallel iteration (one thread per element) on the device.
5253
5354
Some optimizations are implemented, for example, the ability of passing
5455
iterators to buffers rather than STL containers to reduce the amount of
@@ -65,12 +66,11 @@ Simply create a build directory and run CMake as follows:
6566
```
6667
$ mkdir build
6768
$ cd build
68-
$ cmake ../ -DSYCL_PATH=/path/to/sycl -DOPENCL_LIBRARY=/path/to/opencl/lib \
69+
$ cmake ../ -DSYCL_PATH=/path/to/sycl \
6970
-DOPENCL_ROOT_DIR=/path/to/opencl/dir
7071
$ make
7172
```
7273
Usual CMake options are available (e.g. building debug or release).
7374
7475
If Google Mock is found in external/gmock then the unit tests are build.
7576
76-

examples/CMakeLists.txt

+17-9
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,28 @@
33
file(GLOB EXAMPLE_FILES ./*.cpp)
44

55
foreach(file ${EXAMPLE_FILES})
6-
get_filename_component(filename ${file} NAME_WE)
7-
message(STATUS "File ${file} Filename ${filename} ")
8-
add_executable (${filename} ${file})
9-
target_link_libraries(${filename} SyclSTL)
6+
get_filename_component(filename ${file} NAME)
7+
set(exe_name "${filename}.exe")
8+
message(STATUS "File ${file} Filename ${filename} Exename ${exe_name}")
9+
add_executable (${exe_name} ${file})
10+
target_link_libraries(${exe_name} SyclSTL)
1011

11-
set_property(TARGET ${filename} PROPERTY CXX_STANDARD "1y")
12-
set_property(TARGET ${filename} PROPERTY CXX_STANDARD_REQUIRED True)
12+
set_property(TARGET ${exe_name} PROPERTY CXX_STANDARD "1y")
13+
set_property(TARGET ${exe_name} PROPERTY CXX_STANDARD_REQUIRED True)
1314

1415
if (NOT HEADER_ONLY)
1516
# From the SYCL package
1617
# TODO(Ruyman): build_spir should return the output file name
17-
build_spir(${filename} ${file} ${CMAKE_CURRENT_SOURCE_DIR})
18-
set_property(TARGET ${filename} PROPERTY COMPILE_FLAGS
19-
"-std=c++1y -include ${file}.sycl ${CMAKE_CXX_FLAGS}")
18+
build_spir(${exe_name} ${file} ${CMAKE_CURRENT_BINARY_DIR})
19+
if (MSVC)
20+
set_property(TARGET ${exe_name} PROPERTY COMPILE_FLAGS
21+
"-std=c++1y /FI ${CMAKE_CURRENT_BINARY_DIR}/${filename}.sycl ${CMAKE_CXX_FLAGS}")
22+
else(MSVC)
23+
set_property(TARGET ${exe_name} PROPERTY COMPILE_FLAGS
24+
"-std=c++1y -include ${CMAKE_CURRENT_BINARY_DIR}/${filename}.sycl ${CMAKE_CXX_FLAGS}")
25+
endif(MSVC)
26+
add_dependencies(${exe_name} ${file}.sycl)
27+
2028
endif ()
2129

2230
endforeach()

examples/parallel.execpol.general.cpp

+26-29
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
1-
/* Copyright (c) 2015, Codeplay Software Ltd.
2-
* All rights reserved.
3-
* Redistribution and use in source and binary forms, with or without
4-
* modification, are permitted provided that the following conditions are met:
5-
*
6-
* 1. Redistributions of source code must retain the above copyright notice,
7-
* this list of conditions and the following disclaimer.
8-
*
9-
* 2. Redistributions in binary form must reproduce the above copyright notice,
10-
* this list of conditions and the following disclaimer in the documentation
11-
* and/or other materials provided with the distribution.
12-
*
13-
* 3. Neither the name of the copyright holder nor the names of its
14-
* contributors may be used to endorse or promote products derived from this
15-
* software without specific prior written permission.
16-
*
17-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20-
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21-
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22-
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23-
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24-
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25-
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27-
* POSSIBILITY OF SUCH DAMAGE.
28-
*
29-
*/
1+
/* Copyright (c) 2015 The Khronos Group Inc.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a
4+
copy of this software and/or associated documentation files (the
5+
"Materials"), to deal in the Materials without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Materials, and to
8+
permit persons to whom the Materials are furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included
12+
in all copies or substantial portions of the Materials.
13+
14+
MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
15+
KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
16+
SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
17+
https://www.khronos.org/registry/
18+
19+
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25+
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
26+
*/
3027
#include <experimental/execution_policy>
3128
#include <experimental/algorithm>
3229
#include <vector>

examples/sycl_sample_00.cpp

+26-30
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
1-
/* Copyright (c) 2015, Codeplay Software Ltd.
2-
* All rights reserved.
3-
* Redistribution and use in source and binary forms, with or without
4-
* modification, are permitted provided that the following conditions are met:
5-
*
6-
* 1. Redistributions of source code must retain the above copyright notice,
7-
* this list of conditions and the following disclaimer.
8-
*
9-
* 2. Redistributions in binary form must reproduce the above copyright notice,
10-
* this list of conditions and the following disclaimer in the documentation
11-
* and/or other materials provided with the distribution.
12-
*
13-
* 3. Neither the name of the copyright holder nor the names of its
14-
* contributors may be used to endorse or promote products derived from this
15-
* software without specific prior written permission.
16-
*
17-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20-
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21-
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22-
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23-
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24-
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25-
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27-
* POSSIBILITY OF SUCH DAMAGE.
28-
*
29-
*/
30-
1+
/* Copyright (c) 2015 The Khronos Group Inc.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a
4+
copy of this software and/or associated documentation files (the
5+
"Materials"), to deal in the Materials without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Materials, and to
8+
permit persons to whom the Materials are furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included
12+
in all copies or substantial portions of the Materials.
13+
14+
MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
15+
KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
16+
SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
17+
https://www.khronos.org/registry/
18+
19+
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25+
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
26+
*/
3127
#include <experimental/execution_policy>
3228
#include <experimental/algorithm>
3329
#include <vector>

examples/sycl_sample_01.cpp

+26-29
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
1-
/* Copyright (c) 2015, Codeplay Software Ltd.
2-
* All rights reserved.
3-
* Redistribution and use in source and binary forms, with or without
4-
* modification, are permitted provided that the following conditions are met:
5-
*
6-
* 1. Redistributions of source code must retain the above copyright notice,
7-
* this list of conditions and the following disclaimer.
8-
*
9-
* 2. Redistributions in binary form must reproduce the above copyright notice,
10-
* this list of conditions and the following disclaimer in the documentation
11-
* and/or other materials provided with the distribution.
12-
*
13-
* 3. Neither the name of the copyright holder nor the names of its
14-
* contributors may be used to endorse or promote products derived from this
15-
* software without specific prior written permission.
16-
*
17-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20-
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21-
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22-
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23-
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24-
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25-
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27-
* POSSIBILITY OF SUCH DAMAGE.
28-
*
29-
*/
1+
/* Copyright (c) 2015 The Khronos Group Inc.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a
4+
copy of this software and/or associated documentation files (the
5+
"Materials"), to deal in the Materials without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Materials, and to
8+
permit persons to whom the Materials are furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included
12+
in all copies or substantial portions of the Materials.
13+
14+
MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
15+
KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
16+
SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
17+
https://www.khronos.org/registry/
18+
19+
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25+
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
26+
*/
3027
#include <experimental/execution_policy>
3128
#include <experimental/algorithm>
3229
#include <vector>

0 commit comments

Comments
 (0)