[R-sig-Debian] demonstrate multiple core use

Dirk Eddelbuettel edd at debian.org
Thu Apr 9 00:17:54 CEST 2009


On 8 April 2009 at 17:00, Dirk Eddelbuettel wrote:
| Erin,
| 
| This is more of a r-sig-hpc question than an r-sig-debian question ...
| 
| On 8 April 2009 at 15:59, Erin Hodgess wrote:
| | I have a quad core computer and I'd like to run some Rmpi code.
| | 
| | However, I would like to be able to demonstrate that all 4 cores are running.

PS If you replace the simple 'hello world' in each of these scripts with a
something more expensive ( as e.g.  replicate(1e4, median(rnorm(1e4))) ) then
you can fire up a tool like htop and see all your cores being busy.  That may
be 'proof' enough.  If not, Linux and Open MPI both allow you to set
processor affinity to bind actual processes to cores and all thatt

Dirk

| | 
| | Is there a way to do that, please?
| 
| Sure. The examples in my two HPC tutorials should serve as a starting point:
| 
| edd at ron:~/src/latex/conferences/bocDec2008/scripts/parallel$ orterun -n 4 ./helloMPIworld.r
| Hello, rank 2 size 4 on ron 
| Hello, rank 1 size 4 on ron 
| Hello, rank 3 size 4 on ron 
| Hello, rank 0 size 4 on ron 
| edd at ron:~/src/latex/conferences/bocDec2008/scripts/parallel$ cat helloMPIworld.r
| #!/usr/bin/env r
| 
| library(Rmpi)	# calls MPI_Init
| 
| rk <- mpi.comm.rank(0)
| sz <- mpi.comm.size(0)
| name <- mpi.get.processor.name()
| cat("Hello, rank", rk, "size", sz, "on", name, "\n")
| 
| mpi.quit()
| edd at ron:~/src/latex/conferences/bocDec2008/scripts/parallel$ 
| 
| That was all on one box. Whether or not you have 1, 2, 4, 8, ... cores does
| not matter, the OS will just shuffle the tasks around. Of course, this goes
| faster if you do have more cores...
|  
| | Also, would it be better to run snow for such a demo, please?
| 
| Yes, as that would give you an opportunity to just use sockets instead of
| MPI. Again, examples are in the slides of my HPC tutorials.
| 
| If you have more questions, feel free to post on the r-sig-hpc list.
| 
| Thanks, Dirk
| 
| 
| -- 
| Three out of two people have difficulties with fractions.
| 
| _______________________________________________
| R-SIG-Debian mailing list
| R-SIG-Debian at r-project.org
| https://stat.ethz.ch/mailman/listinfo/r-sig-debian

-- 
Three out of two people have difficulties with fractions.



More information about the R-SIG-Debian mailing list