Cambridge-ICCS / FTorch

A library for directly calling PyTorch ML models from Fortran.
https://cambridge-iccs.github.io/FTorch/
MIT License
78 stars 15 forks source link

Incompatibility with MacOS arm libtorch #183

Open jatkinson1000 opened 1 month ago

jatkinson1000 commented 1 month ago

Building github runners and locally suggests there is an issue with the macOS version of libtorch outputting different types compared to linux for the functions introduced in #175 .

FTorch expects a long int* whilst the libtorch binary seems to be returning a long long int*.

Example output below.

[user@machine build]$ cmake --build .
[  8%] Building Fortran object CMakeFiles/ftorch.dir/ftorch.f90.o
[ 16%] Building Fortran object CMakeFiles/ftorch.dir/ftorch_test_utils.f90.o
[ 25%] Building CXX object CMakeFiles/ftorch.dir/ctorch.cpp.o
/Users/user/FTorch/src/ctorch.cpp: In function 'const long int* torch_tensor_get_sizes(torch_tensor_t)':
/Users/user/FTorch/src/ctorch.cpp:240:25: error: invalid conversion from 'const long long int*' to 'const long int*' [-fpermissive]
  240 |   return t->sizes().data();
      |          ~~~~~~~~~~~~~~~^~
      |                         |
      |                         const long long int*
make[2]: *** [CMakeFiles/ftorch.dir/ctorch.cpp.o] Error 1
make[1]: *** [CMakeFiles/ftorch.dir/all] Error 2
make: *** [all] Error 2
jatkinson1000 commented 2 weeks ago

@TomMelt Any chance we can prioritise this for the hackathon? It is stopping me developing locally on my workstation.