Skip to content

Commit

Permalink
Fix initialization of Distributed
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing committed Jun 26, 2024
1 parent 964c11a commit ec068f7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ version = "0.1.0"
[deps]
Extrae_jll = "2b2c4be0-e38c-5918-b8b4-9a308845a1e9"

[weakdeps]
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[extension]
ExtraeDistributedExt = "Distributed"

[compat]
Extrae_jll = "4.1.2"
julia = "1.9"
21 changes: 21 additions & 0 deletions ext/ExtraeDistributedExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module ExtraeDistributedExt

using Extrae
using Distributed

taskid()::Cuint = Distributed.myid() - 1
ntasks()::Cuint = Distributed.nworkers() + 1

function init(::Val{:Distributed})
FFI.Extrae_set_numtasks_function(ntasks)
FFI.Extrae_set_taskid_function(taskid)

ENV["EXTRAE_PROGRAM_NAME"] = "JULIATRACE-$(Distributed.myid())"

Extrae.init()
Libc.flush_cstdio()

return nothing
end

end

0 comments on commit ec068f7

Please sign in to comment.