wavebitscientific / wavy

A spectral ocean wave modeling framework
https://wavebitscientific.github.io/wavy/
BSD 3-Clause "New" or "Revised" License
17 stars 6 forks source link

Introduce basic parallelism with Coarrays #4

Open milancurcic opened 7 years ago

dksasaki commented 4 years ago

Hello Milan, did you finish implementing the basic parallelism in wavy?

milancurcic commented 4 years ago

Hi Dalton, thanks for checking in! I haven't touched this repo in few years. It started off as a business project that didn't come through in the end, so I open sourced it. If you think there are ways you could improve or develop it further, I'd be happy to help.

dksasaki commented 4 years ago

I'm glad you open-sourced it - I wouldn't learn as much Fortran as I did if you hadn't opened it! For now, I'm doing this as a personal interest and last month I was reading your Fortran book and I realized it would be interesting to implement the parallelism with coarrays. I bumped into a few annoying problems, like the fact you can't use coarrays with derived types, but in the end, I managed to adapt some methods of your domain module and the parallel module (from the book) to work with a simple 2D case. I haven't generalized the methods and still need to gather the spectrum information into a single domain but before finishing it, I believe would be interesting to get in touch to check whether everything looks okay.

dksasaki commented 4 years ago

Hey Milan, I am preparing an example of umwm2d with coarrays. In order to test it in the simplest way, I took the source functions out of wavy code and compiled them independently. Now I am trying to implement these changes back to the code, but there is an issue with the compilation.

I am using gfortran with the opencoarrays package and I need to pass a flag to the compiler (-fcoarray=lib). I added this flag to the CMakeLists.txt in the root directory of wavy in (notice that I am not familiar yet in working with cmake configuration files):

original:

# compiler flags for gfortran
if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
  set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp")
  set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -C -fbacktrace")
  set(CMAKE_Fortran_FLAGS_RELEASE "-O3")
endif()

modified:

# compiler flags for gfortran
if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
  set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp -fcoarray=lib")
  set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -C -fbacktrace")
  set(CMAKE_Fortran_FLAGS_RELEASE "-O3")
endif()

When I try to compile the code, the following error appears:

f951: Fatal Error: Reading module ‘json_module’ at line 372 column 12: Expected left parenthesis Notice this was done with the original src files. Would you have any idea of what is going on? I could disable json, but then we would miss some test cases.