/* * Illustrates floating point exception down in mpiio routines. See * bottom of this file for traceback. * * mpicc -g -o attrib-test attrib-test.c -I../include -L../lib -lpnetcdf -Wl,--rpath,../lib -lm * * clang 12.0.0, openmpi-4.0.5 * */ #include #include #include #include #include #ifdef __USE_GNU #include #else #define __USE_GNU #include #undef __USE_GNU #endif #define FILE_NAME "attrib.nc" /* * Contents of `attrib.nc`: */ #if 0 netcdf attrib { dimensions: num_el_in_blk1 = 4 ; num_att_in_blk1 = 7 ; variables: double attrib1(num_el_in_blk1, num_att_in_blk1) ; data: attrib1 = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ; } #endif int main(int argc, char **argv) { feenableexcept(FE_DIVBYZERO | FE_OVERFLOW | FE_INVALID); MPI_Init(&argc, &argv); int nprocs; int rank; MPI_Comm_size(MPI_COMM_WORLD, &nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &rank); /* Open the file. */ int ncid; ncmpi_open(MPI_COMM_WORLD, FILE_NAME, NC_NOWRITE, MPI_INFO_NULL, &ncid); int att1_varid; int err = ncmpi_inq_varid(ncid, "attrib1", &att1_varid); fprintf(stderr, "Retrun from ncmpi_inq_varid = %d\n", err); /* Read the coordinate variable data. */ /* * Variable `attrib1` is of size 4 x 7 * Rank 0 is reading all values of one `row` * Rank 1 is reading no values of the row */ MPI_Offset start[] = {0, 0}; MPI_Offset stride[] = {1, 7}; MPI_Offset count[] = {0, 1}; if (rank == 0) { count[0] = 4; } double attrib[4] = {0.0, 0.0, 0.0, 0.0}; err = ncmpi_get_vars_double_all(ncid, att1_varid, start, count, stride, &attrib[0]); fprintf(stderr, "Retrun from ncmpi_get_vars_double = %d\n", err); /* Close the file. */ ncmpi_close(ncid); MPI_Finalize(); } #if 0 bash-4.2$ mpiexec -np 2 ./attrib-test Retrun from ncmpi_inq_varid = 0 Retrun from ncmpi_inq_varid = 0 [hpws050:20038] *** Process received signal *** [hpws050:20038] Signal: Floating point exception (8) [hpws050:20038] Signal code: Invalid floating point operation (7) [hpws050:20038] Failing at address: 0x7fa1c40600b8 [hpws050:20039] *** Process received signal *** [hpws050:20039] Signal: Floating point exception (8) [hpws050:20039] Signal code: Invalid floating point operation (7) [hpws050:20039] Failing at address: 0x7f42b90420b8 [hpws050:20038] [ 0] /lib64/libpthread.so.0(+0xf630)[0x7fa1d2641630] [hpws050:20039] [ 0] /lib64/libpthread.so.0(+0xf630)[0x7f42cbad3630] [hpws050:20039] [ 1] [hpws050:20038] [ 1] /sierra/sntools/SDK/mpi/openmpi/4.0.5-clang-12.0-RHEL7/lib/libmca_common_ompio.so.41(+0x30b8)[0x7fa1c40600b8] [hpws050:20038] [ 2] /sierra/sntools/SDK/mpi/openmpi/4.0.5-clang-12.0-RHEL7/lib/libmca_common_ompio.so.41(mca_common_ompio_simple_grouping+0x96)[0x7fa1c405fdc6] [hpws050:20038] [ 3] /sierra/sntools/SDK/mpi/openmpi/4.0.5-clang-12.0-RHEL7/lib/libmca_common_ompio.so.41(+0x30b8)[0x7f42b90420b8] [hpws050:20039] [ 2] /sierra/sntools/SDK/mpi/openmpi/4.0.5-clang-12.0-RHEL7/lib/libmca_common_ompio.so.41(mca_common_ompio_simple_grouping+0x96)[0x7f42b9041dc6] [hpws050:20039] [ 3] /sierra/sntools/SDK/mpi/openmpi/4.0.5-clang-12.0-RHEL7/lib/libmca_common_ompio.so.41(mca_common_ompio_set_view+0x826)[0x7f42b9046886] [hpws050:20039] [ 4] /projects/sierra/linux_rh7/SDK/mpi/openmpi/4.0.5-clang-12.0-RHEL7/lib/openmpi/mca_io_ompio.so(mca_io_ompio_file_set_view+0x7f)[0x7f42b9a9498f] [hpws050:20039] [ 5] /sierra/sntools/SDK/mpi/openmpi/4.0.5-clang-12.0-RHEL7/lib/libmca_common_ompio.so.41(mca_common_ompio_set_view+0x826)[0x7fa1c4064886] [hpws050:20038] [ 4] /projects/sierra/linux_rh7/SDK/mpi/openmpi/4.0.5-clang-12.0-RHEL7/lib/openmpi/mca_io_ompio.so(mca_io_ompio_file_set_view+0x7f)[0x7fa1c447998f] [hpws050:20038] [ 5] /projects/sierra/linux_rh7/SDK/mpi/openmpi/4.0.5-clang-12.0-RHEL7/lib/libmpi.so.40(PMPI_File_set_view+0x108)[0x7f42cbd4e378] [hpws050:20039] [ 6] /projects/sierra/linux_rh7/SDK/mpi/openmpi/4.0.5-clang-12.0-RHEL7/lib/libmpi.so.40(PMPI_File_set_view+0x108)[0x7fa1d28bc378] [hpws050:20038] [ 6] ../lib/libpnetcdf.so.4(ncmpio_file_set_view+0x58)[0x7f42cc3ed748] [hpws050:20039] [ 7] ../lib/libpnetcdf.so.4(ncmpio_file_set_view+0x1ae)[0x7fa1d2f5b89e] [hpws050:20038] [ 7] ../lib/libpnetcdf.so.4(+0x103d38)[0x7f42cc3fcd38] [hpws050:20039] [ 8] ../lib/libpnetcdf.so.4(+0x103d38)[0x7fa1d2f6ad38] [hpws050:20038] [ 8] ../lib/libpnetcdf.so.4(ncmpio_get_var+0xc6)[0x7f42cc3fc676] [hpws050:20039] [ 9] ../lib/libpnetcdf.so.4(ncmpio_get_var+0xc6)[0x7fa1d2f6a676] [hpws050:20038] [ 9] ../lib/libpnetcdf.so.4(ncmpi_get_vars_double_all+0x1e4)[0x7f42cc340da4] [hpws050:20039] [10] ./attrib-test[0x400be1] [hpws050:20039] [11] ../lib/libpnetcdf.so.4(ncmpi_get_vars_double_all+0x1e4)[0x7fa1d2eaeda4] [hpws050:20038] [10] ./attrib-test[0x400be1] [hpws050:20038] [11] /lib64/libc.so.6(__libc_start_main+0xf5)[0x7f42cb718555] [hpws050:20039] [12] /lib64/libc.so.6(__libc_start_main+0xf5)[0x7fa1d2286555] [hpws050:20038] [12] ./attrib-test[0x4009a9] [hpws050:20038] *** End of error message *** ./attrib-test[0x4009a9] [hpws050:20039] *** End of error message *** #endif