parallelizing in g95 (gfortran) windows versions


Marc
03-02-2010, 09:24 AM
Hello,
I hope someone can help me with the following problem. I want to parallelize a fortran program but I am bound to a windows machine (which ist he major problem but not the one I am concerned here). I am using either g95 or gfortran as compiler but both produce separate problems. Within gfortran I cannot read files bigger than 2 GB as stream due to a bug that is not solved for the windows version (but for all other versions). Otherwise parallelizing would easy be possible by omp (e.g. omp_set_num_threads() and so on). Due to the bug I changed to g95 compiler where parallelizing should be possible by coarrays.
The suggested test program:

integer :: m

m = THIS_IMAGE()
SYNC ALL

if (THIS_IMAGE() == 1) then
do i=1, NUM_IMAGES()
print *, i, m[i]
enddo
endif
end

produces the error
undefined reference to '__g95_this_image'
undefined reference to '__g95_sync_all'
and so on…..

I therefore have several questions and each answer might help me getting further.

- Has someone parallelized his or her program in fortran on a windows machine and how was that possible?
- Is there a bug free windows gfortran version that is easy to install (I used http://quatramaran.ens.fr/~coudert/gfortran/) which makes it possible to read files larger than 2GB without direct access
- How may I get rid of the “undefined reference” errors, s this due to a not up to date version of g95 or did I not include needed libs?

Thank you very much and kindest regards,
Marc

top
04-09-2010, 10:24 AM
Hello,


I want to parallelize a fortran program but I am bound to a windows machine [...]. I am using either g95 or gfortran [...]
Within gfortran I cannot read files bigger than 2 GB as stream due to a bug
[...]
I used http://quatramaran.ens.fr/~coudert/gfortran/


Unfortunately, you do not tell us whether you use MinGW or Cygwin; both is for Windows and both are available on that page. If you are using Cygwin: There is a newer build from March 2010 available. If you are using MinGW, I would suggest to use the official MinGW version, which has also a 4.5 build from March 2010 (http://sourceforge.net/projects/mingw/files/)

Assuming that you are using MinGW: On 4 January the second large-file bug was fixed for MinGW and MinGW64, cf. GCC's PR 42420 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42420) and PR 40812 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42420)


I changed to g95 compiler where parallelizing should be possible by coarrays. [...]
produces the error
undefined reference to '__g95_this_image'


There exist (now) two versions coarray support in g95 (http://g95.org/), depending which binary one downloads. One is for threads (normal download) and one requires the coarray console. To my knowledge both kinds of parallelizations currently only work under Linux. Thus, currently you cannot use coarrays with g95 on Windows.

(Side remark: Now, that Fortran 2008 (http://www.nag.co.uk/SC22WG5/) has been essentially been standardized, more compilers will support coarrays; for instance gfortran 4.6 now supports coarrays - but currently only for a single image (i.e. not parallel).)

And I want to mention yet another possibility to parallelize the program: MPI (http://en.wikipedia.org/wiki/Message_Passing_Interface), which works with any compiler but requires an MPI library/implementation such as Open MPI (http://open-mpi.org/). MPI is currently the solution if you want to use distributed memory parallelization. For a few threads on a shared memory machine, using OpenMP is probably better as implementing OpenMP parallelization is quicker and one does not need another library. (If one wants to support a large number of threads, the implementation effort with OpenMP also grows.) In how far coarrays will change the picture remains to be seen.