Skip to content

Don't error with zero length elem in add_to_last#19

Closed
gaborcsardi wants to merge 1 commit intomainfrom
CSJCampbell-add_to_last-patch-1
Closed

Don't error with zero length elem in add_to_last#19
gaborcsardi wants to merge 1 commit intomainfrom
CSJCampbell-add_to_last-patch-1

Conversation

@gaborcsardi
Copy link
Copy Markdown
Owner

@gaborcsardi gaborcsardi commented Aug 30, 2023

Cf. MangoTheCat/cyclocomp#17

The following expression from Rmpi raises an error due to breaks_tail seeing a zero length breaks.

 function (dellog = TRUE, comm = 1) {
  if (mpi.comm.size(comm) < 2) {
    err <- paste("It seems no slaves running on comm", comm)
    stop(err)
  }
  mpi.bcast.cmd(cmd = break, rank = 0, comm = comm)
  if (.Platform$OS != "windows") {
    if (dellog && mpi.comm.size(0) < mpi.comm.size(comm)) {
      tmp <- paste(Sys.getpid(), "+", comm, sep = "")
      logfile <- paste("*.", tmp, ".*.log", sep = "")
      if (length(system(paste("ls", logfile), TRUE, ignore.stderr = TRUE)) >= 
          1)
        system(paste("rm", logfile))
    }
  }
  if (comm > 0) {
    if (is.loaded("mpi_comm_disconnect")) 
      mpi.comm.disconnect(comm)
    else mpi.comm.free(comm)
  }
}

The following expression from **Rmpi** raises an error due to `breaks_tail` seeing a zero length breaks.
```{r}
 function (dellog = TRUE, comm = 1) {
  if (mpi.comm.size(comm) < 2) {
    err <- paste("It seems no slaves running on comm", comm)
    stop(err)
  }
  mpi.bcast.cmd(cmd = break, rank = 0, comm = comm)
  if (.Platform$OS != "windows") {
    if (dellog && mpi.comm.size(0) < mpi.comm.size(comm)) {
      tmp <- paste(Sys.getpid(), "+", comm, sep = "")
      logfile <- paste("*.", tmp, ".*.log", sep = "")
      if (length(system(paste("ls", logfile), TRUE, ignore.stderr = TRUE)) >= 
          1)
        system(paste("rm", logfile))
    }
  }
  if (comm > 0) {
    if (is.loaded("mpi_comm_disconnect")) 
      mpi.comm.disconnect(comm)
    else mpi.comm.free(comm)
  }
}
```
@gaborcsardi gaborcsardi changed the title mangothecat -> gaborcsardi Don't error with zero length elem in add_to_last Aug 30, 2023
@gaborcsardi
Copy link
Copy Markdown
Owner Author

Hmmm, if this happens because of a bug in cyclocomp, then we could fix the bug, I guess. FWIW there is no error on Rmpi currently, so I am going to close this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant