Browse files

computationally irrelevant: error mesaging

  • Loading branch information...
TillF committed Aug 3, 2017
1 parent 7dd086b commit 4f8821e0481a9f09b7ca0fb8a0da4e67d43396c6
Showing with 13 additions and 7 deletions.
  1. +1 −1 DESCRIPTION
  2. +9 −4 R/close_mpi.R
  3. +3 −2 R/optim_ppso_robust.R
@@ -1,7 +1,7 @@
Package: ppso
Type: Package
Title: Particle Swarm Optimization and Dynamically Dimensioned Search, optionally using parallel computing based on Rmpi
Version: 0.9-9993
Version: 0.9-9994
Date: 2017-08-03
Author: Till Francke <>
Maintainer: Till Francke <>
@@ -21,10 +21,13 @@ close_mpi=function()
i=i+1 #count orphaned messages
if (i > sum(globvars$status==2)) warning(paste(i,"orphaned MPI-messages discarded."))
if (i < sum(globvars$status==2))
warning(paste(sum(globvars$status==2)-i,"slave(s) may still be evaluating."))
if (i < sum(globvars$status==2))
warning(paste(sum(globvars$status==2)-i,"slave(s) may still be evaluating."))
if (verbose_master) print(paste(sum(globvars$status==2)-i,"slave(s) may still be evaluating."))
if (globvars$mpi_mode=="loop")
if (verbose_master){ print(paste(Sys.time()," ...sending slaves kill-tag...")); flush.console()}
@@ -41,8 +44,10 @@ close_mpi=function()
if (verbose_master){ print(paste(Sys.time()," ...trying to close slaves...")); flush.console()}
#mpi.close.Rslaves() #causes hang on orson: close cluster, if enabled, no prior deaths and no pending runs
#mpi.close.Rslaves() #causes hang, when slaves are still in mpi_loop (which they don't leave, because the kill-message has been deleted?)
#mpi.quit() #causes hang on orson
if (verbose_master){ print(paste(Sys.time()," end of close_mpi.")); flush.console()}
if (interactive()) warning("Couldn't close some slaves. You may try by calling 'mpi.close.Rslaves()'. BEWARE: This may crash R, sorry for the inconvenience.")
@@ -107,12 +107,13 @@ if (verbose_master) {print(paste(Sys.time(),"...slaves initialized."));
if (!is.null(logfile) && ((load_projectfile!="loaded") || (!file.exists(logfile)))) #create logfile header, if it is not to be appended, or if it does not yet exist
if (!is.null(colnames(globvars$X)))
if (verbose_master) {print(paste(Sys.time(),"...prepared log file (header written)")); flush.console()}
if (!is.null(colnames(globvars$X)))
par_names=paste(colnames(globvars$X),collapse="\t") else
par_names=paste(rep("parameter",number_of_parameters),seq(1,number_of_parameters),sep="_",collapse="\t") #simple numbering of parameters
write.table(paste("time",par_names,"objective_function","worker",sep="\t") , file = logfile, quote = FALSE, sep = "\t", row.names = FALSE, col.names = FALSE)
if (max_number_function_calls < 0)
{ #indicator for "reset function counter" - ignore the number of function calls read from the project file

0 comments on commit 4f8821e

Please sign in to comment.