Skip to content

Instantly share code, notes, and snippets.

View ArthurCamara's full-sized avatar

Arthur Câmara ArthurCamara

View GitHub Profile
@ArthurCamara
ArthurCamara / free_gpus.py
Last active September 16, 2020 09:18
Find free GPUs and set them as visible for pytorch or tensorflow
import os
import numpy as np
def get_free_gpus(n_gpus=2):
os.system('nvidia-smi -q -d Memory |grep -A4 GPU|grep Free >tmp')
memory_available = np.array([int(x.split()[2]) for x in open('tmp', 'r').readlines()])
good_gpus = list((np.array(memory_available) > 6000).nonzero()[0])
if len(good_gpus) == 0:
raise IndexError
good_gpus = good_gpus[:n_gpus]
@ArthurCamara
ArthurCamara / keybase.md
Created April 20, 2020 21:25
keybase.md

Keybase proof

I hereby claim:

  • I am arthurcamara on github.
  • I am acamara (https://keybase.io/acamara) on keybase.
  • I have a public key ASCXvOygVHGospMEYXM_v2e-N8MH3o3X7GrMYgxBGFr7Gwo

To claim this, I am signing this object: