Skip to content

Instantly share code, notes, and snippets.

View AmericanEnglish's full-sized avatar
💭
javascript hurts my feelings.

Carlos Barajas AmericanEnglish

💭
javascript hurts my feelings.
  • Maryland
View GitHub Profile
@AmericanEnglish
AmericanEnglish / keras_multiple_gpu.py
Last active September 24, 2020 06:15
How to get Keras to use multiple GPUs with Tensorflow 2.0.0 =<
from mymodel import create_model
from data import x, y
if __name__ == "__main__":
from tensorflow import distribute as D
from tensorflow import config
# Get a list of physical devices, specifically GPUs
devices = [device for device in config.list_physical_devices() if "GPU" == device.device_type]
devices = ["/gpu:{}".format(i) for i, device in enumerate(devices)]
# Setup a single machine multi-gpu strategy that does not use NCCL
@AmericanEnglish
AmericanEnglish / README.md
Last active May 26, 2020 22:56
How to compile TensorFlow 2.0 from source in an HPC environment that uses EasyBuild for CentOS 7.x

How to compile TensorFlow 2.0 from source in an HPC environment that uses EasyBuild for CentOS7

Some background about why another Gist on compiling tensorflow without root

If you're like me and you don't have root access to a HPC system and your system adminstrators use EasyBuild combined with Lmod you are going to be in for a bad time. Our CentOS7 did not ship out of the box capable of compiling tensorflow 2.0 from source with no problems. I scoured several closed and recently opened issues to write a script that enables the creation of a fully functional .whl for tensorflow 2.0. Note that on our cluster we have only two different sets of GPUs. One set has compute capability 7.0 (V100) and compute capability 3.5 (K20m). So many issues came up

  1. because Bazel can't handle symlinks for gcc leading to errors like