Adds AVX2/FMA flags to CUDA compilation (#844)

This commit is contained in:
Juan Gomez 2020-07-24 21:52:07 +02:00 committed by GitHub
parent 06c18a0419
commit 236674e329
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -193,6 +193,11 @@ if(AER_THRUST_SUPPORTED)
endif()
cuda_select_nvcc_arch_flags(AER_CUDA_ARCH_FLAGS ${AER_CUDA_ARCH})
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -ccbin ${CMAKE_CXX_COMPILER} ${AER_CUDA_ARCH_FLAGS} -DAER_THRUST_CUDA -std=c++14 -I${AER_SIMULATOR_CPP_SRC_DIR} -isystem ${AER_SIMULATOR_CPP_SRC_DIR}/third-party/headers -use_fast_math --expt-extended-lambda")
# We have to set SIMD flags globally because there seems to be a bug in FindCUDA which doesn't allow us to set per-file compilation flags.
# The implications is that users downloading the PyPi wheel package for the GPU, need to have a CPU with AVX2 support otherwise
# Aer will crash with: "Unknow instruction" exception.
# This will be fixed here: https://github.com/Qiskit/qiskit-aer/
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}; --compiler-options;-mfma,-mavx2")
set(AER_COMPILER_DEFINITIONS ${AER_COMPILER_DEFINITIONS} THRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_CUDA)
set(THRUST_DEPENDANT_LIBS "")
elseif(AER_THRUST_BACKEND STREQUAL "TBB")