Skip to content

Commit 4ea4b1f

Browse files
author
Y
committed
Updated CMake files in SYCL and HIP
1 parent 03e3e0b commit 4ea4b1f

File tree

5 files changed

+45
-18
lines changed

5 files changed

+45
-18
lines changed

THIRD-PARTY-PROGRAMS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,17 @@ Library.
756756
cxxopts
757757
Copyright (c) 2014 Jarryd Beck
758758

759+
Voxelizer CUDA
760+
Copyright (c) 2019 Jeroen Baert
761+
762+
Voxelizer HIP
763+
Modifications Copyright (C) 2023 Intel Corporation
764+
Copyright (c) 2019 Jeroen Baert
765+
766+
Voxelizer SYCL
767+
Modifications Copyright (C) 2023 Intel Corporation
768+
Copyright (c) 2019 Jeroen Baert
769+
759770

760771
Permission is hereby granted, free of charge, to any person obtaining a copy
761772
of this software and associated documentation files (the "Software"), to deal

voxelizer/HIP/CMakeLists.txt

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,14 @@ option(Trimesh2_LINK_DIR "Path to Trimesh2 library dir")
3030
option(Trimesh2_INCLUDE_DIR "Path to Trimesh2 includes")
3131
option(GLM_INCLUDE_DIR "Path to GLM includes")
3232

33-
set(DEF_WL_CXX_FLAGS " -D__HIP_PLATFORM_AMD__ ")
33+
set(DEF_WL_CXX_FLAGS " -D__HIP_PLATFORM_AMD__ -fPIE -Wl,-z,relro ")
3434
set(DEF_GENERAL_CXX_FLAGS " -Wall -O3 -Wextra ")
3535
set(DEF_COMBINED_CXX_FLAGS "${DEF_GENERAL_CXX_FLAGS} ${DEF_WL_CXX_FLAGS}")
3636

3737
include_directories(
3838
${Trimesh2_INCLUDE_DIR}
3939
)
4040

41-
# SET(GLM_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/../../../dependencies/test/glm/glm)
4241
FIND_PACKAGE(glm REQUIRED)
4342
message(STATUS "glm library status:")
4443
message(STATUS " version: ${glm_VERSION}")
@@ -58,12 +57,11 @@ option(WG_SIZE "Specifies the block size")
5857

5958
if("${CMAKE_CXX_FLAGS}" STREQUAL "")
6059
message(STATUS "Using DEFAULT compilation flags for the application")
61-
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} " -O3 -std=c++17 -ffast-math -D__HIP_PLATFORM_AMD__ ")
60+
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} " -O3 -std=c++20 -ffast-math -D__HIP_PLATFORM_AMD__ -fPIE -Wl,-z,relro ")
6261
else()
6362
message(STATUS "OVERRIDING compilation flags")
6463
endif()
6564

66-
# set(HIP_PATH /opt/rocm-5.4.3/hip)
6765
find_package(HIP REQUIRED)
6866

6967
if(NOT HIP_FOUND)
@@ -74,7 +72,6 @@ endif()
7472

7573
SET(HIP_VOXELIZER_EXECUTABLE voxelizer_hip)
7674

77-
# SET(GLM_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src)
7875
IF(NOT Trimesh2_INCLUDE_DIR)
7976
MESSAGE(FATAL_ERROR "You need to set variable Trimesh2_INCLUDE_DIR")
8077
ENDIF()
@@ -87,7 +84,6 @@ ENDIF()
8784

8885
MARK_AS_ADVANCED(Trimesh2_TriMesh_h)
8986

90-
# SET(Trimesh2_LINK_DIR CACHE PATH "Path to Trimesh2 library dir.")
9187
IF(NOT Trimesh2_LINK_DIR)
9288
MESSAGE(FATAL_ERROR "You need to set variable Trimesh2_LINK_DIR")
9389
ENDIF()
@@ -133,18 +129,15 @@ elseif(NOT "${CMAKE_CXX_FLAGS}" STREQUAL "")
133129
message(STATUS "OVERRIDING GENERAL and WORKLOAD SPECIFIC compilation flags")
134130
endif()
135131

132+
set(HIP_INCLUDE_DIRS /opt/rocm-5.4.3/include)
136133
message(STATUS "CXX Compilation flags to: ${CMAKE_CXX_FLAGS}")
134+
message(STATUS "HIP Include: ${HIP_INCLUDE_DIRS}")
137135

138-
set(HIP_SEPARABLE_COMPILATION ON)
139136
set(MY_TARGET_NAME ${PROJECT_NAME})
140-
set(MY_HIPCC_OPTIONS)
141-
set(MY_NVCC_OPTIONS)
142137
set(CMAKE_HIP_ARCHITECTURES OFF)
138+
set(CMAKE_HIP_FLAGS ${CMAKE_CXX_FLAGS})
139+
hip_add_executable(${HIP_VOXELIZER_EXECUTABLE} ${HIP_VOXELIZER_SRCS})
143140

144-
set_source_files_properties(${HIP_VOXELIZER_SRCS} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
145-
hip_add_executable(${HIP_VOXELIZER_EXECUTABLE} ${HIP_VOXELIZER_SRCS} ${MY_HIPCC_OPTIONS} NVCC_OPTIONS ${MY_NVCC_OPTIONS})
146-
147-
# include(${CMAKE_CURRENT_SOURCE_DIR}/src/glm/glm/CMakeLists.txt)
148141
TARGET_COMPILE_FEATURES(${HIP_VOXELIZER_EXECUTABLE} PRIVATE cxx_std_17)
149-
TARGET_INCLUDE_DIRECTORIES(${HIP_VOXELIZER_EXECUTABLE} PRIVATE ${Trimesh2_INCLUDE_DIR} ${GLM_INCLUDE_DIR})
150-
TARGET_LINK_LIBRARIES(${HIP_VOXELIZER_EXECUTABLE} ${Trimesh2_LIBRARY} glm::glm)
142+
TARGET_INCLUDE_DIRECTORIES(${HIP_VOXELIZER_EXECUTABLE} PRIVATE ${Trimesh2_INCLUDE_DIR} ${GLM_INCLUDE_DIR} ${HIP_INCLUDE_DIRS})
143+
TARGET_LINK_LIBRARIES(${HIP_VOXELIZER_EXECUTABLE} ${Trimesh2_LIBRARY} glm::glm)

voxelizer/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Modifications Copyright (C) 2023 Intel Corporation
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"),
5+
to deal in the Software without restriction, including without limitation
6+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
7+
and/or sell copies of the Software, and to permit persons to whom
8+
the Software is furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included
11+
in all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
17+
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
18+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
19+
OR OTHER DEALINGS IN THE SOFTWARE.
20+
21+
SPDX-License-Identifier: MIT

voxelizer/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ libsrc/TriMesh_pointareas.cc
7979

8080
mkdir build && cd build
8181

82-
CXX=hipcc cmake ../ -DTrimesh2_INCLUDE_DIR=/path/to/trimesh2/include/ -DTrimesh2_LINK_DIR=/path/to/trimesh2/lib.Linux64 -DGLM_INCLUDE_DIR=/path/to/glm
82+
HIP_PATH=/opt/rocm-5.4.3/hip CXX=/opt/rocm-5.4.3/bin/hipcc cmake ../ -DTrimesh2_INCLUDE_DIR=/path/to/trimesh2/include/ -DTrimesh2_LINK_DIR=/path/to/trimesh2/lib.Linux64 -DGLM_INCLUDE_DIR=/path/to/glm
83+
84+
make -sj
8385

8486
**To run Hip version**
8587

voxelizer/SYCL/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ ENDIF()
7676

7777
MARK_AS_ADVANCED(Trimesh2_TriMesh_h)
7878

79-
link_directories(${CMAKE_SOURCE_DIR}/../../../dependencies/test/trimesh2/lib.Linux64)
80-
SET(Trimesh2_LINK_DIR ${CMAKE_SOURCE_DIR}/../../../dependencies/test/trimesh2/lib.Linux64/)
79+
#link_directories(${CMAKE_SOURCE_DIR}/../../../dependencies/test/trimesh2/lib.Linux64)
80+
#SET(Trimesh2_LINK_DIR ${CMAKE_SOURCE_DIR}/../../../dependencies/test/trimesh2/lib.Linux64/)
8181

8282
IF(NOT Trimesh2_LINK_DIR)
8383
MESSAGE(FATAL_ERROR "You need to set variable Trimesh2_LINK_DIR")

0 commit comments

Comments
 (0)