Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MueLu: Failure to build parallel on Windows-LLVM due to lack of inet_network #9184

Closed
jrobcary opened this issue May 27, 2021 · 7 comments
Closed
Labels
MARKED_FOR_CLOSURE Issue or PR is marked for auto-closure by the GitHub Actions bot. pkg: MueLu type: bug The primary issue is a bug in Trilinos code or tests

Comments

@jrobcary
Copy link
Contributor

Bug Report

@trilinos/muelu

The build fails as shown at the bottom. This is due to using inet_network, which does not exist on Windows.

This whole function seems to be about

// Generates a communicator whose only members are other ranks of the baseComm on my node

Would not this be done directly with a call to

int ierr = MPI_Comm_split_type(baseComm, MPI_COMM_TYPE_SHARED,
0, MPI_INFO_NULL, &newComm);

????

        C:\PROGRA~1\LLVM\bin\clang-cl.exe @C:\cygwin64\tmp\nmE0F2.tmp
D:\winsame\cary\vorpalall-dev2\trilinos\packages\muelu\src\Utils\MueLu_Utilities.cpp(271,32): warning: 'gethostbyname' is deprecated: Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings [-Wdeprecated-declarations]
       struct hostent * host = gethostbyname(hostname);
                               ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winsock2.h(2215,1): note: 'gethostbyname' has been explicitly marked deprecated here
_WINSOCK_DEPRECATED_BY("getaddrinfo() or GetAddrInfoW()")
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winsock2.h(26,56): note: expanded from macro '_WINSOCK_DEPRECATED_BY'
#define _WINSOCK_DEPRECATED_BY(replacement) __declspec(deprecated("Use " replacement " instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings"))
                                                       ^
D:\winsame\cary\vorpalall-dev2\trilinos\packages\muelu\src\Utils\MueLu_Utilities.cpp(272,33): error: use of undeclared identifier 'inet_network'; did you mean 'inet_ntoa'?
       int myaddr = (int) htonl(inet_network(inet_ntoa(*(struct in_addr *)host->h_addr)));
                                ^~~~~~~~~~~~
                                inet_ntoa
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winsock2.h(1849,1): note: 'inet_ntoa' declared here
inet_ntoa(
^
D:\winsame\cary\vorpalall-dev2\trilinos\packages\muelu\src\Utils\MueLu_Utilities.cpp(272,46): error: no viable conversion from 'char *' to 'struct in_addr'
       int myaddr = (int) htonl(inet_network(inet_ntoa(*(struct in_addr *)host->h_addr)));
@jrobcary jrobcary added the type: bug The primary issue is a bug in Trilinos code or tests label May 27, 2021
@cgcgcg
Copy link
Contributor

cgcgcg commented May 27, 2021

@csiefer2

@cgcgcg
Copy link
Contributor

cgcgcg commented May 27, 2021

I guess MPI_COMM_TYPE_SHARED works only for MPI>=3.

@jrobcary
Copy link
Contributor Author

Dunno your targets, but it works for us with OpenMPI-4.0.5, mpich-3.3.2, Windows-MPI, current version.

@jhux2
Copy link
Member

jhux2 commented May 27, 2021

@trilinos/muelu

@jrobcary
Copy link
Contributor Author

jrobcary commented May 27, 2021

It looks like inet_ntoa gives a string containing the dot notation.
inet_network converts this to a number in host byte order
htonl converts this to network byte order.

But then one could use just inet_addr?
"The inet_addr() function converts the Internet host address cp from IPv4 numbers-and-dots notation into binary data in network byte order."

I changed the code to

#ifdef _WIN32
       int myaddr = (int) inet_addr(inet_ntoa(*(struct in_addr *)host->h_addr));
#else
       int myaddr = (int) htonl(inet_network(inet_ntoa(*(struct in_addr *)host->h_addr)));
#endif

and it does compile.

Since the _WIN32 line does compile on both Linux and Windows, is it okay to just submit that change to the test system?

@github-actions
Copy link

This issue has had no activity for 365 days and is marked for closure. It will be closed after an additional 30 days of inactivity.
If you would like to keep this issue open please add a comment and/or remove the MARKED_FOR_CLOSURE label.
If this issue should be kept open even with no activity beyond the time limits you can add the label DO_NOT_AUTOCLOSE.
If it is ok for this issue to be closed, feel free to go ahead and close it. Please do not add any comments or change any labels or otherwise touch this issue unless your intention is to reset the inactivity counter for an additional year.

@github-actions github-actions bot added the MARKED_FOR_CLOSURE Issue or PR is marked for auto-closure by the GitHub Actions bot. label May 28, 2022
@jrobcary
Copy link
Contributor Author

This is now building.

@jhux2 jhux2 added this to MueLu Aug 12, 2024
@jhux2 jhux2 moved this to Done in MueLu Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MARKED_FOR_CLOSURE Issue or PR is marked for auto-closure by the GitHub Actions bot. pkg: MueLu type: bug The primary issue is a bug in Trilinos code or tests
Projects
Status: Done
Development

No branches or pull requests

3 participants