fedback from foreach

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

fedback from foreach

stephenb
Hi useRs,

I am running a foreach loop and hoped to get a small message when it hits a multiple of 1000, but it does not work.

        p <- foreach(i=1:10000, .combine='c') %dopar% {
            if(i%%1000==0) print(i)
            sqrt(i)
        }

What is the proper way to do it.
Thanks everybody.

Stephen B


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: fedback from foreach

Ismail SEZEN
>
> On 13 Jun 2017, at 23:05, Bond, Stephen <[hidden email]> wrote:
>
> Hi useRs,
>
> I am running a foreach loop and hoped to get a small message when it hits a multiple of 1000, but it does not work.
>
>        p <- foreach(i=1:10000, .combine='c') %dopar% {
>            if(i%%1000==0) print(i)
>            sqrt(i)
>        }
>
> What is the proper way to do it.
> Thanks everybody.
>
> Stephen B


https://stackoverflow.com/questions/10903787/how-can-i-print-when-using-dopar <https://stackoverflow.com/questions/10903787/how-can-i-print-when-using-dopar>

https://www.r-bloggers.com/monitoring-progress-inside-a-foreach-loop/ <https://www.r-bloggers.com/monitoring-progress-inside-a-foreach-loop/>

https://github.com/berkeley-scf/tutorial-parallel-basics/issues/2 <https://github.com/berkeley-scf/tutorial-parallel-basics/issues/2>

https://sumidiot.wordpress.com/2011/11/05/printing-in-foreachs-dopar/ <https://sumidiot.wordpress.com/2011/11/05/printing-in-foreachs-dopar/>


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.