Commit 873e8400 authored by Moritz Hanke's avatar Moritz Hanke
Browse files

adds configure check for a problem that occured with OpenMPI in a Docker container

parent 4334d020
......@@ -17,6 +17,8 @@ EXTRA_DIST = util/sunf95preproc-wrapper \
config/checkdoc/openmpi_datatype.txt \
config/checksrc/openmpi_dup.c \
config/checkdoc/openmpi_dup.txt \
config/checksrc/openmpi_docker.c \
config/checkdoc/openmpi_docker.txt \
config/checksrc/pe5228_iv32584.c \
config/checkdoc/pe5228_iv32584.txt \
config/checksrc/incorrect_mpi_abort_exitcode.c \
......
WARNING: There is a problem with you MPI installation. This problem can occure
when running OpenMPI 4.1 in a Docker container.
/**
* @file openmpi_docker.c
* @brief demonstrates a problem that occured with OpenMPI 4.1.0
*
* @copyright Copyright (C) 2021 Moritz Hanke <hanke@dkrz.de>
* Thomas Jahns <jahns@dkrz.de>
*
* @author Moritz Hanke <hanke@dkrz.de>
* Thomas Jahns <jahns@dkrz.de>
*/
/*
* Keywords:
* Maintainer: Moritz Hanke <hanke@dkrz.de>
* Thomas Jahns <jahns@dkrz.de>
* URL: https://doc.redmine.dkrz.de/yaxt/html/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the DKRZ GmbH nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
/**
* usage:
* mpicc openmpi_docker.c && a.out
*
* expected output:
* "successfully send_buffer == recv_buffer"
*
* output in case of failure:
* "failed send_buffer != recv_buffer"
*/
#define DATA_SIZE (8192)
// was successfull in our test with
// #define DATA_SIZE (8191)
int main(void) {
// Initialize the MPI environment
MPI_Init(NULL, NULL);
unsigned char * buffer = malloc(2 * DATA_SIZE);
unsigned char * send_buffer = buffer;
unsigned char * recv_buffer = buffer + DATA_SIZE;
for (size_t i = 0; i < DATA_SIZE; ++i) {
send_buffer[i] = (unsigned char)i;
recv_buffer[i] = (unsigned char)(DATA_SIZE - i - 1);
}
MPI_Request request;
// send data asynchronously
MPI_Isend(send_buffer, DATA_SIZE, MPI_BYTE, 0, 0, MPI_COMM_WORLD, &request);
// receive data
MPI_Recv(
recv_buffer, DATA_SIZE, MPI_BYTE, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
// check the results
int err_count = 0;
for (size_t i = 0; i < DATA_SIZE; ++i)
if (recv_buffer[i] != send_buffer[i])
++err_count;
if (err_count) fputs("failed send_buffer != recv_buffer", stderr);
else fputs("successfully send_buffer == recv_buffer", stderr);
MPI_Wait(&request, MPI_STATUS_IGNORE);
free(buffer);
// Finalize the MPI environment.
MPI_Finalize();
return ((!err_count)?EXIT_SUCCESS:EXIT_FAILURE);
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment