PDA

View Full Version : g95 coarray test code


natski
May18-11, 02:14 PM
Hi all,

I am having difficulty compiling the following code in g95, which is supposed to handle coarrays... The code is:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!
PROGRAM test

implicit none

INTEGER :: a
INTEGER :: m, i

IF ( THIS_IMAGE() == 1 ) THEN
READ(*,*) m
DO i = 1,NUM_IMAGES()
a[i] = m
END DO
END IF

SYNC ALL

END PROGRAM

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!

I have been compiling with g95 -o test test.f90 and I get the following compile error:

/tmp/ccKqMbva.o: In function `MAIN_':
test.f90:(.text+0x20): undefined reference to `_g95_this_image'
test.f90:(.text+0x9b): undefined reference to `_g95_num_images'
test.f90:(.text+0xf4): undefined reference to `_g95_store_image'
test.f90:(.text+0x11c): undefined reference to `_g95_sync_all'

I don't understand what the problem is.... its almost as if g95 doesn't recognize these supposedly intrinsic functions. Any ideas?

Thanks!
natski

Hurkyl
May18-11, 02:28 PM
These are linker errors. Your program compiled fine, and the compiled code had pointers to functions like _g95_this_image. However, the linker was not told what library contains the object code for these functions, and so it complained.

Typically this would mean you forgot to specify some library in the command line when you ran your compiler/linker.


In this particular case, I speculate the problem is that when you set up g95, you either did not create the library it needs, or you did not put it someplace where g95 could find it.

Or, you have two different versions of g95 and you're running the compiler from one version, but picking up the library from a different version.