View Issue Details

IDProjectCategoryView StatusLast Update
0002044OpenFOAMBugpublic2016-04-06 12:27
Reporterfeymark Assigned Tohenry  
PriorityimmediateSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
PlatformGNU/LinuxOSUbuntuOS Version15.04
Product Versiondev 
Summary0002044: UPstream compile error.
Descriptioncommit 56668b24066c32665026b0613109f8627a7c7789 introduced the following error:

UPstream.C:327:32: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
                 sendData.begin(),

I solved it using the following code.

--- a/src/Pstream/mpi/UPstream.C
+++ b/src/Pstream/mpi/UPstream.C
@@ -324,7 +324,7 @@ void Foam::UPstream::allToAll
         (
             MPI_Alltoall
             (
- sendData.begin(),
+ const_cast<int*>(sendData.begin()),
                 sizeof(label),
                 MPI_BYTE,
                 recvData.begin(),
TagsNo tags attached.

Activities

wyldckat

2016-04-05 13:11

updater   ~0006086

I got that issue as well this past weekend, but it was because I was using Open-MPI 1.6.5.
The latest supported Open-MPI version in OpenFOAM-dev is 1.10, which doesn't have this issue: https://github.com/OpenFOAM/ThirdParty-dev/blob/69dba76b3195420c71173a65b1c227b2650eaebf/README.org#parallel-processing

I haven't checked if other Open-MPI versions are working as intended.

The reason why using this "const_cast" isn't exactly the best idea, is because the data to be sent should be kept as read-only. Nonetheless, it could be used as a workaround for compatibility with older versions of Open-MPI.

henry

2016-04-05 13:15

manager   ~0006087

@feymark: Which OpenMPI version are you using? Can you upgrade?

I agree with Bruno, casting-away the const-ness is bad and unnecessary and now the MPI calls handled const-ness correctly it would be good to use it.

feymark

2016-04-06 09:50

reporter   ~0006088

I was using the OpenMPI shipped with Ubuntu. I have updated my OpenMPI and now it works fine. What to do with the compatibility with older versions of Open-MPI I don't know.

henry

2016-04-06 11:52

manager   ~0006089

@Bruno: do you know at what verision of OpenMPI proper handling of "const" was introduced? I am wondering how much trouble is going to be generated by the new functionality and if the const_cast will be needed for now.

wyldckat

2016-04-06 12:07

updater   ~0006090

@Henry: After a somewhat quick search through https://github.com/open-mpi/ompi-release - It was introduced into Open-MPI 1.7.4, is present in 1.8.0 as well and onwards.

The git blame states that it was in late October 2013, on-time for 1.7.4 and 1.8.0: https://github.com/open-mpi/ompi-release/blame/f6841ec506009e9e0108279f584438dfbbf137cd/ompi/mpi/c/alltoall.c#L46 - but didn't make it to 1.7.3.


In contrast, Ubuntu 15.10 is the last of the Ubuntu's to have Open-MPI 1.6.5 (since Ubuntu 14.04): http://packages.ubuntu.com/search?keywords=libopenmpi-dev&searchon=names&suite=all&section=all

henry

2016-04-06 12:27

manager   ~0006091

Thanks for the details Bruno. Given that the hack is needed for all but the latest Ubuntu release I have decided to included it with a comment.

Resolved in OpenFOAM-dev by commit e290c253615c1a15b45b975ea08cfa2995e5fafd

Issue History

Date Modified Username Field Change
2016-04-05 12:47 feymark New Issue
2016-04-05 13:11 wyldckat Note Added: 0006086
2016-04-05 13:15 henry Note Added: 0006087
2016-04-06 09:50 feymark Note Added: 0006088
2016-04-06 11:52 henry Note Added: 0006089
2016-04-06 12:07 wyldckat Note Added: 0006090
2016-04-06 12:27 henry Note Added: 0006091
2016-04-06 12:27 henry Status new => resolved
2016-04-06 12:27 henry Resolution open => fixed
2016-04-06 12:27 henry Assigned To => henry