bab2min / tomotopy

Python package of Tomoto, the Topic Modeling Tool
https://bab2min.github.io/tomotopy
MIT License
548 stars 62 forks source link

ARM support for Linux #196

Closed ankane closed 1 year ago

ankane commented 1 year ago

Hey @bab2min,

Thanks again for adding ARM support! Everything compiles great on Mac. I also tried compiling on Linux, but ran into this error:

/home/runner/work/tomoto-ruby/tomoto-ruby/vendor/tomotopy/src/TopicModel/../Utils/EigenAddonOps.hpp:119:35: error: cannot convert 'const Packet4f' {aka 'const __vector(4) float'} to 'int32x4_t' {aka '__vector(4) int'}
  119 |    return vcvtq_f32_s32(vandq_s32(a, vdupq_n_s32(1)));
      |                                   ^
      |                                   |
      |                                   const Packet4f {aka const __vector(4) float}
In file included from /home/runner/work/tomoto-ruby/tomoto-ruby/vendor/eigen/Eigen/src/Core/util/ConfigureVectorization.h:392,
                 from /home/runner/work/tomoto-ruby/tomoto-ruby/vendor/eigen/Eigen/Core:22,
                 from /home/runner/work/tomoto-ruby/tomoto-ruby/vendor/eigen/Eigen/Dense:1,
                 from /home/runner/work/tomoto-ruby/tomoto-ruby/vendor/tomotopy/src/TopicModel/../Utils/serializer.hpp:10,
                 from /home/runner/work/tomoto-ruby/tomoto-ruby/vendor/tomotopy/src/TopicModel/../Utils/Dictionary.h:9,
                 from /home/runner/work/tomoto-ruby/tomoto-ruby/vendor/tomotopy/src/TopicModel/TopicModel.hpp:5,
                 from /home/runner/work/tomoto-ruby/tomoto-ruby/vendor/tomotopy/src/TopicModel/LDAModel.hpp:4,
                 from /home/runner/work/tomoto-ruby/tomoto-ruby/vendor/tomotopy/src/TopicModel/DT.h:2,
                 from ../../../../ext/tomoto/dt.cpp:1:
/usr/lib/gcc-cross/aarch64-linux-gnu/9/include/arm_neon.h:1565:22: note:   initializing argument 1 of 'int32x4_t vandq_s32(int32x4_t, int32x4_t)'
 1565 | vandq_s32 (int32x4_t __a, int32x4_t __b)
      |            ~~~~~~~~~~^~~
make: *** [Makefile:240: dt.o] Error 1

Thoughts on supporting ARM Neon on Linux as well?

bab2min commented 1 year ago

Hi @ankane Oh I had totally forgotten that the issue was in Linux with ARM64. I will consider it in the following update soon. Thank you for reporting!

stephangreene commented 1 year ago

Thanks @bab2min -- we've had the same success on the Mac M1, and also experiencing this error on Linux. Looking forward to the next update -- thank you so much.

jtkiley commented 1 year ago

This would be great for Linux containers running on M1 Macs.

ankane commented 1 year ago

Looks like this was added in #200 - thanks @claudinoac and @bab2min!