Firstly, your Cmake uses our NextGen Fortran compiler (ifx.exe) while mpiifort refers to Intel Fortran Compiler Classic (ifort.exe). Please, note that ifx.exe is still in Beta and we recommend using it for openMP offload ONLY. For any other cases, please, continue using ifort. Add -DCMAKE_Fortran_COMPILER="ifort" macro to your cmake command line.
Source files are not identical and this is the reason for different results:
test.f90:
---------------------------------------------------------------
integer i, size, rank, namelen, ierr, ISIZE
character (len=MPI_MAX_PROCESSOR_NAME) :: name
integer stat(MPI_STATUS_SIZE)
INTEGER :: sz
INTEGER :: ierrsiz
ISIZE = SIZEOF(rank)
print *, 'sizeof(INTEGER) = ', ISIZE
---------------------------------------------------------------
output:
---------------------------------------------------------------
sizeof(INTEGER) = 8
sizeof(MPI_INTEGER) 8
sizeof(MPI_INTEGER4) 4
sizeof(MPI_INTEGER8) 8
Hello world: rank 0 of
---------------------------------------------------------------
sizeof(integer) = 8 is expected for INTEGER :: rank
-i8 option changes sizeof(INTEGER) to 8 and I see 4 without this option. (mpiifort test.f90 VS mpiifort -i8 test.f90)
test_cmakelists_example.f90:
---------------------------------------------------------------
integer i, ISIZE
character (len=MPI_MAX_PROCESSOR_NAME) :: name
integer stat(MPI_STATUS_SIZE)
INTEGER(4) :: sz
INTEGER(4) :: ierr, size, rank, namelen
INTEGER(4) :: ierrsiz
ISIZE = SIZEOF(rank)
print *, 'sizeof(integer) = ', ISIZE
---------------------------------------------------------------
output for test_cmakelists_example.exe:
---------------------------------------------------------------
sizeof(integer) = 4
sizeof(MPI_INTEGER) 4
sizeof(MPI_INTEGER4) 4
sizeof(MPI_INTEGER8) 8
Hello world: rank 0 of 1 running on
---------------------------------------------------------------
What I see here when building without Cmake:
>mpiifort test_cmakelists_example.f90
mpifc.bat for the Intel(R) MPI Library 2021.4 for Windows*
Copyright Intel Corporation.
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.4.0 Build 20210910_000000
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 14.29.30040.0
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test_cmakelists_example.exe
-subsystem:console
"/LIBPATH:C:\Program Files (x86)\Intel\oneAPI\mpi\latest\env\..\lib\release"
"/LIBPATH:C:\Program Files (x86)\Intel\oneAPI\mpi\latest\env\..\lib"
impi.lib
test_cmakelists_example.obj
And what I see when adding -i8:
>mpiifort test_cmakelists_example.f90
mpifc.bat for the Intel(R) MPI Library 2021.4 for Windows*
Copyright Intel Corporation.
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.4.0 Build 20210910_000000
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 14.29.30040.0
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test_cmakelists_example.exe
-subsystem:console
"/LIBPATH:C:\Program Files (x86)\Intel\oneAPI\mpi\latest\env\..\lib\release"
"/LIBPATH:C:\Program Files (x86)\Intel\oneAPI\mpi\latest\env\..\lib"
impi.lib
test_cmakelists_example.obj
C:\Users\ashadrin\Downloads\OSC\c05255486_f>mpiifort test_cmakelists_example.f90 -i8
mpifc.bat for the Intel(R) MPI Library 2021.4 for Windows*
Copyright Intel Corporation.
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.4.0 Build 20210910_000000
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.
test_cmakelists_example.f90(24): warning #6075: The data type of the actual argument does not match the definition. [IERR]
call MPI_INIT (ierr)
-----------------------^
test_cmakelists_example.f90(26): warning #6075: The data type of the actual argument does not match the definition. [SIZE]
call MPI_COMM_SIZE (MPI_COMM_WORLD, size, ierr)
--------------------------------------------^
test_cmakelists_example.f90(26): warning #6075: The data type of the actual argument does not match the definition. [IERR]
call MPI_COMM_SIZE (MPI_COMM_WORLD, size, ierr)
--------------------------------------------------^
test_cmakelists_example.f90(27): warning #6075: The data type of the actual argument does not match the definition. [RANK]
call MPI_COMM_RANK (MPI_COMM_WORLD, rank, ierr)
--------------------------------------------^
test_cmakelists_example.f90(27): warning #6075: The data type of the actual argument does not match the definition. [IERR]
call MPI_COMM_RANK (MPI_COMM_WORLD, rank, ierr)
--------------------------------------------------^
test_cmakelists_example.f90(28): warning #6075: The data type of the actual argument does not match the definition. [NAMELEN]
call MPI_GET_PROCESSOR_NAME (name, namelen, ierr)
-------------------------------------------^
test_cmakelists_example.f90(28): warning #6075: The data type of the actual argument does not match the definition. [IERR]
call MPI_GET_PROCESSOR_NAME (name, namelen, ierr)
----------------------------------------------------^
test_cmakelists_example.f90(30): warning #6075: The data type of the actual argument does not match the definition. [SZ]
call MPI_Type_size(MPI_INTEGER, sz, ierrsiz)
------------------------------------------------^
test_cmakelists_example.f90(30): warning #6075: The data type of the actual argument does not match the definition. [IERRSIZ]
call MPI_Type_size(MPI_INTEGER, sz, ierrsiz)
----------------------------------------------------^
test_cmakelists_example.f90(32): warning #6075: The data type of the actual argument does not match the definition. [SZ]
call MPI_Type_size(MPI_INTEGER4, sz, ierrsiz)
-------------------------------------------------^
test_cmakelists_example.f90(32): warning #6075: The data type of the actual argument does not match the definition. [IERRSIZ]
call MPI_Type_size(MPI_INTEGER4, sz, ierrsiz)
-----------------------------------------------------^
test_cmakelists_example.f90(34): warning #6075: The data type of the actual argument does not match the definition. [SZ]
call MPI_Type_size(MPI_INTEGER8, sz, ierrsiz)
-------------------------------------------------^
test_cmakelists_example.f90(34): warning #6075: The data type of the actual argument does not match the definition. [IERRSIZ]
call MPI_Type_size(MPI_INTEGER8, sz, ierrsiz)
-----------------------------------------------------^
test_cmakelists_example.f90(59): warning #6075: The data type of the actual argument does not match the definition. [IERR]
call MPI_FINALIZE (ierr)
---------------------------^
Microsoft (R) Incremental Linker Version 14.29.30040.0
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test_cmakelists_example.exe
-subsystem:console
"/LIBPATH:C:\Program Files (x86)\Intel\oneAPI\mpi\latest\env\..\lib\release"
"/LIBPATH:C:\Program Files (x86)\Intel\oneAPI\mpi\latest\env\..\lib"
libmpi_ilp64.lib
impi.lib
test_cmakelists_example.obj