Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.6.0 #363

Merged
merged 20 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
working-directory: build_dir

- name: cmake test
run: ctest -j2 --output-on-failure --timeout 5000 -E mixMultiQubitKrausMap
run: ctest -j2 --output-on-failure --timeout 5000
working-directory: build_dir

- name: upload coverage results
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: doc

permissions:
contents: write

on:
# regenerate when master branch is updated
push:
branches:
- master

# or when manually triggered from the Actions tab
workflow_dispatch:

jobs:

build-doc:
name: Generation of documentation
runs-on: ubuntu-latest

steps:
- name: obtain copy of repository
uses: actions/checkout@v1

- name: make a directory for the generated doc
run: mkdir docgen_dir

- name: run doxygen to generate doc, outputting to docgen_dir
uses: mattnotmitt/[email protected]
with:
working-directory: docgen_dir
doxyfile-path: doxyconfig/config
enable-latex: true

- name: deploy new doc to github pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docgen_dir/html
2 changes: 1 addition & 1 deletion .github/workflows/llvm-asan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ jobs:
working-directory: build_dir

- name: cmake test
run: ctest -j2 --output-on-failure --timeout 5000 -E mixMultiQubitKrausMap
run: ctest -j2 --output-on-failure --timeout 5000
working-directory: build_dir
2 changes: 1 addition & 1 deletion .github/workflows/macos-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ jobs:
working-directory: build_dir

- name: cmake test
run: ctest -j2 --output-on-failure -E mixMultiQubitKrausMap
run: ctest -j2 --output-on-failure
working-directory: build_dir
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ jobs:
working-directory: build_dir

- name: cmake test
run: ctest -j2 --output-on-failure -E mixMultiQubitKrausMap
run: ctest -j2 --output-on-failure
working-directory: build_dir
40 changes: 40 additions & 0 deletions .github/workflows/windows-unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Windows unit

on:
push:
branches:
- master
- develop
pull_request:
branches:
- '**'

jobs:

build-and-test:
name: Unit tests on Windows MSVC
runs-on: windows-latest
strategy:
matrix:
float-precision: [2]

steps:
- uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1

- name: make build directory
shell: cmd
run: mkdir build_dir

- name: cmake configure
shell: cmd
run: cmake .. -DTESTING=ON -DPRECISION:STRING=${{matrix.float-precision}}
working-directory: build_dir

- name: cmake build
run: cmake --build . --target tests
working-directory: build_dir

- name: cmake test
run: ctest -j2 --output-on-failure
working-directory: build_dir
2 changes: 2 additions & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Dr Mihai Duta [developer]
original prototyping

External contributors:
Bruno Villasenor Alvarez on behalf of AMD
ported the GPU backend to HIP, for AMD GPU compatibility
Dr Nicolas Vogt on behalf of HQS Quantum Simulations
implemented mixDamping (CPU)
Kshitij Chhabra
Expand Down
91 changes: 83 additions & 8 deletions QuEST/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ option(GPUACCELERATED "Whether to program will run on GPU. Set to 1 to enable" 0

set(GPU_COMPUTE_CAPABILITY 30 CACHE STRING "GPU hardware dependent, lookup at https://developer.nvidia.com/cuda-gpus. Write without fullstop")

option(USE_HIP "Whether to use HIP for GPU code compilation for AMD GPUs. Set to 1 to enable" 0)

set(GPU_ARCH gfx90 CACHE STRING "GPU hardware dependent, used for AMD GPUs when USE_HIP=1. Lookup at https://llvm.org/docs/AMDGPUUsage.html#amdgpu-processor-table. Write without fullstop")


# *****************************************************************************
Expand All @@ -44,6 +47,9 @@ message(STATUS "Precision is ${PRECISION}")
message(STATUS "GPU acceleration is ${GPUACCELERATED}")
message(STATUS "OMP acceleration is ${MULTITHREADED}")
message(STATUS "MPI distribution is ${DISTRIBUTED}")
if (${GPUACCELERATED})
message(STATUS "HIP compilation is ${USE_HIP}")
endif()


# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -111,7 +117,30 @@ if (DISTRIBUTED)
endif()

if (GPUACCELERATED)
if (USE_HIP)

if(NOT DEFINED HIP_PATH)
if(NOT DEFINED ENV{HIP_PATH})
message(WARNING "WARNING: HIP_PATH is not defiend. Using default HIP_PATH=/opt/rocm/hip " ${HIP_VERSION})
set(HIP_PATH "/opt/rocm/hip" CACHE PATH "Path to which HIP has been installed")
else()
set(HIP_PATH $ENV{HIP_PATH} CACHE PATH "Path to which HIP has been installed")
endif()
endif()

if(EXISTS "${HIP_PATH}")
set(CMAKE_MODULE_PATH "${HIP_PATH}/cmake" ${CMAKE_MODULE_PATH})
find_package(HIP REQUIRED)
message(STATUS "Found HIP: " ${HIP_VERSION})
message(STATUS "HIP PATH: " ${HIP_PATH})
endif()

ADD_DEFINITIONS( -DUSE_HIP )
ADD_DEFINITIONS( -D__HIP_PLATFORM_AMD__ )

else()
find_package(CUDA REQUIRED)
endif()
endif()


Expand Down Expand Up @@ -147,6 +176,26 @@ endif ()
# ----- CUDA FLAGS ------------------------------------------------------------

if (GPUACCELERATED)
if (USE_HIP)
if( NOT DEFINED GPU_ARCH AND DEFINED GPU_COMPUTE_CAPABILITY )
set ( GPU_ARCH ${GPU_COMPUTE_CAPABILITY})
endif()

set(HIP_HIPCC_FLAGS "${HIP_HIPCC_FLAGS} -fPIC --offload-arch=${GPU_ARCH}" )
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set (HIP_HIPCC_FLAGS "${HIP_HIPCC_FLAGS} \
-O2"
)
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set (HIP_HIPCC_FLAGS "${HIP_HIPCC_FLAGS} \
-G -g -lineinfo"
)
else()
set (HIP_HIPCC_FLAGS "${HIP_HIPCC_FLAGS} \
-O2"
)
endif()
else()
set (CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} \
-arch=compute_${GPU_COMPUTE_CAPABILITY} -code=sm_${GPU_COMPUTE_CAPABILITY}"
)
Expand All @@ -155,14 +204,21 @@ if (GPUACCELERATED)
-O2"
)
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set (CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} \
-G -g -lineinfo"
)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
set (CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} \
-G"
)
else()
set (CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} \
-G -g -lineinfo"
)
endif()
else()
set (CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} \
-O2"
)
endif()
endif()
endif()


Expand All @@ -184,6 +240,10 @@ if (NOT("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"))
set(CMAKE_C_FLAGS_DEBUG
"-g"
)
else()
set(CMAKE_C_FLAGS_DEBUG
"-Zi"
)
endif()

# Set c flags for release
Expand Down Expand Up @@ -235,9 +295,15 @@ set(CMAKE_CXX_FLAGS_RELEASE
)

# Set c++ flags to use in debug mode
set(CMAKE_CXX_FLAGS_DEBUG
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS_DEBUG
"-Zi -MDd"
)
else()
set(CMAKE_CXX_FLAGS_DEBUG
"-g"
)
)
endif()

# set C++ compiler flags based on compiler type
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
Expand Down Expand Up @@ -270,6 +336,7 @@ if (VERBOSE_CMAKE)
message(" C++ Compiler ID: ${CMAKE_CXX_COMPILER_ID}")
message(" C compilation flags: ${CMAKE_C_FLAGS}")
message(" CUDA compilation flags: ${CUDA_NVCC_FLAGS}")
message(" HIP compilation flags: ${HIP_HIPCC_FLAGS}")
message(" C++ compilation flags: ${CMAKE_CXX_FLAGS}")

message("-- Build type: ${CMAKE_BUILD_TYPE}")
Expand Down Expand Up @@ -298,9 +365,15 @@ endif ()


if (GPUACCELERATED)
if (USE_HIP)
hip_add_library(QuEST
${QuEST_SRC}
)
else()
cuda_add_library(QuEST
${QuEST_SRC}
)
endif()
else ()
add_library(QuEST
${QuEST_SRC}
Expand Down Expand Up @@ -337,9 +410,11 @@ endif ()
target_link_libraries(QuEST PUBLIC ${MPI_C_LIBRARIES})

# ----- GPU -------------------------------------------------------------------

target_link_libraries(QuEST ${CUDA_LIBRARIES})

if (USE_HIP)
target_link_libraries(QuEST PUBLIC ${HIP_PATH}/lib/libamdhip64.so )
else()
target_link_libraries(QuEST ${CUDA_LIBRARIES})
endif()

# ----- Coverage testing with GCC or Clang ------------------------------------
option(QUEST_ENABLE_COVERAGE "Enable coverage reporting for GCC or Clang" FALSE)
Expand Down
Loading
Loading