|
#!/bin/bash -e |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export COLAB_GPU="$([[ -c /dev/nvidiactl ]] && echo 1)" |
|
|
|
if [[ -e /customize_for_vm_type.sh ]]; then |
|
/customize_for_vm_type.sh |
|
fi |
|
|
|
/usr/local/colab/bin/oom_monitor.sh & |
|
|
|
|
|
|
|
( while true; do |
|
GCE_METADATA_HOST="${VM_GCE_METADATA_HOST}" \ |
|
LD_PRELOAD='/usr/lib/x86_64-linux-gnu/libtcmalloc.so.4' \ |
|
/usr/colab/bin/kernel_manager_proxy \ |
|
--listen_port="${KMP_LISTEN_PORT}" \ |
|
--target_port="${KMP_TARGET_PORT}" \ |
|
${KMP_EXTRA_ARGS} || true |
|
sleep 1 |
|
done & ) |
|
|
|
|
|
for f in /var/log/apt/history.log /var/log/pip.log; do |
|
mv "$f" "${f}.bak-run.sh" 2>/dev/null || true |
|
done |
|
|
|
|
|
if [[ "${COLAB_WARMUP_DEFAULTS}" == "1" ]]; then |
|
python3 -c "import google.colab._kernel" |
|
python3 -c "import matplotlib" |
|
python3 -c "import tensorflow" & |
|
fi |
|
|
|
|
|
/usr/local/bin/colab-fileshim.py ${COLAB_FILESHIM_EXTRA_ARGS} & |
|
|
|
|
|
for f in $(ls /opt/bin/.nvidia 2>/dev/null); do |
|
ln -st /opt/bin "/opt/bin/.nvidia/${f}" |
|
ln -st /usr/bin "/opt/bin/.nvidia/${f}" |
|
done |
|
|
|
cd / |
|
|
|
|
|
if [[ "${COLAB_HUMAN_READABLE_NODE_LOGS}" == "1" ]]; then |
|
PIPE=/tmp/.node.out |
|
if ! [[ -p "${PIPE}" ]]; then |
|
mkfifo "${PIPE}" |
|
fi |
|
/datalab/web/node_modules/bunyan/bin/bunyan \ |
|
-l "${COLAB_NODE_LOG_LEVEL:-info}" < "${PIPE}" & |
|
exec >& "${PIPE}" |
|
fi |
|
exec /tools/node/bin/node /datalab/web/app.js |
|
|
|
|