QuEST-Kit / QuEST

A multithreaded, distributed, GPU-accelerated simulator of quantum computers
https://quest.qtechtheory.org/
MIT License
389 stars 137 forks source link

QuEST/CMakeLists.txt broken on arm #389

Open ashterenli opened 8 months ago

ashterenli commented 8 months ago

arm does not have avx. This is a crude workaround for gnu:

sed -i '261,265d' ../QuEST/CMakeLists.txt 

and build with e.g.


COMMON_FLAGS="-Wall -Wextra -Wpedantic -Wshadow -Wbad-function-cast -g -O2 -fopenmp -mcpu=neoverse-512tvb -march=armv8.4-a+sve -std=c11"

  cmake .. \
    -DCMAKE_C_COMPILER=mpicc \
    -DCMAKE_C_FLAGS="$COMMON_FLAGS" \
    -DCMAKE_CXX_COMPILER=mpicxx \
    -DCMAKE_CXX_FLAGS="$COMMON_FLAGS" \
TysonRayJones commented 8 months ago

Hi there,

The assumptive AVX flag was raised in #259 and forgotten about (hehe). QuEST's cmake build is due to be remade, given it was originally a bit rushedly created from an existing GNUmake build, causing some very minor issues since. The carefully remade cmake build will ensure all flags are arch compatible.

Relatedly, we don't invoke any explicit AVX instructions; we just encourage auto-vectorising. I'm still unsure myself whether flags -O3 and -march=native together already make -mavx redundant, or whether including the latter introduces additional opportunities for auto-vectorising. Is it verbose overkill given openmp itself may vectorise? Would love to hear your thoughts! It's otherwise something I wish to test the performance impact of during build refactoring.

fieldofnodes commented 7 months ago

Does AVX get flagged on non x86 arch?

TysonRayJones commented 7 months ago

@fieldofnodes the current CMake build erroneously includes the ARX flag for non-x86 arches, as the OP reports. One can simply delete the flag from the CMake file for a workaround.

TysonRayJones commented 1 month ago

Noting we'll address this in #402