@@ -7,7 +7,7 @@ const MPI_TRANSPORT_ALL = 1
7
7
const TCP_TRANSPORT_ALL = 2
8
8
9
9
type MPIManager <: ClusterManager
10
- np:: Integer
10
+ np:: Int
11
11
mpi2j:: Dict
12
12
j2mpi:: Dict
13
13
mode:: Int
@@ -28,17 +28,24 @@ type MPIManager <: ClusterManager
28
28
ranks:: Array
29
29
30
30
31
- function MPIManager (;np= Sys. CPU_CORES, mpi_cmd= false , launch_timeout= 60.0 , mode= MPI_ON_WORKERS)
31
+ function MPIManager (;np= Sys. CPU_CORES,
32
+ mpi_cmd= ` mpirun -np $np ` ,
33
+ launch_timeout= 60.0 ,
34
+ mode= MPI_ON_WORKERS)
32
35
launched = false
33
-
34
36
if mode != MPI_ON_WORKERS
35
37
launched = true
36
38
mpi_cmd = ` `
37
- elseif mpi_cmd == false
38
- mpi_cmd = ` mpirun -np $np `
39
39
end
40
-
41
- mgr = new (np, Dict {Int, Int} (), Dict {Int, Int} (), mode, mpi_cmd, launch_timeout, false , Condition (), launched)
40
+ mgr = new (Int (np),
41
+ Dict {Int,Int} (),
42
+ Dict {Int,Int} (),
43
+ mode,
44
+ mpi_cmd,
45
+ launch_timeout,
46
+ false ,
47
+ Condition (),
48
+ launched)
42
49
43
50
if mode != MPI_TRANSPORT_ALL
44
51
# Start a listener for capturing stdout's from the workers
@@ -56,11 +63,23 @@ type MPIManager <: ClusterManager
56
63
comm, comm_size, rank = comm_info ()
57
64
mgr. ranks = [i for i in 1 : (comm_size- 1 )]
58
65
end
59
-
60
66
return mgr
61
67
end
62
68
end
63
69
70
+ function Base. show (io:: IO , man:: MPIManager )
71
+ mode = if man. mode == 0
72
+ " MPI_ON_WORKERS"
73
+ elseif man. mode == 1
74
+ " MPI_TRANSPORT_ALL"
75
+ elseif man. mode == 2
76
+ " TCP_TRANSPORT_ALL"
77
+ else
78
+ error (" invalid MPIManager mode: $(man. mode) " )
79
+ end
80
+ print (io, " MPI.MPIManager(np=$(man. np) ,launched=$(man. launched) ,mode=$(mode) )" )
81
+ end
82
+
64
83
function launch (manager:: MPIManager , params:: Dict , instances_arr:: Array , c:: Condition )
65
84
try
66
85
if manager. mode == MPI_ON_WORKERS
0 commit comments