Files
kotlin-fork/kotlin-native/samples/torch/downloadTorch.sh
T
Stanislav Erokhin f624800b84 Move everything under kotlin-native folder
I was forced to manually do update the following files, because otherwise
they would be ignored according .gitignore settings. Probably they
should be deleted from repo.

Interop/.idea/compiler.xml
Interop/.idea/gradle.xml
Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_3.xml
Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_3.xml
Interop/.idea/modules.xml
Interop/.idea/modules/Indexer/Indexer.iml
Interop/.idea/modules/Runtime/Runtime.iml
Interop/.idea/modules/StubGenerator/StubGenerator.iml
backend.native/backend.native.iml
backend.native/bc.frontend/bc.frontend.iml
backend.native/cli.bc/cli.bc.iml
backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt
backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt
backend.native/tests/link/lib/foo.kt
backend.native/tests/link/lib/foo2.kt
backend.native/tests/teamcity-test.property
2020-10-27 21:00:28 +03:00

33 lines
1008 B
Bash
Executable File

#!/usr/bin/env bash
KONAN_USER_DIR=${KONAN_DATA_DIR:-"$HOME/.konan"}
TH_TARGET_DIRECTORY="$KONAN_USER_DIR/third-party/torch"
NO_CUDA=true # set to false for GPU support
if [ ! -d $TH_TARGET_DIRECTORY/include/THNN ]; then
echo "Installing Torch into $TH_TARGET_DIRECTORY ..."
mkdir -p build/3rd-party
cd build/3rd-party
git clone https://github.com/pytorch/pytorch.git
# Current pytorch master fails the build so we need to checkout a correct revision.
cd pytorch && git checkout 310c3735b9eb97f30cee743b773e5bb054989edc^ && cd ../
mkdir build_torch
cd build_torch
cmake -DNO_CUDA=$NO_CUDA ../pytorch/aten
make
make DESTDIR=$TH_TARGET_DIRECTORY install
cd $TH_TARGET_DIRECTORY
# remove 'usr/local' prefix produced by make:
mv usr/local/* .
rm -d usr/local usr
# hack to solve "fatal error: 'generic/THNN.h' file not found" when linking, -I$<DIR>/include/THNN did not work
cp include/THNN/generic/THNN.h include/TH/generic/THNN.h
fi