Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

Slow behavior using mpicxx instead of icpc

$
0
0

Hello,

 

I am trying to make some benchmark on my server (Xeon Phi) using the last "Intel Parallel Studio XE Cluster edition 2017 u1" and I found some strange behavior with the natural command "mpicxx" to compile MPI program in C++.

I have made a simple code, not even parallel (MPI.cpp - see below) and I am compiling with:

mpicxx -O3 MPI.cpp

I have executed the compiled code on 1 processor just to test the 1 core version ("time ./a.out"). With this compilation, my program take forever to compute the program. 

But when I'm using this command (the same but through icpc):

icpc -I/opt/intel/impi/2017.1.132/include64/ -L/opt/intel/impi/2017.1.132/lib64/ -O3 MPI.cpp -lmpi -lmpicxx

The code is quicker than with mpicxx... Where is the issue?

I'm working on Red Hat with Intel PSXE CE 2017 u1. (2 Intel E5-2667 + 128GB + 8 Xeon Phi 31S1P).

Thank you.

 

MPI.cpp:

#include <iostream>
#include "mpi.h"
#include <cmath>

using namespace std;

int main()
{
  MPI::Init();

  int rank = MPI::COMM_WORLD.Get_rank();
  int size = MPI::COMM_WORLD.Get_size();

  if (rank == 0)
    cout << size << endl;

  long n = 100000000000/size;

  double sum = 1.0;
  for(long i = 1; i<n; ++i)
    sum *= pow(2.0*(double)(i+rank*n), 2) / (pow(2.0*(double)(i+rank*n), 2) - 1.0);

  double sumT = 1.0;
  MPI::COMM_WORLD.Allreduce(&sum, &sumT, 1, MPI::DOUBLE, MPI::PROD);

  if (rank == 0)
    cout << sumT << endl;

  MPI::Finalize();

}

 

Thread Topic: 

Question

Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>