Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Fortran > Using external ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 23 Topic 8180 of 8551
Post > Topic >>

Using external subroutines in OpenMP?

by jomarbueyes@[EMAIL PROTECTED] Apr 25, 2008 at 06:36 PM

Dear all,

I'm not sure this is the right forum to post this question since the
question deals more with OpenMP than with Fortran itself.
I am trying to ****t a program to OpenMP. The program uses some
subroutines that I wrote and some from Netlib.  All programs and
subroutines are in Fortran 90 or later. The OS is Mac OS 10.5.2 and I
am using the Intel ifort compiler to with "-openmp. -reentrancy
threaded" for all programs and subroutines.
The way I was trying to parallelize the use of Netlib subroutines is
something like

  do i2  = 1, N2
    do i1 = 1, N1
       wk(i1) = x(i1, i2)
    end do
    call <NetLibSubroutine>(wk, z, <other stuff>)
    do i1 = 1, N1
       x(i1, i2) = wk(i1)
  end do

where z is an array that the subroutine uses (reads from memory) but
does not modify.
I tried placing the above snippet between OpenMP directives:

!$omp parallel do private(wk, i2, i1) shared(x, z)
   <snippet>
!$omp end parallel do

At best I get NaNs at random.

I then tried making wk and z 2D arrays and changed the subroutine call
above to
    call <NetLibSubroutine>(wk(1,tr), z(1,tr), <other stuff>)
where tr is the thread number. I made similar changes to the copy-in,
copy-out loops and I replicated the original array z into several
copies of wk(:,0) -one copy for each thread.

I then tried
!$omp parallel private(i1, i2, tr, istart, iend) shared(x, z, wk)
  <find tr and callculate istart, iend>
  do i2 = istart, iend
     <snippet w/modified call>
   end do
!$omp end parallel

The result is that sometimes I get an access violation, other times I
get NaNs or Infs, but most often the program hangs.

Can someone clue me on how to call external subroutines from within a
parallel construct? As I understand, the OpenMP standard states that
all variables local to subroutines and functions within a parallel
construct are private.

Thanks

Jomar
 




 23 Posts in Topic:
Using external subroutines in OpenMP?
jomarbueyes@[EMAIL PROTEC  2008-04-25 18:36:24 
Re: Using external subroutines in OpenMP?
Reinhold Bader <Bader@  2008-04-26 11:26:33 
Re: Using external subroutines in OpenMP?
Sebastian Hanigk <hani  2008-04-26 13:12:32 
Re: Using external subroutines in OpenMP?
glen herrmannsfeldt <g  2008-04-26 09:01:53 
Re: Using external subroutines in OpenMP?
Sebastian Hanigk <hani  2008-04-26 19:29:05 
Re: Using external subroutines in OpenMP?
Charles Coldwell <cold  2008-04-27 11:27:29 
Re: Using external subroutines in OpenMP?
Sebastian Hanigk <hani  2008-04-27 17:45:31 
Re: Using external subroutines in OpenMP?
Charles Coldwell <cold  2008-04-27 22:26:50 
Re: Using external subroutines in OpenMP?
jomarbueyes@[EMAIL PROTEC  2008-04-26 22:25:35 
Re: Using external subroutines in OpenMP?
jomarbueyes@[EMAIL PROTEC  2008-04-26 22:36:54 
Re: Using external subroutines in OpenMP?
jomarbueyes@[EMAIL PROTEC  2008-04-26 22:44:18 
Re: Using external subroutines in OpenMP?
jomarbueyes@[EMAIL PROTEC  2008-04-27 07:53:59 
Re: Using external subroutines in OpenMP?
Sebastian Hanigk <hani  2008-04-27 17:38:32 
Re: Using external subroutines in OpenMP?
Charles Coldwell <cold  2008-04-27 22:14:11 
Re: Using external subroutines in OpenMP?
"James Van Buskirk&q  2008-04-27 17:04:45 
Re: Using external subroutines in OpenMP?
Charles Coldwell <cold  2008-04-28 11:19:45 
Re: Using external subroutines in OpenMP?
jomarbueyes@[EMAIL PROTEC  2008-04-28 08:47:32 
Re: Using external subroutines in OpenMP?
Charles Coldwell <cold  2008-04-29 12:08:17 
Re: Using external subroutines in OpenMP?
jomarbueyes@[EMAIL PROTEC  2008-04-28 09:26:26 
Re: Using external subroutines in OpenMP?
Tobias Burnus <burnus@  2008-04-28 09:57:56 
Re: Using external subroutines in OpenMP?
jomarbueyes@[EMAIL PROTEC  2008-04-28 15:21:19 
Re: Using external subroutines in OpenMP?
jomarbueyes@[EMAIL PROTEC  2008-04-28 19:34:56 
Re: Using external subroutines in OpenMP?
jomarbueyes@[EMAIL PROTEC  2008-04-29 07:46:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 4:19:08 CDT 2008.