Description Usage Arguments Notes Details
Properly end “mpi” workers before quitting R (e.g., at a crash)
1 | mpi_last(gv)
|
gv |
A list with at least one named element |
Code is based on http://acmmac.acadiau.ca/tl_files/sites/acmmac/resources/examples/task_pull.R.txt.
Ideally, we use Rmpi::mpi.exit()
on exit, but we
cannot as of Rmpi v0.6.6. Because rSFSW2 does not attach
Rmpi, the function mpi.exit
throws
an error when it executes detach(package:Rmpi)
which results in
"Error in detach(package:Rmpi) : invalid 'name' argument"
.
Rmpi::mpi.comm.size(1)
crashes with a segfault if
there are no workers running because of the call
.Call("mpi_comm_is_null", as.integer(comm), PACKAGE = "Rmpi")
.
Ideally, we would use Rmpi::mpi.close.Rslaves()
.
However, this function hangs our R session because of its call to
Rmpi::mpi.comm.disconnect()
; even wrapping this
in try
doesn't prevent it from hanging.
gv
will usually be the package-level global
variable environment SFSW2_glovars
. This is because this function
is registered as finalizer to the object SFSW2_glovars
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.