Skip to content

Commit 844f718

Browse files
author
jgtong
authored
Merge pull request #52 from oneapi-src/jgt/voxelizer
Adding Voxiizer
2 parents d54df8b + bbc340b commit 844f718

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+36219
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ To achieve this, the suite must be capable of running on most environments, usin
2727

2828
# Velocity Bench: Simplifying GPU Performance Assessment
2929

30-
This benchmark suite of optimized workloads helps solve the problem of benchmark portability and applicability across different platform configurations. The suite has 15 workloads; each is available in SYCL, HIP, and CUDA to allow for runs on Intel, AMD, and Nvidia GPUs using the different programming models. Additionally, with SYCL’s open backend, workloads can be extended to support other types of accelerators moving forward. Thus, we can look at platform performance using native platform programming languages as well as multiarchitecture programming models (e.g., SYCL vs. HIP on AMD GPU and SYCL vs. CUDA on Nvidia GPU).
30+
This benchmark suite of optimized workloads helps solve the problem of benchmark portability and applicability across different platform configurations. The suite has 16 workloads; each is available in SYCL, HIP, and CUDA to allow for runs on Intel, AMD, and Nvidia GPUs using the different programming models. Additionally, with SYCL’s open backend, workloads can be extended to support other types of accelerators moving forward. Thus, we can look at platform performance using native platform programming languages as well as multiarchitecture programming models (e.g., SYCL vs. HIP on AMD GPU and SYCL vs. CUDA on Nvidia GPU).
3131

3232
Ensuring that all versions of the individual benchmark workloads are optimized to the same degree is a key focus of ongoing Velocity Bench development. This includes the use of equivalent algorithms, libraries, and input data types. Of course, further opportunities for changes and optimizations always exist.
3333

@@ -51,7 +51,8 @@ These benchmark workloads cover different use case scenarios and exercise differ
5151
12. **ETHMiner**: Domain: Cryptography. This is a bitcoin-mining workload. ETHMiner is an Ethash GPU mining worker to mine every coin which relies on an Ethash Proof of Work, including Ethereum bitcoins.
5252
13. **SVM**: Domain: Classical machine learning. Support Vector Machine is one of the most popular classical machine learning techniques. SVMs are supervised learning models with associated learning algorithms that analyze data for classification and regression analysis.
5353
14. **Sobel Filter**: Domains: Imaging, compute. Sobel filter is a popular and widely used RGB-to-grayscale image conversion (2D to 3D image conversion) technique, which applies a gaussian filter to reduce edge artifacts.
54-
15. **HP LINPACK**: Domains: Compute, system. This is not the most performant LINPACK tuned by various companies for which results are quoted, but it mainly uses libraries to calculate a device’s rate of execution. It uses GEMM calls to solve dense system of linear equations.
54+
15. **HP LINPACK**: Domains: Compute, system. This is not the most performant LINPACK tuned by various companies for which results are quoted, but it mainly uses libraries to calculate a device’s rate of execution. It uses GEMM calls to solve dense system of linear equations.
55+
16. **Voxelizer**: Domains: Imaging, compute. Converts a mesh of polygons into annotated voxel grids.
5556

5657
The Velocity Bench suite is a collection of workloads, some of which are developed and optimized by us. Others originated from the open source community. For the latter, we created/ported and optimized comparable code versions in the two other languages. For example, if CUDA was the originating code, we developed the SYCL and AMD versions. See the detailed workload descriptions and links to the source code origins in the Velocity Bench repository.
5758

voxelizer/CUDA/CMakeLists.txt

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
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
22+
23+
CMAKE_MINIMUM_REQUIRED(VERSION 3.20 FATAL_ERROR)
24+
25+
PROJECT(Voxelizer C CXX)
26+
27+
option(USE_SM "Specifies which streaming multiprocessor architecture to use")
28+
option(Trimesh2_LINK_DIR "Path to Trimesh2 library dir")
29+
option(Trimesh2_INCLUDE_DIR "Path to Trimesh2 includes")
30+
31+
set(DEF_WL_CXX_FLAGS " ")
32+
set(DEF_GENERAL_CXX_FLAGS " -O2 ")
33+
set(DEF_COMBINED_CXX_FLAGS "${DEF_GENERAL_CXX_FLAGS} ${DEF_WL_CXX_FLAGS}")
34+
35+
include_directories(
36+
${Trimesh2_INCLUDE_DIR}
37+
)
38+
39+
FIND_PACKAGE(glm CONFIG REQUIRED)
40+
message(STATUS "glm library status:")
41+
message(STATUS " version: ${glm_VERSION}")
42+
message(STATUS " libraries: ${GLM_LIBRARIES}")
43+
message(STATUS " include path: ${GLM_INCLUDE_DIRS}")
44+
45+
find_package(CUDA REQUIRED)
46+
47+
if(NOT CUDA_FOUND)
48+
message(STATUS "CUDA not found. Project will not be built.")
49+
endif(NOT CUDA_FOUND)
50+
51+
SET(CUDA_VOXELIZER_EXECUTABLE voxelizer_cuda)
52+
53+
# SET(Trimesh2_INCLUDE_DIR CACHE PATH "Path to Trimesh2 includes")
54+
IF(NOT Trimesh2_INCLUDE_DIR)
55+
MESSAGE(FATAL_ERROR "You need to set variable Trimesh2_INCLUDE_DIR")
56+
ENDIF()
57+
58+
FIND_FILE(Trimesh2_TriMesh_h TriMesh.h ${Trimesh2_INCLUDE_DIR})
59+
60+
IF(NOT Trimesh2_TriMesh_h)
61+
message(FATAL_ERROR "Can't find TriMesh.h in ${Trimesh2_INCLUDE_DIR}")
62+
ENDIF()
63+
64+
MARK_AS_ADVANCED(Trimesh2_TriMesh_h)
65+
66+
# SET(Trimesh2_LINK_DIR CACHE PATH "Path to Trimesh2 library dir.")
67+
IF(NOT Trimesh2_LINK_DIR)
68+
MESSAGE(FATAL_ERROR "You need to set variable Trimesh2_LINK_DIR")
69+
ENDIF()
70+
71+
IF(NOT EXISTS "${Trimesh2_LINK_DIR}")
72+
MESSAGE(FATAL_ERROR "Trimesh2 library dir does not exist")
73+
ENDIF()
74+
75+
FIND_LIBRARY(Trimesh2_LIBRARY trimesh ${Trimesh2_LINK_DIR})
76+
77+
IF(NOT Trimesh2_LIBRARY)
78+
message(SEND_ERROR "Can't find libtrimesh.a in ${Trimesh2_LINK_DIR}")
79+
ENDIF()
80+
81+
MARK_AS_ADVANCED(Trimesh2_LIBRARY)
82+
83+
MESSAGE(STATUS "Found Trimesh2 include: ${Trimesh2_TriMesh_h}")
84+
MESSAGE(STATUS "Found Trimesh2 lib: ${Trimesh2_LIBRARY}")
85+
86+
SET(CUDA_VOXELIZER_SRCS
87+
./src/main.cpp
88+
./src/util_cuda.cpp
89+
./src/util_io.cpp
90+
./src/cpu_voxelizer.cpp
91+
)
92+
SET(CUDA_VOXELIZER_SRCS_CU
93+
./src/voxelize.cu
94+
./src/thrust_operations.cu
95+
./src/voxelize_solid.cu
96+
)
97+
98+
if(NOT "${CMAKE_CXX_FLAGS}" STREQUAL "" AND NOT "${OVERRIDE_GENERAL_CXX_FLAGS}" STREQUAL "")
99+
message(FATAL_ERROR "Both CMAKE_CXX_FLAGS and OVERRIDE_GENERAL_CXX_FLAGS cannot be passed in together")
100+
elseif("${CMAKE_CXX_FLAGS}" STREQUAL "" AND "${OVERRIDE_GENERAL_CXX_FLAGS}" STREQUAL "")
101+
message(STATUS "Using DEFAULT compilation flags")
102+
set(CMAKE_CXX_FLAGS "${DEF_COMBINED_CXX_FLAGS}")
103+
elseif(NOT "${OVERRIDE_GENERAL_CXX_FLAGS}" STREQUAL "")
104+
message(STATUS "OVERRIDING GENERAL compilation flags")
105+
set(CMAKE_CXX_FLAGS "${OVERRIDE_GENERAL_CXX_FLAGS}")
106+
string(APPEND CMAKE_CXX_FLAGS ${DEF_WL_CXX_FLAGS})
107+
elseif(NOT "${CMAKE_CXX_FLAGS}" STREQUAL "")
108+
message(STATUS "OVERRIDING GENERAL and WORKLOAD SPECIFIC compilation flags")
109+
endif()
110+
111+
# set(CUDA_SEPARABLE_COMPILATION ON)
112+
message(STATUS "CXX Compilation flags to: ${CMAKE_CXX_FLAGS}")
113+
114+
CUDA_ADD_EXECUTABLE(
115+
${CUDA_VOXELIZER_EXECUTABLE}
116+
${CUDA_VOXELIZER_SRCS}
117+
${CUDA_VOXELIZER_SRCS_CU}
118+
OPTIONS -arch=sm_${USE_SM})
119+
120+
TARGET_COMPILE_FEATURES(${CUDA_VOXELIZER_EXECUTABLE} PRIVATE cxx_std_17)
121+
TARGET_INCLUDE_DIRECTORIES(${CUDA_VOXELIZER_EXECUTABLE} PRIVATE ${Trimesh2_INCLUDE_DIR} ${GLM_INCLUDE_DIRS}) # TARGET_LINK_LIBRARIES(${CUDA_VOXELIZER_EXECUTABLE} PRIVATE ${Trimesh2_LIBRARY} PRIVATE CUDA::cudart PRIVATE glm::glm)
122+
TARGET_LINK_LIBRARIES(${CUDA_VOXELIZER_EXECUTABLE} ${Trimesh2_LIBRARY} ${CUDA_cudadevrt_LIBRARY} glm::glm)

0 commit comments

Comments
 (0)