Skip to content

Commit 29700c9

Browse files
committed
worker_rank returns 1 if there's only one process
1 parent 4b17b8f commit 29700c9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/ParallelUtilities.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ module ParallelUtilities
33
using Reexport
44
@reexport using Distributed
55

6-
worker_rank() = myid()-minimum(workers())+1
6+
function worker_rank()
7+
if nworkers()==1
8+
return 1
9+
end
10+
myid()-minimum(workers())+1
11+
end
712

813
function split_across_processors(num_tasks::Integer,num_procs=nworkers(),proc_id=worker_rank())
914
if num_procs == 1

0 commit comments

Comments
 (0)