Installation : MPI + Windows10 + MSVC 2019 building error

81 views
Skip to first unread message

Daniel Sun

unread,
Mar 2, 2022, 12:15:06 AM3/2/22
to deal.II User Group
Hi there,
              Recently, I'm trying to build deal.ii-9.3.3 with the option DEAL_II_WITH_MPI=ON on Windows 10 system using MSVC 2019. I used CMake to generate deal.ii.sln and it worked fine (see attached detailed.log). However, when i built the deal.ii.sln, errors occurred in the grid_tools.h file. It pointed to these codes below:
  
      process_cells([&](const auto &cell, const auto key) {
        if (cell_filter(cell))
          neighbor_cell_list[key].emplace_back(
            cell->id().template to_binary<spacedim>());
      });

      To sum up, the error list showed four main items in the following (also in the attached error_message.jpg file):
    (1). error C2672: 'dealii::CellId::to_binary': no matching overloaded function found
    (2). error C2975: 'dim': invalid template argument for 'dealii::CellId::to_binary', expected compile-time constant expression
    (3). error C2672: 'std::vector<dealii::CellId::binary_type,std::allocator<dealii::CellId::binary_type>>::emplace_back': no matching overloaded function found
   (4).  error C2664: '_Ret std::_Func_class<_Ret,const std::function<void (const dealii::TriaActiveIterator<dealii::DoFCellAccessor<1,1,false>> &,dealii::types::subdomain_id)> &>::operator ()(const std::function<void (const dealii::TriaActiveIterator<dealii::DoFCellAccessor<1,1,false>> &,dealii::types::subdomain_id)> &) const': cannot convert argument 1 from 'dealii::GridTools::internal::exchange_cell_data::<lambda_bb98f0c896b01fed9263cc1b81316be5>' to 'const std::function<void (const dealii::TriaActiveIterator<dealii::DoFCellAccessor<1,1,false>> &,dealii::types::subdomain_id)> &'

    It seemed that it cannot convert the lambda function to the std::function. I cannot figure out why this happened. The building process was successful without the MPI option. BTW, i used the Microsoft MPI and the version is 2.0. Could someone help me figure this out and fix this problem? Any help is much appreciated!
error_message.jpg
detailed.log

Wolfgang Bangerth

unread,
Mar 2, 2022, 3:52:35 PM3/2/22
to dea...@googlegroups.com

Hi Daniel,

>               Recently, I'm trying to build deal.ii-9.3.3 with the
> option DEAL_II_WITH_MPI=ON on Windows 10 system using MSVC 2019.

Interesting experiment -- we automatically build every change with MSVC,
but not with MPI. I didn't even know that there is an MPI implementation
for Windows.

Before coming to the question at hand, let me also point out that the
version of MPI you have is 2.0. We merged a patch today that will
require MPI 3.0 for the next release, coming out this summer. Do you
happen to know whether there is an MPI 3-compatible implementation on
Windows?


> I used
> CMake to generate deal.ii.sln and it worked fine (see attached
> detailed.log). However, when i built the deal.ii.sln, errors occurred in
> the grid_tools.h file. It pointed to these codes below:
> //
> /      process_cells([&](const auto &cell, const auto key) {/
> /        if (cell_filter(cell))/
> /          neighbor_cell_list[key].emplace_back(/
> /            cell->id().template to_binary<spacedim>());/
> /      });/

We've had this kind of problem with MSVC in other cases as well. Can you
try what happens if you remove the 'template' keyword in that line? The
C++ standard requires it there, but there are plenty of places where we
had to do a similar change for MSVC in the past.

Alternatively, 'dim' is defined as a 'constexpr' variable higher up in
the function. Does it make a difference whether you define it as
constexpr int dim
or
const int dim
?

In the end, it boils down to finding a syntax that MSVC accepts and to
put a corresponding patch into the code base.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Wolfgang Bangerth

unread,
Mar 29, 2022, 5:58:25 PM3/29/22
to Daniel Sun, deal.II User Group
On 3/2/22 19:52, Daniel Sun wrote:
>                   I have tried both (removing the "template" keywords
> and changing the definition to "const int dim"). Same errors occur.
>                   When i go to the definition of /cell->id()/, 2
> matches found: class std::locale::id and class std::thread::id. Is that
> possible cause of not finding the right function. Could please give me
> further suggestions on this since i have not much experience on this and
> C++ coding.
>
>                   As far as i know,  the answer is no for MS-MPI. As
> for intel MPI library, it supports MPI-3.0 standard but i have not used it.

Daniel,
your email ended up in my spam folder. I'm sorry for the late reply.

Can you try whether the following works for you instead of the original
code?

OLD:
process_cells([&](const auto &cell, const auto key) {
if (cell_filter(cell))
neighbor_cell_list[key].emplace_back(
cell->id().template to_binary<spacedim>());
});

NEW:
process_cells([&](const auto &cell, const auto key) {
if (cell_filter(cell))
{
const auto id = cell->id();
neighbor_cell_list[key].emplace_back(
id.to_binary<spacedim>());
});


I don't know what to suggest about the MPI issue. MPI 3.0 was release in
September 2012, nearly ten years ago. We decided that that is long
enough ago that we can expect every reasonable platform to have an
implementation that supports it.
Reply all
Reply to author
Forward
0 new messages