Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

MPI compilation problems with mpicc.bat and mpifc.bat

Ian_Chivers
New Contributor I
1,180 Views

I've found some issues with the batch files

 

mpicc.bat

 

and

 

mpifc.bat

 

when trying to compile a C++ mpi program.

 

the batch files contain

 

echo.

 

statements which are illegal on windows.

 

I've had this issue in the past with mpi Fortran code, but not C++ code.

 

Ian

0 Kudos
1 Solution
Ian_Chivers
New Contributor I
914 Views

I've installed the latest release and the problem no longer happens. 

 

 

View solution in original post

0 Kudos
6 Replies
ShivaniK_Intel
Moderator
1,153 Views

Hi,


Thanks for posting in the Intel forums.


>>> "I've found some issues with the batch files"


Could you please elaborate more on this issue?


Could you please let us know the version of Intel MPI you have been using?


>>>" when trying to compile a C++ mpi program"


Could you please provide us with the sample reproducer and steps to reproduce the issue at our end?


Thanks & Regards

Shivani


0 Kudos
Ian_Chivers
New Contributor I
1,146 Views

Here are the outputs from the various

batch files that Intel provide.

 

C:\document\cpp\examples>mpicc ch3705.cxx

mpicc.bat for the Intel(R) MPI Library 2021.7 for Windows*
Copyright Intel Corporation.
'echo.' is not recognized as an internal or external command,
operable program or batch file.

C:\document\cpp\examples>mpicl ch3705.cxx

mpicc.bat for the Intel(R) MPI Library 2021.7 for Windows*
Copyright Intel Corporation.
'echo.' is not recognized as an internal or external command,
operable program or batch file.

C:\document\cpp\examples>mpicxx ch3705.cxx

mpicc.bat for the Intel(R) MPI Library 2021.7 for Windows*
Copyright Intel Corporation.
'echo.' is not recognized as an internal or external command,
operable program or batch file.

C:\document\cpp\examples>mpifc ch3705.cxx

mpifc.bat for the Intel(R) MPI Library 2021.7 for Windows*
Copyright Intel Corporation.
'echo.' is not recognized as an internal or external command,
operable program or batch file.

C:\document\cpp\examples>mpiicc ch3705.cxx

mpicc.bat for the Intel(R) MPI Library 2021.7 for Windows*
Copyright Intel Corporation.
'echo.' is not recognized as an internal or external command,
operable program or batch file.

C:\document\cpp\examples>mpiicpc ch3705.cxx

mpicc.bat for the Intel(R) MPI Library 2021.7 for Windows*
Copyright Intel Corporation.
'echo.' is not recognized as an internal or external command,
operable program or batch file.

C:\document\cpp\examples>

 

Here is the source code

 

#include <chrono>
#include <cmath>

using namespace std;

class timer
{
public:
timer() : start_timing(hi_res_clock::now()) {}
void reset()
{
start_timing = hi_res_clock::now();
}
double elapsed() const
{
return(std::chrono::duration_cast<second_>
(hi_res_clock::now() - start_timing).count());
}
private:
typedef std::chrono::high_resolution_clock hi_res_clock;
typedef std::chrono::duration<double, std::ratio<1> > second_;
std::chrono::time_point<hi_res_clock> start_timing;

};

#include <iostream>
#include <cassert>
#include <chrono>
#include <string>
#include <cstdlib>
#include <mpi.h>

using namespace std;

void print_time(const string& heading, const double& t)
{
cout << heading << " : ";
cout.width(10);cout.precision(6);
cout.setf(ios::right);
cout.setf(ios::showpoint);
cout.setf(ios::fixed);
cout << t << endl;
}

void format_20_16()
{
cout.width(20);cout.precision(16);
cout.setf(ios::right);
cout.setf(ios::showpoint);
cout.setf(ios::fixed);
}

void format_08_06()
{
cout.width(8);cout.precision(6);
cout.setf(ios::right);
cout.setf(ios::showpoint);
cout.setf(ios::fixed);
}

double f(double x)
{
double f;
f = 4.0 / (1.0 + x * x);
return(f);
}

int main()
{

timer timer_01;
timer timer_02;

double t;

string heading;

double cplusplus_internal_pi;

double interval_width;

double partial_pi;
double partial_sum;

double total_pi;

double x;

double time_difference;

double* sendbuf;
double* recbuf;

int i;
int j;
int n_intervals;
int error_number;
int this_process;
int n_processes;

MPI_Init(NULL, NULL);
MPI_Comm_size(MPI_COMM_WORLD, &n_processes);
MPI_Comm_rank(MPI_COMM_WORLD, &this_process);

heading = "\n Program starts ";

if (this_process == 0)
{
t = timer_01.elapsed();
print_time(heading, t);
}

n_intervals = 1000000;

cplusplus_internal_pi = 4.0 * atan(1.0);

if (this_process == 0)
{

cout << "\n C++ internal pi 4.0*atan(1.0) \n" << endl;
cout << " ";
format_20_16();
cout << cplusplus_internal_pi << endl;

}

heading = " Loop time ";

for (j = 1; j < 5; j++)
{

interval_width = 1.0 / n_intervals;
partial_sum = 0.0;

for (i = this_process +1 ; i <= n_intervals; i = i + n_processes)
{
x = interval_width * (double(i) - 0.5);
partial_sum = partial_sum + f(x);
}

partial_pi = interval_width * partial_sum;

sendbuf = &partial_pi;
recbuf = &total_pi;

MPI_Reduce(sendbuf,
recbuf,
1,
MPI_DOUBLE,
MPI_SUM,
0,
MPI_COMM_WORLD);

if (this_process == 0)
{

t = timer_01.elapsed();
time_difference = t;
timer_01.reset();

cout << " ";
cout << " N intervals ";
cout.width(12);
cout << n_intervals;
cout << " time = ";
format_08_06();
cout << time_difference << endl;

cout << " Calculated ";
format_20_16();
cout << total_pi << endl;

cout << " Difference ";
format_20_16();
cout << abs(total_pi - cplusplus_internal_pi) << endl;

}

n_intervals = n_intervals * 10;

}

if (this_process == 0)
{
t = timer_02.elapsed();
heading = " \n Total time ";
print_time(heading, t);
}

MPI_Finalize();

return(0);

}

 

I did a dir/s mpi*.bat and this is the output

 

Volume in drive C is OS
Volume Serial Number is 50BD-6CC8

Directory of C:\Program Files (x86)\Intel\oneAPI\mpi\2021.7.1\bin

21/10/2022 17:40 21,398 mpicc.bat
21/10/2022 17:40 1,036 mpicl.bat
21/10/2022 17:40 1,078 mpicxx.bat
21/10/2022 17:40 979 mpif77.bat
21/10/2022 17:40 979 mpif90.bat
21/10/2022 17:40 25,765 mpifc.bat
21/10/2022 17:40 1,033 mpiicc.bat
21/10/2022 17:40 1,037 mpiicpc.bat
21/10/2022 17:40 981 mpiifort.bat
21/10/2022 17:40 673 mpitune.bat
10 File(s) 54,959 bytes

Directory of C:\Program Files (x86)\Intel\oneAPI\mpi\2021.7.1\etc\conda\activate.d

21/10/2022 16:35 1,396 mpivars.activate.bat
1 File(s) 1,396 bytes

Directory of C:\Program Files (x86)\Intel\oneAPI\mpi\2021.7.1\etc\conda\deactivate.d

21/10/2022 16:35 1,990 mpivars.deactivate.bat
1 File(s) 1,990 bytes

Directory of C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin

21/10/2022 17:40 21,398 mpicc.bat
21/10/2022 17:40 1,036 mpicl.bat
21/10/2022 17:40 1,078 mpicxx.bat
21/10/2022 17:40 979 mpif77.bat
21/10/2022 17:40 979 mpif90.bat
21/10/2022 17:40 25,765 mpifc.bat
21/10/2022 17:40 1,033 mpiicc.bat
21/10/2022 17:40 1,037 mpiicpc.bat
21/10/2022 17:40 981 mpiifort.bat
21/10/2022 17:40 673 mpitune.bat
10 File(s) 54,959 bytes

Directory of C:\Program Files (x86)\Intel\oneAPI\mpi\latest\etc\conda\activate.d

21/10/2022 16:35 1,396 mpivars.activate.bat
1 File(s) 1,396 bytes

Directory of C:\Program Files (x86)\Intel\oneAPI\mpi\latest\etc\conda\deactivate.d

21/10/2022 16:35 1,990 mpivars.deactivate.bat
1 File(s) 1,990 bytes

Total Files Listed:
24 File(s) 116,690 bytes
0 Dir(s) 458,762,018,816 bytes free

 

I did a grep on the above batch files looking for "^echo"

and found that mpicc.bat and mpifc.bat both contains 

 

echo.

 

statements.

 

Hope this helps

 

Ian

 

 

 

 

0 Kudos
ShivaniK_Intel
Moderator
1,114 Views


Hi,


We are unable to reproduce the error at our end with Intel MPI 2021.7 version.


Please refer to the below for the output details.


C:\Users\karangux\Desktop>mpicc shivani.cpp

mpicc.bat for the Intel(R) MPI Library 2021.7 for Windows*

Copyright Intel Corporation.

Microsoft (R) C/C++ Optimizing Compiler Version 19.30.30705 for x64

Copyright (C) Microsoft Corporation. All rights reserved.

shivani.cpp

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.30.30705\include\ostream(410): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.30.30705\include\ostream(403): note: while compiling class template member function 'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(double)'

shivani.cpp(42): note: see reference to function template instantiation 'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(double)' being compiled

shivani.cpp(37): note: see reference to class template instantiation 'std::basic_ostream<char,std::char_traits<char>>' being compiled

Microsoft (R) Incremental Linker Version 14.30.30705.0

Copyright (C) Microsoft Corporation. All rights reserved.

/out:shivani.exe

"/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

shivani.obj

C:\Users\karangux\Desktop>shivani.exe

 Program starts :  0.229034

 C++ internal pi 4.0*atan(1.0)

  3.1415926535897931

 N intervals   1000000 time = 0.261210

 Calculated  3.1415926535897643

 Difference  0.0000000000000289

 N intervals   10000000 time = 0.167000

 Calculated  3.1415926535897309

 Difference  0.0000000000000622

 N intervals  100000000 time = 1.671505

 Calculated  3.1415926535904264

 Difference  0.0000000000006333

 N intervals  1000000000 time = 16.126087

 Calculated  3.1415926535899708

 Difference  0.0000000000001776

 Total time : 18.236686


Could you please let us know if you further have any issues?


Thanks & Regards

Shivani


0 Kudos
ShivaniK_Intel
Moderator
925 Views

Hi,


As we didn't hear back from you, could you please let us know if you further have any issues?


Thanks & Regards

Shivani


0 Kudos
Ian_Chivers
New Contributor I
915 Views

I've installed the latest release and the problem no longer happens. 

 

 

0 Kudos
ShivaniK_Intel
Moderator
902 Views

Hi,


Glad to know that your issue is resolved. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Thanks & Regards

Shivani



0 Kudos
Reply