-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbidmach
executable file
·105 lines (92 loc) · 3.13 KB
/
bidmach
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
# export JAVA_HOME="" # Set here if not set in environment
# export CUDA_PATH="" # Set here if not set in environment
MEMSIZE="-Xmx14G" # Set as much memory as possible
BIDMACH_ROOT="${BASH_SOURCE[0]}"
if [ ! `uname` = "Darwin" ]; then
BIDMACH_ROOT=`readlink -f "${BIDMACH_ROOT}"`
else
while [ -L "${BIDMACH_ROOT}" ]; do
BIDMACH_ROOT=`readlink "${BIDMACH_ROOT}"`
done
fi
BIDMACH_ROOT=`dirname "$BIDMACH_ROOT"`
pushd "${BIDMACH_ROOT}" > /dev/null
BIDMACH_ROOT=`pwd -P`
BIDMACH_ROOT="$( echo ${BIDMACH_ROOT} | sed 's+/cygdrive/\(.\)+\1:+' )"
LIBDIR="${BIDMACH_ROOT}/lib"
LOGGING_CONF="${BIDMACH_ROOT}/conf/logging.conf"
if [ -e "${LOGGING_CONF}" ]; then
LOG_OPTS="-Djava.util.logging.config.file=${LOGGING_CONF}"
else
LOG_OPTS=""
fi
export JAVA_OPTS="${MEMSIZE} -Xms128M -Dfile.encoding=UTF-8 ${LOG_OPTS} ${JAVA_OPTS}"
BIDMACHBULLET_VERSION=`echo lib/BIDMachBullet-*-cpu-*.jar | sed 's/.*BIDMachBullet-//' | sed 's/-cpu.*\.jar//'`
OSS=`uname -a`
if [ "$ARCH" = "" ]; then
ARCH=`arch`
fi
if [[ "$OSS" == Darwin* ]] ; then
if [[ "$OSS" == *x86_64 ]] ; then
ARCH="x86_64"
fi
OSS="apple"
elif [[ "$OSS" == Linux* ]] ; then
OSS="linux"
elif [[ "$OSS" == CYGWIN* ]] ; then
if [[ "$OSS" == *WOW* ]] ; then
ARCH="x86_64"
fi
OSS="windows"
else
echo "OS not supported" $OSS
exit 1
fi
if [ "$OSS" = "windows" ]; then
if [ ! "${JAVA_HOME}" = "" ]; then
JAVA_HOME=`${BIDMACH_ROOT}/shortpath.bat "${JAVA_HOME}"`
export JAVA_HOME=`echo ${JAVA_HOME} | sed 's_\\\\_/_g'`/bin
fi
fi
cd lib
BIDMACH_JARS=`echo *.jar`
BIDMACH_LIBS="${BIDMACH_ROOT}/target/BIDMachBullet-${BIDMACHBULLET_VERSION}.jar"
for lib in ${BIDMACH_JARS}; do
if [[ "$lib" != IScala* && "$lib" != scala* ]]; then
BIDMACH_LIBS="${BIDMACH_LIBS};${LIBDIR}/${lib}"
fi
done
popd > /dev/null
TOOL_LIBS="${BIDMACH_ROOT}/conf;${JAVA_HOME}/lib/tools.jar;${LIBDIR}/IScala-1.0.0.jar"
ALL_LIBS="${TOOL_LIBS};\
${BIDMACH_LIBS}"
if [ "$OSS" = "windows" ]; then
if [ ! "${CUDA_PATH}" = "" ]; then
NEWPATH=`${BIDMACH_ROOT}/shortpath.bat "${CUDA_PATH}"`
NEWPATH=`echo $NEWPATH | sed 's_\\\\_/_g'`/bin
fi
else
TOOL_LIBS=`echo "${TOOL_LIBS}" | sed 's/;/:/g'`
ALL_LIBS=`echo "${ALL_LIBS}" | sed 's/;/:/g'`
fi
userargs=""
if [ "$2" != "" ]; then
userargs="-Duser.arg0=$2"
j=1;
for i in ${*:3}; do
userargs="$userargs -Duser.arg$j=$i"
j=$((j+1))
done
fi
if [ "$1" = "notebook" ]; then
shift 1
if [ ! -z "$@" ]; then
KERNEL_CMD="[\"java\", \"-cp\", \"${ALL_LIBS}\", \"${MEMSIZE}\", \"-Xms128M\", \"-Dfile.encoding=UTF-8\", \"org.refptr.iscala.IScala\", \"--profile\", \"{connection_file}\", \"--parent\", \"$@\"]"
else
KERNEL_CMD="[\"java\", \"-cp\", \"${ALL_LIBS}\", \"${MEMSIZE}\", \"-Xms128M\", \"-Dfile.encoding=UTF-8\", \"org.refptr.iscala.IScala\", \"--profile\", \"{connection_file}\", \"--parent\"]"
fi
ipython notebook --profile=scala --KernelManager.kernel_cmd="$KERNEL_CMD"
else
${BIDMACH_ROOT}/scripts/scala/scala -Dscala.repl.maxprintstring=8000 "${userargs}" -nobootcp -toolcp "${TOOL_LIBS}" -cp "${ALL_LIBS}" -Yrepl-sync -i ${LIBDIR}/bidmach_init.scala ${1}
fi