0

I have recieved some code from a colleague which is written in Fortan .f90 files, and was used before on Linux. I am trying to get the code to function on Windows 10 using Code::Blocks. The problem is there is an MPI module which is not being found and I can't work out how to add it to the project.

I am not a computer scientist so please bear with me. I have recieved some code from a colleague which is written in Fortan .f90 files, and was used before on Linux. I am trying to get this code to work on Windows as I have not used Linux.

I started by installing and configuring codeblocks using this guide (https://www.quora.com/How-can-I-run-a-Fortran-code-in-a-Windows-computer)

Which worked great for simple scripts.

Now, running the main code, I have a problem as there is a MPI module which cannot be found by the software: here is an example of some of the code.

module mpi_param
use mpi
implicit none
!
integer :: i_num,nb_proc
integer :: p1, p2,p3
integer :: i_proc, j_proc, k_proc,i_err
integer, dimension(mpi_status_size) :: i_etat
integer, dimension (1:6) :: i_send

!
end module mpi_param

Now, I have downloaded the microsoft MPI so I have the folder;

C:\Program Files (x86)\Microsoft SDKs\MPI

and I have also tried with cygwin downloading all the openmpi packages mentioned here;

https://sourceware.org/legacy-ml/cygwin/2014-06/msg00410.html

So I have an mpi.mod the file in this directory

C:\cygwin64

I have added those paths to the build options compiler search directories in codeblocks, but I continue to get the message, when I build;

||Fatal Error: Can't open module file 'mpi.mod' for reading at (1): No such file or directory|

I added the mpi.f90 file or mpi.mod file to the project but that didn't work either.

How can I get code:blocks to 'SEE' or 'FIND' or 'USE' the mpi module? (sorry I don't know the correct terminology)

Honestly, I don't really know/understand what I am doing, I am just trying to get the code running at least, but I am completely lost.

Should I give up on this path and try with Linux somehow? Shall I try something instead of Code::Blocks?

6
  • You need to compile the mpi.f90 file that comes with Microsoft MPI with the COMPILER THAT YOU INTEND TO USE (whichever one is being used by Code::Blocks). The resulting mpi.mod file then needs to be in a folder where you expect include files. Commented Jun 15, 2023 at 8:17
  • Thanks, I added the mpi.f90 file to my code::blocks project and did a clean then did a clean and then 'compile current file' - but I got the errors; C:\Program Files (x86)\Microsoft SDKs\MPI\Include\mpi.f90|544|Fatal Error: Can't open module file 'mpi_constants.mod' for reading at (1): No such file or directory| Commented Jun 16, 2023 at 9:03
  • have a look at what was done here: stackoverflow.com/questions/75725750/… and here: stackoverflow.com/questions/75444805/fortran-mpi-using-cygwin64/… (The use of VSCode or Code::blocks is irrelevant; it is your underlying compiler that matters. I personally would use the command line rather than an IDE anyway.) Commented Jun 16, 2023 at 9:20
  • I tried to use ifort but it wants me to install Microsoft Visual Studio. All this seems really complicated and involves lots of downloads and different programs. I think perhaps the easiest way is to just try and use a linux virtual machine as that was how the program was originally used. Commented Jun 16, 2023 at 12:27
  • please read all those posts CAREFULLY. You don't need need to use ifort: you could use any of several compilers. If you read the posts CAREFULLY you will find that I also gave instructions there for gfortran as well, which I suspect is the compiler that you have on your computer. Fundamentally, the problem is the same for any of the compilers: you have to compile mpi.f90 to create mpi.mod with the compiler that you are going to use. If you read the posts CAREFULLY you will see which files from MS-MPI are necessary for that. Commented Jun 16, 2023 at 13:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.