forked from BIDData/BIDMat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbidmat
executable file
·79 lines (72 loc) · 3.28 KB
/
bidmat
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
#!/bin/bash
# export JAVA_HOME="" # Set here if not set in environment
# export CUDA_PATH="" # Set here if not set in environment
# Change these if needed
BLAS_ROOT="/code/QSML"
JOCL_VERSION="2.0.1-SNAPSHOT"
export JAVA_OPTS="${MEMSIZE} -Xms128M -Dfile.encoding=UTF-8" # Set as much memory as possible
BIDMAT_ROOT="${BASH_SOURCE[0]}"
if [ ! `uname` = "Darwin" ]; then
BIDMAT_ROOT=`readlink -f "${BIDMAT_ROOT}"`
else
while [ -L "${BIDMAT_ROOT}" ]; do
BIDMAT_ROOT=`readlink "${BIDMAT_ROOT}"`
done
fi
if [ "${CUDA_HOME}" = "" ]; then
CUDA_HOME=/usr/local/cuda
fi
BIDMAT_ROOT=`dirname "$BIDMAT_ROOT"`
pushd "${BIDMAT_ROOT}" > /dev/null
BIDMAT_ROOT=`pwd`
BIDMAT_ROOT="$( echo ${BIDMAT_ROOT} | sed s+/cygdrive/c+c:+ )"
JCUDA_LIBDIR=${BIDMAT_ROOT}/lib
JOCL_LIBDIR=${BIDMAT_ROOT}/lib
LIBDIR=${BIDMAT_ROOT}/lib
JCUDA_VERSION=`echo lib/jcuda*.jar | sed 's/.*jcuda-//' | sed 's/\.jar//'`
JAVA_NATIVE=`java getnativepath`
if [ `uname` = "Darwin" ]; then
export DYLD_LIBRARY_PATH="${BIDMAT_ROOT}/lib:${CUDA_HOME}/lib:${DYLD_LIBRARY_PATH}"
else
export LD_LIBRARY_PATH="${BIDMAT_ROOT}/lib:${BIDMAT_ROOT}/lib/cuda:${BLAS_ROOT}/lib:${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}"
fi
export JAVA_NATIVE=${LD_LIBRARY_PATH}:${DYLD_LIBRARY_PATH}:${JAVA_NATIVE}:
popd > /dev/null
if [ "$OS" = "Windows_NT" ]; then
if [ ! "${JAVA_HOME}" = "" ]; then
JAVA_HOME=`${BIDMAT_ROOT}/shortpath.bat "${JAVA_HOME}"`
export JAVA_HOME=`echo ${JAVA_HOME} | sed 's_\\\\_/_g'`/bin
fi
fi
BIDMAT_LIBS="${BIDMAT_ROOT}/BIDMat.jar;${LIBDIR}/ptplot.jar;${LIBDIR}/ptplotapplication.jar;\
${LIBDIR}/jhdf5.jar;${LIBDIR}/commons-math3-3.2.jar;${LIBDIR}/lz4-1.3.jar;${LIBDIR}/json-io-4.1.6.jar;\
${LIBDIR}/jfreechart-1.0.19.jar;${LIBDIR}/jcommon-1.0.23.jar"
JCUDA_LIBS="${JCUDA_LIBDIR}/jcuda-${JCUDA_VERSION}.jar;${JCUDA_LIBDIR}/jcublas-${JCUDA_VERSION}.jar;\
${JCUDA_LIBDIR}/jcufft-${JCUDA_VERSION}.jar;${JCUDA_LIBDIR}/jcurand-${JCUDA_VERSION}.jar;\
${JCUDA_LIBDIR}/jcusparse-${JCUDA_VERSION}.jar"
JOCL_LIBS="${JOCL_LIBDIR}/jocl-${JOCL_VERSION}.jar"
ALL_LIBS=";${LIBDIR}/IScala.jar;${BIDMAT_LIBS};${JCUDA_LIBS};${JOCL_LIBS};${JAVA_HOME}/lib/tools.jar"
if [ "$OS" = "Windows_NT" ]; then
if [ ! "${CUDA_PATH}" = "" ]; then
NEWPATH=`${BIDMAT_ROOT}/shortpath.bat "${CUDA_PATH}"`
NEWPATH=`echo $NEWPATH | sed 's_\\\\_/_g'`/bin
fi
DJAVA_NATIVE="-Djava.library.path=${LIBDIR};${NEWPATH}"
else
ALL_LIBS=`echo "${ALL_LIBS}" | sed 's/;/:/g'`
DJAVA_NATIVE="-Djava.library.path=${JAVA_NATIVE}"
fi
export JAVA_OPTS="${DJAVA_NATIVE} ${JAVA_OPTS}"
if [ "$1" = "notebook" ]; then
shift 1
if [ ! -z "$@" ]; then
KERNEL_CMD="[\"java\", \"-cp\", \"${ALL_LIBS}\", \"$DJAVA_NATIVE\", \"${MEMSIZE}\", \"-Xms128M\", \
\"-Dfile.encoding=UTF-8\", \"org.refptr.iscala.IScala\", \"--profile\", \"{connection_file}\", \"--parent\", \"$@\"]"
else
KERNEL_CMD="[\"java\", \"-cp\", \"${ALL_LIBS}\", \"$DJAVA_NATIVE\", \"${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
${BIDMAT_ROOT}/scripts/scala/scala -Dscala.repl.maxprintstring=6000 -nobootcp -toolcp "${ALL_LIBS}" -cp "${ALL_LIBS}" -Yrepl-sync -i ${LIBDIR}/bidmat_init.scala "$@"
fi