samples: Install Tensorflow in HOME directory
This commit is contained in:
+5
-2
@@ -47,5 +47,8 @@ proto/compiler/google/src/google/protobuf/compiler/kotlin/protoc
|
||||
# translator auto generated artifacts
|
||||
kotstd/ll
|
||||
|
||||
#test teamcity property: commitable only with -f
|
||||
backend.native/tests/teamcity-test.property
|
||||
# test teamcity property: commitable only with -f
|
||||
backend.native/tests/teamcity-test.property
|
||||
|
||||
# Sample output
|
||||
samples/**/*.kt.bc-build
|
||||
@@ -12,10 +12,12 @@ showing how a TensorFlow client in Kotlin/Native could look like.
|
||||
|
||||
./build.sh
|
||||
|
||||
will install [TensorFlow for C](https://www.tensorflow.org/versions/r1.1/install/install_c) into `/opt/local` (if not yet done) and build the example.
|
||||
will install [TensorFlow for C](https://www.tensorflow.org/versions/r1.1/install/install_c) into
|
||||
`$HOME/.konan/third-party/tensorflow` (if not yet done) and build the example.
|
||||
|
||||
./HelloTensorflow.kexe
|
||||
|
||||
will then run the example.
|
||||
|
||||
You may need to specify `LD_LIBRARY_PATH` or `DYLD_LIBRARY_PATH` to `/opt/local/lib` if the TensorFlow dynamic library cannot be found.
|
||||
You may need to specify `LD_LIBRARY_PATH` or `DYLD_LIBRARY_PATH` to `$HOME/.konan/third-party/tensorflow/lib`
|
||||
if the TensorFlow dynamic library cannot be found.
|
||||
@@ -2,9 +2,12 @@
|
||||
|
||||
PATH=../../dist/bin:../../bin:$PATH
|
||||
DIR=.
|
||||
TF_TARGET_DIRECTORY="/opt/local" # If you change this, adapt compilerOpts in tensorflow.def accordingly
|
||||
TF_TARGET_DIRECTORY="$HOME/.konan/third-party/tensorflow"
|
||||
TF_TYPE="cpu" # Change to "gpu" for GPU support
|
||||
|
||||
CFLAGS_macbook="-I${TF_TARGET_DIRECTORY}/include"
|
||||
CFLAGS_linux="-I${TF_TARGET_DIRECTORY}/include"
|
||||
|
||||
if [ x$TARGET == x ]; then
|
||||
case "$OSTYPE" in
|
||||
darwin*) TARGET=macbook; TF_TARGET=darwin ;;
|
||||
@@ -22,12 +25,14 @@ COMPILER_ARGS=${!var} # add -opt for an optimized build.
|
||||
|
||||
if [ ! -d $TF_TARGET_DIRECTORY/include/tensorflow ]; then
|
||||
echo "Installing TensorFlow into $TF_TARGET_DIRECTORY ..."
|
||||
sudo mkdir -p $TF_TARGET_DIRECTORY
|
||||
mkdir -p $TF_TARGET_DIRECTORY
|
||||
curl -s -L \
|
||||
"https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-${TF_TARGET}-x86_64-1.1.0.tar.gz" |
|
||||
sudo tar -C $TF_TARGET_DIRECTORY -xz
|
||||
tar -C $TF_TARGET_DIRECTORY -xz
|
||||
fi
|
||||
|
||||
cinterop -def $DIR/tensorflow.def -copt "$CFLAGS" -target $TARGET -o tensorflow.kt.bc || exit 1
|
||||
konanc $COMPILER_ARGS -target $TARGET $DIR/HelloTensorflow.kt -library tensorflow.kt.bc -o HelloTensorflow.kexe \
|
||||
-linkerArgs "-L$TF_TARGET_DIRECTORY/lib -ltensorflow" || exit 1
|
||||
|
||||
echo "Note: You may need to specify LD_LIBRARY_PATH or DYLD_LIBRARY_PATH env variables to $TF_TARGET_DIRECTORY/lib if the TensorFlow dynamic library cannot be found."
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
headers = tensorflow/c/c_api.h
|
||||
compilerOpts = -I/opt/local/include -L/opt/local/lib
|
||||
|
||||
Reference in New Issue
Block a user