Skip to content

Commit

Permalink
Reverted default threading support to Single-Threading on Windows
Browse files Browse the repository at this point in the history
AMD-Internal: CPUPL-3275

Change-Id: Ic45b2e822038ea229b93260285f41d1667c3583a
  • Loading branch information
vchunchu-amd committed Feb 28, 2024
1 parent 9e26cc3 commit 2959171
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 16 deletions.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ set(CMAKE_CXX_EXTENSIONS OFF)
option(BUILD_SHARED_LIBS "Build aocl-sparse as a shared library" ON)
option(BUILD_CLIENTS_BENCHMARKS "Build benchmarks (requires Boost) " OFF)
option(BUILD_ILP64 "ILP64 Support" OFF)
option(SUPPORT_OMP "Compile with OpenMP support." ON)
option(USE_AVX512 "AVX512 Support" OFF)
set(ENABLE_SET_BUILD_DATE OFF CACHE STRING "Set library build date")
option(BUILD_CLIENTS_SAMPLES "Build sparse examples" ON)
Expand All @@ -81,6 +80,14 @@ option(ASAN "Enable Address SANitizer (only Debug/Linux build)" OFF)
option(VALGRIND "Enable Valgrind checks (only Debug. Incompatible with ASAN=ON)" OFF)
set(CMAKE_AOCL_ROOT OFF CACHE STRING "Provide AOCL_ROOT via CMake Configuration")

if(WIN32)
option(SUPPORT_OMP "Compile without OpenMP support." OFF)
else(WIN32)
option(SUPPORT_OMP "Compile with OpenMP support." ON)
endif(WIN32)
option(USE_OMP_LIB "Use libomp by default" ON)
set(EXTERNAL_OMP_LIBRARY "" CACHE STRING "Provide external OMP library path")

if (NOT (${ASAN} AND ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND CMAKE_BUILD_TYPE MATCHES "Debug"))
# Switch off ASAN: target not supported
set(ASAN OFF)
Expand Down
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,38 @@ cd aocl-sparse
```
5. Configure the project along with the following options depending on the build that is required:
```
cmake -S . -B <build_directory> -T ClangCL -G "Visual Studio 17 2022" -DCMAKE_CXX_COMPILER=ClangCl -DCMAKE_INSTALL_PREFIX="<aoclsparse_install_path>"
cmake -S . -B <build_directory> -T clangcl -G "Visual Studio 17 2022" -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_INSTALL_PREFIX="<aoclsparse_install_path>"
# Configure AOCL-Sparse
# Build options:
# BUILD_SHARED_LIBS - build AOCL-Sparse as a shared library (Default: ON)
# BUILD_ILP64 - ILP64 Support (Default: OFF)
# SUPPORT_OMP - OpenMP Support (Default: ON)
# SUPPORT_OMP - OpenMP Support (Default: OFF)
# BUILD_CLIENTS_SAMPLES - build examples (Default: ON)
# BUILD_UNIT_TESTS - build unit tests (Default: OFF)
# BUILD_CLIENTS_BENCHMARKS - build benchmarks (Default: OFF)
# BUILD_DOCS - build the PDF documentation (Default: OFF)
# USE_AVX512 - AVX512 Support (Default: OFF)
```
6. Build the project
6. Export the paths for AOCL-BLAS, AOCL-LAPACK and AOCL-UTILS libraries.
```
set PATH=C:\Users\Program Files\AMD\AOCL-Windows\amd-blis\lib\LP64;%PATH%
set PATH=C:\Users\Program Files\AMD\AOCL-Windows\amd-libflame\lib\LP64;%PATH%
set PATH=C:\Users\Program Files\AMD\AOCL-Windows\amd-utils\lib;%PATH%
```
7. Build the project
```
cmake --build <build_directory> --config Release --target install --verbose
```
7. To run the tests/examples, export the paths for Blis, Libflame and Sparse binaries
8. To run the tests/examples, export the path for Sparse library
```
set PATH=C:\Users\Program Files\AMD\AOCL-Windows\amd-blis\include;%PATH%
set PATH=C:\Users\Program Files\AMD\AOCL-Windows\amd-blis\lib;%PATH%
set PATH=C:\Users\Program Files\AMD\AOCL-Windows\amd-libflame\include;%PATH%
set PATH=C:\Users\Program Files\AMD\AOCL-Windows\amd-libflame\lib;%PATH%
set PATH=C:\Users\Program Files\AMD\AOCL-Windows\amd-utils\include;%PATH%
set PATH=C:\Users\Program Files\AMD\AOCL-Windows\amd-utils\lib;%PATH%
set PATH=<aoclsparse_install_path>\lib;%PATH%
```
8. Run the examples after exporting the required library/headers paths
9. Run the examples after exporting the required library/headers paths
```
build_directory\tests\examples\sample_spmv.exe
```

**Note** Currently multi-threading is not supported on Windows.
#### Building on Linux
1. Install AOCL-BLAS, AOCL-LAPACK and AOCL-UTILS
2. Define the environment variable AOCL_ROOT to point to AOCL libs installation
Expand Down
3 changes: 3 additions & 0 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ function(openmp_libs)
message(FATAL_ERROR
"Error: could not find a suitable installation of OpenMP for the requested multi-threaded build")
else()
if(WIN32 AND (NOT USE_OMP_LIB))
set(OpenMP_Library ${EXTERNAL_OMP_LIBRARY})
endif()
# OpenMP cmake fix for cmake <= 3.9 and cases where OpenMP targets are not populated correctly
# setup the interface OpenMP library with all the necessary flags and libraries
if(NOT DEFINED OpenMP_Library)
Expand Down
8 changes: 7 additions & 1 deletion tests/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ if (BUILD_SPARSE_EXAMPLE_OUTOFSRCTREE)

OPTION(BUILD_SHARED_LIBS "Build aocl-sparse as a shared library" ON)
OPTION(BUILD_ILP64 "ILP64 Support" OFF)
OPTION(SUPPORT_OMP "Compile with OpenMP support." ON)
if(WIN32)
OPTION(SUPPORT_OMP "Compile without OpenMP support." OFF)
else(WIN32)
OPTION(SUPPORT_OMP "Compile with OpenMP support." ON)
endif(WIN32)
OPTION(USE_OMP_LIB "Use libomp by default" ON)
set(EXTERNAL_OMP_LIBRARY "" CACHE STRING "Provide external OMP library path")

IF(DEFINED ENV{SPARSE_ROOT})
set(CMAKE_SPARSE_ROOT $ENV{SPARSE_ROOT})
Expand Down
5 changes: 3 additions & 2 deletions tests/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Build options:
```
set SPARSE_ROOT=%HOME%\amd\aocl-sparse
```
**Note** If in case, AOCL_ROOT contains AOCL Sparse installation along with BLAS, LAPACK and UTILS libraries, then "SPARSE_ROOT" takes precedence when searching for sparse library and headers.
**Note** If in case, AOCL_ROOT contains AOCL Sparse installation along with BLAS, LAPACK and UTILS libraries, then "SPARSE_ROOT" takes precedence when searching for sparse library and headers.
4. Add library paths of Sparse, BLAS, LAPACK and UTILS to environment path variable
```
set PATH=%HOME%\amd\aocl-sparse\lib;%PATH%
Expand All @@ -72,7 +72,7 @@ Build options:
5. Configure the build system to compile sample applications. Make sure the build configuration is same as the one used to build aoclsparse library for BUILD_ILP64 and SUPPORT_OMP variables.
```
cmake -S . -B out_sparse -G "Visual Studio 16 2019" -A x64 -T "LLVM" -DCMAKE_CXX_COMPILER=clang-cl -DBUILD_SHARED_LIBS=OFF -DBUILD_ILP64=ON -DSUPPORT_OMP=OFF
cmake -S . -B out_sparse -G "Visual Studio 17 2022" -A x64 -T "clangcl" -DCMAKE_CXX_COMPILER=clang-cl -DBUILD_SHARED_LIBS=ON -DBUILD_ILP64=OFF -DSUPPORT_OMP=OFF
```
6. Compile the sample applications
```
Expand All @@ -83,3 +83,4 @@ Build options:
.\out_sparse\sample_spmv.exe
```
**Note** The environment variable "SPARSE_ROOT" takes precedence when searching for sparse library and headers. If the environment variable "SPARSE_ROOT" is not defined, then SPARSE_ROOT inherits the path from AOCL_ROOT and looks for AOCL sparse installation in AOCL_ROOT. If Sparse library/headers are not found either in SPARSE_ROOT or AOCL_ROOT, then an error is returned.
**Note** Currently multi-threading is not supported on Windows.

0 comments on commit 2959171

Please sign in to comment.