From 6cf222adc82f908a8eed0fbc4bd24d11414914b6 Mon Sep 17 00:00:00 2001 From: Pierre Navaro Date: Thu, 26 Sep 2024 15:03:26 +0200 Subject: [PATCH] fix print in exemple --- corrections/rowsum.R | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/corrections/rowsum.R b/corrections/rowsum.R index 639cba2..3248ca3 100644 --- a/corrections/rowsum.R +++ b/corrections/rowsum.R @@ -17,12 +17,10 @@ hostname <- mpi.get.processor.name() msg <- sprintf("Hello world from task %03d of %03d, on host %s \n", my.rank , my.size , hostname) cat(msg) my.loop <- 20 -my.split <- data.frame(loop = 1 : my.loop, - rank = sort(c(rep(0 : (my.size-1), my.loop %/% my.size), - if(my.loop %% my.size > 0) - (my.size : 2)[1 : (my.loop %% my.size)]))) +my.split <- .splitIndices(my.loop, my.size) -my.loop <- my.split$loop[my.split$rank == my.rank] +my.loop <- unlist(my.split[my.rank+1]) +cat("\n", my.loop) ret <- 0 for(i in my.loop){