<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic MKL Blacs_gridmap stuck when called within in a function with MPI. in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-Blacs-gridmap-stuck-when-called-within-in-a-function-with/m-p/1230787#M30387</link>
    <description>&lt;P&gt;Hi everyone,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I wrote the attached function that is called by some (not all) MPI processes grouped in different disjoint MPI communicators (COMM). The function simply multiplies input matrices A^t *B =C. The SubMatrix type is the following struct:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;struct SubMatrix
{
Matrix* M;
integer beg_row;
integer beg_col;
integer num_rows;
integer num_cols;
};
typedef struct SubMatrix SubMatrix;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;whereas a Matrix is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;struct Matrix
{
real *A;
integer num_rows;
integer num_cols;
};
typedef struct Matrix Matrix;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;real is either double or float (in this case it is double). integer is either unsigned int or unsigned long.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The main function correctly creates communicators COMM, int *IDs is an array containing the ids in MPI_COMM_WORLD of the processes that need to perform the matrix multiplication. They are required in order to initialize the imap array inside blacs_gridmap.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am running my code on a cluster and I compile as follows:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;mpiicc -std=c99 -O3 -qopenmp -DMKL_ILP64 -I${MKLROOT}/include main.c matrices.c -o mainDis -L${MKLROOT}/lib/intel64 -mkl -lmkl_scalapack_ilp64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_intelmpi_ilp64 -liomp5 -lpthread -lm -ldl &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The function that I am attaching is inside file matrices.c. I am trying to run main.c with 8 processes and by doing so I expect processes 0 and 1 to create one communicator and to call the attached function, and similarly for processes 2 and 3. They correctly create communicators and assign values to nprow and npcol by calling MPI_Dims_create.&amp;nbsp; imap has the values that I expect (0 and 1 in one case, 2 and 3 in the other one). The program gets stuck after printing "before gridmap", when it should be executing blacs_gridmap().&amp;nbsp;&lt;BR /&gt;Can you please help me see what am I doing wrong?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Nov 2020 11:51:01 GMT</pubDate>
    <dc:creator>Viv</dc:creator>
    <dc:date>2020-11-23T11:51:01Z</dc:date>
    <item>
      <title>MKL Blacs_gridmap stuck when called within in a function with MPI.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-Blacs-gridmap-stuck-when-called-within-in-a-function-with/m-p/1230787#M30387</link>
      <description>&lt;P&gt;Hi everyone,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I wrote the attached function that is called by some (not all) MPI processes grouped in different disjoint MPI communicators (COMM). The function simply multiplies input matrices A^t *B =C. The SubMatrix type is the following struct:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;struct SubMatrix
{
Matrix* M;
integer beg_row;
integer beg_col;
integer num_rows;
integer num_cols;
};
typedef struct SubMatrix SubMatrix;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;whereas a Matrix is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;struct Matrix
{
real *A;
integer num_rows;
integer num_cols;
};
typedef struct Matrix Matrix;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;real is either double or float (in this case it is double). integer is either unsigned int or unsigned long.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The main function correctly creates communicators COMM, int *IDs is an array containing the ids in MPI_COMM_WORLD of the processes that need to perform the matrix multiplication. They are required in order to initialize the imap array inside blacs_gridmap.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am running my code on a cluster and I compile as follows:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;mpiicc -std=c99 -O3 -qopenmp -DMKL_ILP64 -I${MKLROOT}/include main.c matrices.c -o mainDis -L${MKLROOT}/lib/intel64 -mkl -lmkl_scalapack_ilp64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_intelmpi_ilp64 -liomp5 -lpthread -lm -ldl &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The function that I am attaching is inside file matrices.c. I am trying to run main.c with 8 processes and by doing so I expect processes 0 and 1 to create one communicator and to call the attached function, and similarly for processes 2 and 3. They correctly create communicators and assign values to nprow and npcol by calling MPI_Dims_create.&amp;nbsp; imap has the values that I expect (0 and 1 in one case, 2 and 3 in the other one). The program gets stuck after printing "before gridmap", when it should be executing blacs_gridmap().&amp;nbsp;&lt;BR /&gt;Can you please help me see what am I doing wrong?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2020 11:51:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-Blacs-gridmap-stuck-when-called-within-in-a-function-with/m-p/1230787#M30387</guid>
      <dc:creator>Viv</dc:creator>
      <dc:date>2020-11-23T11:51:01Z</dc:date>
    </item>
  </channel>
</rss>

