From 27e57ac003c9bc25d3f7e274eac12e8d178e4873 Mon Sep 17 00:00:00 2001 From: Candles Date: Sun, 28 Jan 2024 01:22:54 -0800 Subject: [PATCH 1/2] Set TARGET_ARCH default to none Set the default TARGET_ARCH to none, otherwise it fails to build on architectures for which gcc doesn't support -m32 (such as aarch64) --- Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 00434c34..b35056ff 100644 --- a/Makefile +++ b/Makefile @@ -758,14 +758,19 @@ LIB_PATH_SFX = # override: TARGET_ARCH - set the target architecture # override: defaults to -m64 for 64-bit machines # override: -m32 for 32-bit machines -ifeq ($(findstring 64,$(arch)), 64) +ifeq ($(arch), x86_64) TARGET_ARCH ?= -m64 - # on Linux, toolkit libraries are under /lib64 for 64-bit +else ifeq ($(findstring 86,$(arch)), 86) # matches i386 and i686 + TARGET_ARCH ?= -m32 +else # other architectures such as aarch64 and ppc64 + TARGET_ARCH ?= +endif + +# on Linux, toolkit libraries are under /lib64 for 64-bit +ifeq ($(findstring 64,$(arch)), 64) ifeq ($(platform), Linux) LIB_PATH_SFX = 64 endif -else # i386 or i686 - TARGET_ARCH ?= -m32 endif # override: INCPATH - paths for include files From 63fb7f530cd5530cf9ad64304447346553472fe0 Mon Sep 17 00:00:00 2001 From: Candles Date: Sun, 28 Jan 2024 01:27:32 -0800 Subject: [PATCH 2/2] Explicitly sign chars Chars on aarch64 are unsigned by default, throwing a type conversion warning on compilation and a memory access violation when ran. --- src/cuda/forces.cu | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cuda/forces.cu b/src/cuda/forces.cu index 29c5df19..eae4485b 100644 --- a/src/cuda/forces.cu +++ b/src/cuda/forces.cu @@ -414,9 +414,9 @@ setconstants(const SimParams *simparams, const PhysParams *physparams, // Neibs cell to offset table char3 cell_to_offset[27]; - for(char z=-1; z<=1; z++) { - for(char y=-1; y<=1; y++) { - for(char x=-1; x<=1; x++) { + for(signed char z=-1; z<=1; z++) { + for(signed char y=-1; y<=1; y++) { + for(signed char x=-1; x<=1; x++) { int i = (x + 1) + (y + 1)*3 + (z + 1)*9; cell_to_offset[i] = make_char3(x, y, z); }