ChainerMNプログラムを分散環境で動かすには、動かしたいプログラムとデータに加えて、2つのファイルを用意します。
- 動かしたいアプリケーションを起動するジョブスクリプト(ここでは例として以下の
job_mnist.sh
) - 補助ファイル
run.sh
ジョブスクリプトの内容は、走らせたいジョブの処理の内容に従って細かく変更を加えていきます。 補助ファイルは、最初に作成したあとは基本的に変更の必要はありません
import chainermn | |
from chainer.datasets import get_cifar10 | |
import pickle | |
comm = chainermn.create_communicator('pure_nccl') | |
if comm.rank == 0: | |
train, test = get_cifar10() | |
else: | |
train, test = None, None |
# LICENSE: MIT License | |
# How to use: | |
# $ pip install PyYAML fire pdfrw | |
# $ python pdfmark.py --infile=pdfmarks.yaml --outfile=pdfmarks | |
# $ gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out.pdf in.pdf | |
# | |
import sys | |
import pprint # NOQA | |
import yaml |
use std::ops; | |
#[derive(Debug,Copy,Clone)] | |
struct Vec3 { | |
e: [f32; 3] | |
} | |
#[allow(dead_code)] | |
impl Vec3 { | |
pub fn new(e1: f32, e2: f32, e3: f32) -> Vec3 { |
import hashlib | |
import sys | |
import numpy as np | |
from mpi4py import MPI | |
comm = MPI.COMM_WORLD | |
UINT32_MAX = 4294967295 | |
INT32_MAX = 2147483647 |
dataset_info = { | |
'cifar10': {'class_lables': 10, load_func: get_cifar10}, | |
'cifar100': {'class_lables': 100, load_func: get_cifar100}, | |
} | |
if args.dataset not in dataset_info: | |
raise RuntimeError('Invalid dataset choice.') | |
class_labels = dataset_info[args.dataset]['class_labels'] |
Fri Apr 12 07:58:03 UTC 2019 | |
================================================================================ | |
In process.sh: | |
CUDA_VERSION = 9.0 | |
PYTHON_VERSION = 2.7.15 | |
OPENMPI_VERSION = 2.1.3 | |
Chainer = https://github.com/chainer/chainer@master | |
CuPy = https://github.com/cupy/cupy@master |
name: "OctreeDecoder" | |
#------------------------------------------------------------------------------------------------------------ | |
# INPUT DATA | |
#------------------------------------------------------------------------------------------------------------ | |
layer {name: "octree_models" type: "OGNData" | |
top: "octree_model_values" top: "octree_labels" | |
ogn_data_param {batch_size: 4 source: "model_names.txt" preload_data: false}} |
name: "OctreeDecoder" | |
#------------------------------------------------------------------------------------------------------------ | |
# INPUT DATA | |
#------------------------------------------------------------------------------------------------------------ | |
layer {name: "octree_models" type: "OGNData" | |
top: "octree_model_values" top: "octree_labels" | |
ogn_data_param {batch_size: 4 source: "model_names.txt" preload_data: false}} |
#!/bin/bash | |
GROUP=$(id -ng) | |
MYDIR=/lustre/${GROUP}/$USER | |
export HOME=$MYDIR | |
. /etc/profile.d/modules.sh | |
module load cuda9/9.1.85 | |
module load anaconda3/4.3.0 |