Open gabrielctn opened 1 year ago
Hi Gabriel, Unfortunately, VIAMD does not compile on M1 and M2 for the moment. We are investigating a short term solution. The long term and sound solution performance wise would be to switch to Vulkan or Metal.
And yes, Compilation should work on intel macs. We provide binary for windows and the code compile without any issue on linux.
Alright, thanks for your answer !
Dear @mathieulinares, @gabrielctn,
I've tried adding SET(CMAKE_OSX_ARCHITECTURES "x86_64")
on line 4
of CMakeLists.txt
to good effect. It probably would be best to add some IF
guards checking that it is an OSX system, but as a simple stopgap solution it proved effective. Those who may be interested in developing or running the code on an M1, M2 system today, may want to do this.
Wooow, didn't know this trick ! It builds thanks a lot @ljyanesm !
May I ask if it is running properly!?
The only issue I've found has to do with the cursor. Not sure where it is coming from, but it seems as if the cursor coordinates are not being calculated correctly, I don't think it has to do with the architecture.
Here's an image of the issue. The black box with the bond details is where my cursor is, but the bond selected on the yellow box is far away.
Otherwise, things looked correct. First time running the application so I can't comment on performance, but there wasn't any major lag I could notice with the example data.
It is running properly for me too yes! The only issue I had was when I clicked on "Windows" -> "Density Volumes" and I got a segmentation fault.
I just wanted to chip in on the discussion here: First of @ljyanesm thanks for the tip regarding the OSX x86_64 flags, I was not aware of that. I assume it's providing the correct replacements for the x86-64 intrinsics used (or using rosetta stone to translate all instructions?) The plan is to support Apple Silicon, but I don't have my hands on any machine as of yet. Which would be required to solve all of the potential graphical issues and such. It is using a rather conservative OpenGL 3.30 version, so that should be fine for now, until Apple decides to drop OpenGL support for good.
Even with the new fix, I cannot build on my M1 (Sonoma 14.1.1 (23B81))
-- The CXX compiler identification is AppleClang 15.0.0.15000040
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenGL: /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/OpenGL.framework
-- The C compiler identification is AppleClang 15.0.0.15000040
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test HAVE_AVX512_EXTENSIONS
-- Performing Test HAVE_AVX512_EXTENSIONS - Failed
-- Performing Test HAVE_AVX2_EXTENSIONS
-- Performing Test HAVE_AVX2_EXTENSIONS - Failed
-- Performing Test HAVE_FMA_EXTENSIONS
-- Performing Test HAVE_FMA_EXTENSIONS - Failed
-- Performing Test HAVE_AVX_EXTENSIONS
-- Performing Test HAVE_AVX_EXTENSIONS - Failed
-- Writing resources to gen/gl_shaders.inl
-- mdlib: AppleClang configuration was used
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Using Cocoa for window creation
CMake Deprecation Warning at ext/enkiTS/CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Writing resources to gen/shaders.inl
-- Configuring done (1.4s)
-- Generating done (0.1s)
-- Build files have been written to: /Users/Bastiaan/Desktop/viamd/build
(base) Bastiaan@n152-p213 build % cmake --build .
[ 0%] Built target imgui_notify
[ 1%] Generating bin/datasets/1ALA-500.pdb
[ 1%] Built target viamd_copy_datasets
[ 2%] Building C object ext/mdlib/CMakeFiles/mdlib.dir/src/core/md_allocator.c.o
In file included from /Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_allocator.c:1:
/Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_allocator.h:49:47: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
uint64_t md_temp_allocator_max_allocation_size();
^
void
/Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_allocator.h:58:53: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
struct md_ring_allocator_t* md_thread_ring_allocator();
^
void
In file included from /Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_allocator.c:5:
/Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_os.h:17:28: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
uint64_t md_os_physical_ram();
^
void
/Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_os.h:19:30: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
uint64_t md_os_num_processors();
^
void
/Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_allocator.c:16:47: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
uint64_t md_temp_allocator_max_allocation_size() {
^
void
/Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_allocator.c:55:53: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
struct md_ring_allocator_t* md_thread_ring_allocator() {
^
void
6 warnings generated.
[ 3%] Building C object ext/mdlib/CMakeFiles/mdlib.dir/src/core/md_arena_allocator.c.o
In file included from /Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_arena_allocator.c:3:
/Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_allocator.h:49:47: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
uint64_t md_temp_allocator_max_allocation_size();
^
void
/Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_allocator.h:58:53: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
struct md_ring_allocator_t* md_thread_ring_allocator();
^
void
In file included from /Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_arena_allocator.c:5:
/Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_os.h:17:28: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
uint64_t md_os_physical_ram();
^
void
/Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_os.h:19:30: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
uint64_t md_os_num_processors();
^
void
4 warnings generated.
[ 3%] Building C object ext/mdlib/CMakeFiles/mdlib.dir/src/core/md_base64.c.o
[ 4%] Building C object ext/mdlib/CMakeFiles/mdlib.dir/src/core/md_bitfield.c.o
In file included from /Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_bitfield.c:3:
/Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_allocator.h:49:47: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
uint64_t md_temp_allocator_max_allocation_size();
^
void
/Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_allocator.h:58:53: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
struct md_ring_allocator_t* md_thread_ring_allocator();
^
void
In file included from /Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_bitfield.c:7:
In file included from /Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_intrinsics.h:8:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/x86intrin.h:15:
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/immintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
^
In file included from /Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_bitfield.c:7:
In file included from /Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_intrinsics.h:8:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/x86intrin.h:15:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/immintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/x86gprintrin.h:15:
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/hresetintrin.h:42:27: error: invalid input constraint 'a' in asm
__asm__ ("hreset $0" :: "a"(__eax));
^
In file included from /Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_bitfield.c:7:
In file included from /Users/Bastiaan/Desktop/viamd/ext/mdlib/src/core/md_intrinsics.h:8:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/x86intrin.h:15:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/immintrin.h:21:
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
^
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:54:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:133:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:163:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:193:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:220:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:243:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:264:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:291:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:314:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:335:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:356:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:377:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:398:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:420:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:443:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/mmintrin.h:465:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_paddusb((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
make[2]: *** [ext/mdlib/CMakeFiles/mdlib.dir/src/core/md_bitfield.c.o] Error 1
make[1]: *** [ext/mdlib/CMakeFiles/mdlib.dir/all] Error 2
make: *** [all] Error 2
@Derivolate Perhaps my "fix" was not complete somehow. Looking through the log that you posted, it certainly seems that the Rosetta translation layer did not kick in.
Perhaps the flag needs to go into the cmake of mdlib as well if it is not propagated 'downwards' to viamds dependencies.
Manually setting the flag did work and compiled successfully. I'm not sure why the current CMakeLists.txt doesn't work.
Hi, I tried to build VIAMD on my Mac M2 but it fails, is it only available on intel Macs ?