-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathiridis_launcher.jl
105 lines (79 loc) · 2.32 KB
/
iridis_launcher.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
function bind_iridis_procs()
home = ENV["HOME"]
# find out what cluster we are on
node_file_name = ENV["PBS_NODEFILE"]
# read PBS_NODEFILE
filestream = open(node_file_name)
seekstart(filestream)
node_file = readlines(filestream)
# strip eol
node_file = map(x->strip(x,['\n']),node_file)
# get number of workers on each node
procs = Dict{ASCIIString,Int}()
for n in node_file
procs[n] = get(procs,n,0) + 1
end
println("name of compute nodes and number of workers:")
println(procs)
# add processes on master itself
master = ENV["HOSTNAME"]
if procs[master] > 1
addprocs(procs[master]-1)
println("added $(procs[master]-1) processes on master itself")
end
# get a machine file for other hosts
machines = ASCIIString[]
for i in 1:length(node_file)
if node_file[i] != master
push!(machines,node_file[i])
end
end
println("processes on worker machines:")
println(machines)
# add to julia home
println("adding machines to JULIA_HOME: $JULIA_HOME")
for m in machines
addprocs([m], dir= JULIA_HOME)
end
println("done")
end
function bind_iridis_procs(ppn::Int)
# add only ppn processes per node
home = ENV["HOME"]
# find out what cluster we are on
node_file_name = ENV["PBS_NODEFILE"]
# read PBS_NODEFILE
filestream = open(node_file_name)
seekstart(filestream)
node_file = readlines(filestream)
# strip eol
node_file = map(x->strip(x,['\n']),node_file)
# get number of workers on each node
procs = Dict{ASCIIString,Int}()
for n in node_file
procs[n] = get(procs,n,0) + 1
end
println("name of compute nodes and number of workers:")
println(procs)
# add processes on master itself
master = ENV["HOSTNAME"]
wrker = 0
while wrker < ppn
addprocs(1)
wrker += 1
end
println("added $wrker processes on master itself")
# add procs on other machines
for (k,v) in procs
wrker = 0
if k!=master
while wrker < ppn
addprocs([k], dir= JULIA_HOME)
# println("addprocs($k)")
wrker += 1
end
println("added $wrker processes on machine $k")
end
end
println("done")
end