This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ -z "$(ls -A /mnt/seafile-fuse)" ]; then | |
echo "Mountpoint /mnt/seafile-fuse empty, mounting Seafile using seaf-fuse.sh..." | |
echo "/opt/seafile/seafile-server-latest/seaf-fuse.sh start /mnt/seafile-fuse" | |
/opt/seafile/seafile-server-latest/seaf-fuse.sh start /mnt/seafile-fuse | |
fi | |
if [ -z "$(ls -A /mnt/seafile-fuse)" ]; then | |
echo "Failed to mount Seafile: /mnt/seafile-fuse still empty! Aborting..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess, sys | |
import numpy as np | |
from io import StringIO | |
def get_free_gpu(num_gpus=1): | |
""" returns: comma-separated list of device ids, e.g. to set CUDA_VISIBLE_DEVICES for PyTorch """ | |
output = subprocess.check_output(["nvidia-smi -q -d Memory | grep -A4 GPU | grep Free"], shell=True).decode() | |
memory_available = np.array( [int(x.split()[2]) for x in StringIO(output)] ) | |
memory_available = np.where( memory_available == 11018 )[0] |