clement | 8 Sep 2010 09:11
Picon

Rmpi and ncdf4

Dear List Members,

I am using the ncdf4 package to work on General Circulation Model (GCM) 
data (NetCDF file format) and I would like to parallelize some 
calculations using Rmpi. Does anyone have an experience or advices in 
using Rmpi and ncdf4 packages?

--

-- 
Clement Tisseuil (Ph.D)
UMR BOREA 7208  « Biologie des Organismes et Ecosystèmes Aquatiques »
(CNRS-MNHN-UPMC-IRD), Equipe « Biodiversité et Macroécologie »,
43 rue Cuvier, 75005 Paris, France
Tel: 00 33 1 40 79 37 45
Fax: 00 33 1 40 79 37 71
webpage: http://www.clement-tisseuil.eu
clement | 10 Sep 2010 18:12
Picon

Re: Rmpi and ncdf4

Dear members,

I have started to adapt the "task pull" approach with Rmpi to 
parallelize my calculations on a NetCDF file of dimension lat[1:6], 
lon[1:6] and time[1:11323]. The basic idea is to parallelize the 
calculation by splitting the process according to each latitudinal 
coordinate i.e. for lat=1, lat=2, ..., lat=6. Please, see the code below 
and the link to the NetCDF file if you want to try : 
https://www.transferbigfiles.com/e4d7acd2-c186-4867-b4bf-82fe5aee4023?rid=jIcbZN%2blDcQz3kMeEHCQog%3d%3d

In the given example, the function works perfectly because the NetCDF 
file is quite small (~ 2 Mo). However, some difficulties occur when I 
try the function with larger NetCDF files (~ 8 Go), covering the entire 
globe, of dimensions lat[1:576], lon[1:1152] and time[1:11323]. The 
problem is that each processor (slave) needs to "connect" the NetCDF 
file before extracting the data required according to the latitudinal 
coordinate of interest. This connection takes more than 2 minutes.

I wondered if there was a possibility to avoid this problem of "time 
connection"  when a process is sent to a new slave. The best solution 
would be to open the connection to the NetCDF file in the master 
process, then to "send this connection" to the slaves. I do not know how 
it works exactly, but maybe there is something to check around the ncdf4 
package (which is based on the NetCDF4 library) to allow multiple 
connections to a single file... If you have ideas, I am opened !

Thanks in advance.

##path_job="/scratch/ctisseuil/job/Test_DWS_Rmpi"
path_job="/media/partage/Test_DWS_Rmpi"
(Continue reading)

Kasper Daniel Hansen | 10 Sep 2010 18:57
Picon

Re: Rmpi and ncdf4

I suggest you start by looking through the netcdf documentation and
ask about this on their mailing lists.  It seems to me that the
problem is one of multiple processes accessing the same file
simultaneously.  I would guess that the netcdf people know whether it
is possible or not, and also what the interface should be (my guess is
that there is an interface).  The next step is then to figure out
whether ncdf4 implements this interface.

Kasper

On Fri, Sep 10, 2010 at 12:12 PM, clement
<clement.tisseuil@...> wrote:
> Dear members,
>
> I have started to adapt the "task pull" approach with Rmpi to parallelize my
> calculations on a NetCDF file of dimension lat[1:6], lon[1:6] and
> time[1:11323]. The basic idea is to parallelize the calculation by splitting
> the process according to each latitudinal coordinate i.e. for lat=1, lat=2,
> ..., lat=6. Please, see the code below and the link to the NetCDF file if
> you want to try :
> https://www.transferbigfiles.com/e4d7acd2-c186-4867-b4bf-82fe5aee4023?rid=jIcbZN%2blDcQz3kMeEHCQog%3d%3d
>
> In the given example, the function works perfectly because the NetCDF file
> is quite small (~ 2 Mo). However, some difficulties occur when I try the
> function with larger NetCDF files (~ 8 Go), covering the entire globe, of
> dimensions lat[1:576], lon[1:1152] and time[1:11323]. The problem is that
> each processor (slave) needs to "connect" the NetCDF file before extracting
> the data required according to the latitudinal coordinate of interest. This
> connection takes more than 2 minutes.
>
(Continue reading)

Paul Johnson | 14 Sep 2010 20:30
Picon

Re: Rmpi and ncdf4

On Fri, Sep 10, 2010 at 11:12 AM, clement
<clement.tisseuil@...> wrote:
> Dear members,

>
>> I am using the ncdf4 package to work on General Circulation Model (GCM)
>> data (NetCDF file format) and I would like to parallelize some calculations
>> using Rmpi. Does anyone have an experience or advices in using Rmpi and
>> ncdf4 packages?
>>

Dear Clement:

Thanks for posting your code. It really helps me to learn when I can
read through what other people try.

I found myself wondering "how much" of the whole data set is used by
each slave.  Supposing the slave needs only a smaller piece,   I think
your problem would work more efficiently if you have the master load
the data one time and have it send the separate pieces to the slaves
for the work.  Well, that's what I would do because I've had very bad
experience when lots of nodes try to access the same file on NFS.  (It
causes something like a traffic jam as the processes fight over each
other).

Instead of doing system(rm ...), I'd suggest you clean files with the
file.remove function (see ?files) .  That will work across platforms,
so even people who use Windows might someday be able to run your code.

pj
(Continue reading)

clement | 15 Sep 2010 09:49
Picon

Re: Rmpi and ncdf4

Dear Paul,

I do agree with your suggestion that I have successfully experimented. 
Namely, the NetCDF file is opened one time in the Master process. The 
subset of data required for the calculation is also extracted from the 
Master process before being sent to the available slave. When the 
calculation is done, results are sent to the Master process that writes 
the results to the NetCDF file. The "task pull" method (described for 
the Rmpi package at http://math.acadiau.ca/ACMMaC/Rmpi/task_pull.R) is 
particularly well adapted for this problem.

Thanks for your assistance.

Cheers

Clement

On 9/14/2010 8:30 PM, Paul Johnson wrote:
> On Fri, Sep 10, 2010 at 11:12 AM,
clement<clement.tisseuil@...>  wrote:
>    
>> Dear members,
>>      
>    
>>      
>>> I am using the ncdf4 package to work on General Circulation Model (GCM)
>>> data (NetCDF file format) and I would like to parallelize some calculations
>>> using Rmpi. Does anyone have an experience or advices in using Rmpi and
>>> ncdf4 packages?
>>>
(Continue reading)


Gmane