From simon.urbanek at r-project.org  Mon Mar  4 15:25:07 2013
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Mon, 4 Mar 2013 09:25:07 -0500
Subject: [Rd] multi threaded execution of package
In-Reply-To: <CAGHrqz_nZhgrzyH2YNX13Owyer=dyn41jzkdMKpqqeMZUbqWPQ@mail.gmail.com>
References: <CAGHrqz_nZhgrzyH2YNX13Owyer=dyn41jzkdMKpqqeMZUbqWPQ@mail.gmail.com>
Message-ID: <B69DB70C-1C7B-47EB-AC62-A79AA68BBF63@r-project.org>

On Mar 4, 2013, at 5:57 AM, Vitaliy FEOKTISTOV wrote:

> Hello,
> 
> I'm creating a package for R. This package containes a fortran (wrapped C)
> *.so .
> This dynamic library is compiled to be multi-threaded (-parallel -openmp
> -threads .. options).
> 

Just the fact that it's compiled with such options doesn't mean it will actually run threaded, they just turn on support in case the code wants to use it, they don't actually parallelize anything on their own.


> When I call this library from R : dyn.load("mylib.so")
> the execution is one threaded !
> 
> Where could be a problem and how to correct it ?
> 

Hard to say for sure, but possibly in your code. Would you care to provide the details, such as your platform, the exact code you're using etc?
Note that there are many packages that have no issue with using OpenMP, for example.

Cheers,
Simon



[Rd] multi threaded execution of package
Simon Urbanek