Improved build script for tensorflow example, fixed readme (#553)
This commit is contained in:
committed by
Nikolay Igotti
parent
409d00db96
commit
c3074db2d0
@@ -8,16 +8,14 @@ this example is built on top of the
|
||||
[TensorFlow C API](https://github.com/tensorflow/tensorflow/blob/r1.1/tensorflow/c/c_api.h),
|
||||
showing how a TensorFlow client in Kotlin/Native could look like.
|
||||
|
||||
##Installation
|
||||
|
||||
[Install TensorFlow for C](https://www.tensorflow.org/versions/r1.1/install/install_c) into `/usr/local`.
|
||||
|
||||
Compile:
|
||||
## Installation
|
||||
|
||||
./build.sh
|
||||
|
||||
Run:
|
||||
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.
|
||||
|
||||
./HelloTensorflow.kexe
|
||||
|
||||
You may need to specify `LD_LIBRARY_PATH` or `DYLD_LIBRARY_PATH` to `/opt/local/lib` if TensorFlow dynamic library cannot be found.
|
||||
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.
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
PATH=../../dist/bin:../../bin:$PATH
|
||||
DIR=.
|
||||
TF_TARGET_DIRECTORY="/opt/local"
|
||||
TF_TARGET_DIRECTORY="/opt/local" # If you change this, adapt compilerOpts in tensorflow.def accordingly
|
||||
TF_TYPE="cpu" # Change to "gpu" for GPU support
|
||||
|
||||
if [ x$TARGET == x ]; then
|
||||
case "$OSTYPE" in
|
||||
@@ -20,9 +21,8 @@ var=COMPILER_ARGS_${TARGET}
|
||||
COMPILER_ARGS=${!var} # add -opt for an optimized build.
|
||||
|
||||
if [ ! -d $TF_TARGET_DIRECTORY/include/tensorflow ]; then
|
||||
echo "Installing TensorFlow..."
|
||||
TF_TYPE="cpu" # Change to "gpu" for GPU support
|
||||
TF_TARGET_DIRECTORY="/opt/local"
|
||||
echo "Installing TensorFlow into $TF_TARGET_DIRECTORY ..."
|
||||
sudo 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
|
||||
@@ -30,4 +30,4 @@ 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/opt/local/lib -ltensorflow" || exit 1
|
||||
-linkerArgs "-L$TF_TARGET_DIRECTORY/lib -ltensorflow" || exit 1
|
||||
|
||||
Reference in New Issue
Block a user