Intel® MPI Library
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.

mpiifort and preprocessing flags

Kevin_McGrattan
2,087 Views

I have a short Fortran/MPI test code on my Windows 10 computer that simply writes out a text string that includes a preprocessing variable string called GITHASH_PP:

 

program test_mpiifort
use mpi_f08
implicit none

integer size, rank, namelen, ierr
character (len=MPI_MAX_PROCESSOR_NAME) :: name
type(mpi_status) :: stat

call MPI_INIT (ierr)
call MPI_COMM_SIZE (MPI_COMM_WORLD, size, ierr)
call MPI_COMM_RANK (MPI_COMM_WORLD, rank, ierr)
call MPI_GET_PROCESSOR_NAME (name, namelen, ierr)

write(0,'(A,I0,A)') 'Rank ',rank,' writes the string:'//TRIM(GITHASH_PP)

call MPI_FINALIZE (ierr)

end

 

I compile at the Intel 64 command prompt


C:\Users\mcgratta\Documents\firemodels_forked\fds\Utilities\test_mpi>mpiifort -fc=ifx -o test_mpiifort -fpp -DGITHASH_PP="'Nov7'" test_mpiifort.f90
mpifc.bat for the Intel(R) MPI Library 2021.11 for Windows*
Copyright Intel Corporation.

Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.0 Build 20231017
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

Microsoft (R) Incremental Linker Version 14.22.27905.0
Copyright (C) Microsoft Corporation. All rights reserved.

-out:test_mpiifort.exe
-subsystem:console
"/LIBPATH:C:\Program Files (x86)\Intel\oneAPI\mpi\latest\env\\..\lib"
"/LIBPATH:C:\Program Files (x86)\Intel\oneAPI\mpi\latest\env\\..\lib"
impi.lib
test_mpiifort.obj

 

I then run the job:


C:\Users\mcgratta\Documents\firemodels_forked\fds\Utilities\test_mpi>mpiexec -n 4 test_mpiifort
Rank 0 writes the string: Nov7
Rank 3 writes the string: Nov7
Rank 2 writes the string: Nov7
Rank 1 writes the string: Nov7

 

Everything works. However, if I add a space to the text string 'Nov 7', the compilation fails:

 

C:\Users\mcgratta\Documents\firemodels_forked\fds\Utilities\test_mpi>mpiifort -fc=ifx -o test_mpiifort -fpp -DGITHASH_PP="'Nov 7'" test_mpiifort.f90
mpifc.bat for the Intel(R) MPI Library 2021.11 for Windows*
Copyright Intel Corporation.

Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.0 Build 20231017
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

C:\Users\mcgratta\AppData\Local\Temp\5\1132435.i90: catastrophic error: Internal Compiler Error: No filename given on the command-line
compilation aborted for test_mpiifort.f90 (code 1)
ERROR in the compiling/linking [1]

 

I have tried every possible combination of single quotes, double quotes, escape characters like backslashes, but nothing works. These do work with ifort, and I know that mpiifort is just a script. But how do we pass PP directives with mpiifort?

 

0 Kudos
3 Replies
Barbara_P_Intel
Employee
2,069 Views

Moving this over to the HPC Toolkit Forum. The folks there know about MPI.

 

0 Kudos
TobiasK
Moderator
1,805 Views

@Kevin_McGrattan

thanks for reporting this, it seems to be a shortcoming of the mpiifort script.


0 Kudos
TobiasK
Moderator
1,745 Views

@Kevin_McGrattan


please try to use this

mpiifort -fc=ifx -o test_mpiifort "-fpp -DGITHASH_PP='Nov 7'" test_mpiifort.f90


Best

Tobias


0 Kudos
Reply