This file contains hidden or 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 keras | |
import numpy as np | |
from keras.datasets import cifar10 | |
from keras.preprocessing.image import ImageDataGenerator | |
from keras.layers.normalization import BatchNormalization | |
from keras.layers import Conv2D, Dense, Input, add, Activation, GlobalAveragePooling2D | |
from keras.callbacks import LearningRateScheduler, TensorBoard, ModelCheckpoint | |
from keras.models import Model | |
from keras import optimizers, regularizers | |
from keras import backend as K |
This file contains hidden or 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
from tensorflow.examples.tutorials.mnist import input_data | |
import tensorflow as tf | |
def main(_): | |
mnist = input_data.read_data_sets("./data", one_hot=True) | |
x = tf.placeholder(tf.float32, [None, 784]) | |
W = tf.Variable(tf.truncated_normal(shape=[784, 10], stddev=0.1)) | |
b = tf.Variable(tf.constant(0.1, shape=[10])) | |
y = tf.matmul(x, W) + b | |
y_ = tf.placeholder(tf.float32, [None, 10]) |
This file contains hidden or 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
(dp) dl2017@mtk:~/Desktop/horovod/examples$ strace -f -e 'trace=!poll' mpirun -np 2 -H 192.168.2.243:1,192.168.3.246:1 -bind-to none -map-by slot -x NCCL_DEBUG=INFO -x LD_LIBRARY_PATH python3 keras_mnist_advanced.pyexecve("/usr/local/bin/mpirun", ["mpirun", "-np", "2", "-H", "192.168.2.243:1,192.168.3.246:1", "-bind-to", "none", "-map-by", "slot", "-x", "NCCL_DEBUG=INFO", "-x", "LD_LIBRARY_PATH", "python3", "keras_mnist_advanced.py"], [/* 36 vars */]) = 0 | |
brk(NULL) = 0x10ec000 | |
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) | |
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f32b0cc6000 | |
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) | |
open("/usr/local/cuda-8.0/lib64/tls/x86_64/libopen-rte.so.40", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) | |
stat("/usr/local/cuda-8.0/lib64/tls/x86_64", 0x7ffdaecc9af0) = -1 ENOENT (No such file or directory) | |
open("/usr/local/c |
This file contains hidden or 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
(dp) dl2017@mtk:~/Desktop/horovod/examples$ strace mpirun --prefix /usr/local \ | |
> -np 2 \ | |
> -H 192.168.2.243:1,192.168.3.246:1 \ | |
> -bind-to none -map-by slot \ | |
> -x NCCL_DEBUG=INFO -x LD_LIBRARY_PATH \ | |
> python3 keras_mnist_advanced.py | |
execve("/usr/local/bin/mpirun", ["mpirun", "--prefix", "/usr/local", "-np", "2", "-H", "192.168.2.243:1,192.168.3.246:1", "-bind-to", "none", "-map-by", "slot", "-x", "NCCL_DEBUG=INFO", "-x", "LD_LIBRARY_PATH", "python3", ...], [/* 36 vars */]) = 0 | |
brk(NULL) = 0x19c7000 | |
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) | |
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0c9c190000 |
This file contains hidden or 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
dl2017@mtk:~$ strace mpirun -np 2 -H 192.168.2.243:1,192.168.3.246:1 -bind-to none -map-by slot -x NCCL_DEBUG=INFO -x LD_LIBRARY_PATH python3 keras_mnist_advanced.py | |
execve("/usr/local/bin/mpirun", ["mpirun", "-np", "2", "-H", "192.168.2.243:1,192.168.3.246:1", "-bind-to", "none", "-map-by", "slot", "-x", "NCCL_DEBUG=INFO", "-x", "LD_LIBRARY_PATH", "python3", "keras_mnist_advanced.py"], [/* 33 vars */]) = 0 | |
brk(NULL) = 0x176c000 | |
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) | |
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fda47570000 | |
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) | |
open("/usr/local/cuda-8.0/lib64/tls/x86_64/libopen-rte.so.40", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) | |
stat("/usr/local/cuda-8.0/lib64/tls/x86_64", 0x7fff4ff675c0) = -1 ENOENT (No such file or directory) | |
open("/usr/local/cuda-8.0/lib64/tls/libopen-rte.so.40", O_RDONLY|O_CLO |
This file contains hidden or 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
""" | |
modfied from MorvanZhou' code! | |
Know more, visit my Python tutorial page: https://morvanzhou.github.io/tutorials/ | |
My Youtube Channel: https://www.youtube.com/user/MorvanZhou | |
More about Reinforcement learning: https://morvanzhou.github.io/tutorials/machine-learning/reinforcement-learning/ | |
Dependencies: | |
tensorflow: 1.1.0 | |
matplotlib |
NewerOlder