Closed czgdp1807 closed 5 months ago
libtorch
is 160 MB in size, so unzip
fails on CI. Locally tests work on my system,
1:37:38:~/lc_project/lc/integration_tests % python run_tests.py -b=pytorch
/Users/czgdp1807/lc_project/lc/integration_tests/run_tests.py:47: SyntaxWarning: invalid escape sequence '\w'
mod = re.compile("(module|MODULE) (\w+)")
+ rm -rf /Users/czgdp1807/lc_project/lc/integration_tests/test-llvm
+ rm -rf /Users/czgdp1807/lc_project/lc/integration_tests/test-llvm2
+ rm -rf /Users/czgdp1807/lc_project/lc/integration_tests/test-llvm_rtlib
+ rm -rf /Users/czgdp1807/lc_project/lc/integration_tests/test-c
+ rm -rf /Users/czgdp1807/lc_project/lc/integration_tests/test-cpp
+ rm -rf /Users/czgdp1807/lc_project/lc/integration_tests/test-x86
+ rm -rf /Users/czgdp1807/lc_project/lc/integration_tests/test-wasm
+ rm -rf /Users/czgdp1807/lc_project/lc/integration_tests/test-gcc
+ rm -rf /Users/czgdp1807/lc_project/lc/integration_tests/test-llvmImplicit
+ rm -rf /Users/czgdp1807/lc_project/lc/integration_tests/test-llvmStackArray
+ rm -rf /Users/czgdp1807/lc_project/lc/integration_tests/test-fortran
+ rm -rf /Users/czgdp1807/lc_project/lc/integration_tests/test-c_nopragma
+ rm -rf /Users/czgdp1807/lc_project/lc/integration_tests/test-llvm_nopragma
+ rm -rf /Users/czgdp1807/lc_project/lc/integration_tests/test-pytorch
+ mkdir /Users/czgdp1807/lc_project/lc/integration_tests/test-pytorch
+ cmake -DLC_BACKEND=pytorch -DFAST=no -DCURRENT_BINARY_DIR=/Users/czgdp1807/lc_project/lc/integration_tests/test-pytorch -S /Users/czgdp1807/lc_project/lc/integration_tests -B /Users/czgdp1807/lc_project/lc/integration_tests/test-pytorch
-- The C compiler identification is AppleClang 15.0.0.15000309
-- The CXX compiler identification is AppleClang 15.0.0.15000309
-- 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
-- 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
Configuration results
---------------------
Fortran compiler:
C compiler : /Library/Developer/CommandLineTools/usr/bin/cc
Build type: Debug
Fortran compiler flags:
C compiler flags : -g
Installation prefix: /usr/local
LC_BACKEND: pytorch
FAST: no
-- Found Torch: /Users/czgdp1807/mambaforge/envs/lc/lib/libtorch.dylib
-- Configuring done (0.6s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/czgdp1807/lc_project/lc/integration_tests/test-pytorch
+ make -j8
[ 50%] Building CXX object CMakeFiles/pytorch_01.cpp.dir/pytorch_01.cpp.o
[100%] Linking CXX executable pytorch_01.cpp
[100%] Built target pytorch_01.cpp
+ ctest -j8 --output-on-failure
Test project /Users/czgdp1807/lc_project/lc/integration_tests/test-pytorch
Start 1: pytorch_01.cpp
1/1 Test #1: pytorch_01.cpp ................... Passed 0.16 sec
100% tests passed, 0 tests failed out of 1
Label Time Summary:
pytorch = 0.16 sec*proc (1 test)
Total Test time (real) = 0.17 sec
It builds on CI, but gives SEGFAULT,
-- Found Torch: /Users/runner/micromamba/envs/lc/lib/libtorch.dylib
-- Configuring done (3.4s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/runner/work/lc/lc/integration_tests/test-pytorch
[ 50%] Building CXX object CMakeFiles/pytorch_01.cpp.dir/pytorch_01.cpp.o
[100%] Linking CXX executable pytorch_01.cpp
ld: warning: directory not found for option '-L/Users/runner/micromamba/envs/lc/lib/intel64'
ld: warning: directory not found for option '-L/Users/runner/micromamba/envs/lc/lib/intel64_win'
ld: warning: directory not found for option '-L/Users/runner/micromamba/envs/lc/lib/win-x64'
[100%] Built target pytorch_01.cpp
Test project /Users/runner/work/lc/lc/integration_tests/test-pytorch
Start 1: pytorch_01.cpp
Errors while running CTest
1/1 Test #1: pytorch_01.cpp ...................***Exception: SegFault 1.51 sec
So PyTorch C++ API testing works good on Linux CI. On macOS there is some issue with clang available on conda. It gives segmentation faults/bus errors. So we will test on Linux CI for now.
Okay. So the work flow is clear for PyTorch. Tomorrow I will make LC compile PyTorch C++ API code.
LC parses the AST of
integration_tests/pytorch_01.cpp
as follows,