[petsc-users] DMPlexCreateExodusFromFile() does not work on macOS Sierra

Blaise A Bourdin bourdin at lsu.edu
Tue Jan 24 08:57:18 CST 2017


Hi,

I was able to build petsc master with home-brew gcc 6.3 and intel 17.0 under macOS sierra. As Mark said, it is important to reinstall the entire home-brew compiler + libs after upgrading macOS (and often Xcode).
I am able to read / write exodus files. I am attaching my configure command lines:

with intel 17.0:
./configure ./configure               \
    --download-chaco=1                \
    --download-exodusii=1             \
    --download-hdf5=1                 \
    --download-hypre=1                \
    --download-metis=1                \
    --download-ml=1                   \
    --download-netcdf=1               \
    --download-parmetis=1             \
    --download-triangle=1             \
    --with-blas-lapack-dir=$MKLROOT   \
    --with-debugging=1                \
    --with-mpi-dir=$MPI_HOME          \
    --with-pic                        \
    --with-shared-libraries=1         \
    --with-vendor-compilers=intel     \
    --with-x11=1

with gcc:
./configure \
    --download-exodusii=1             \
    --download-chaco=1                \
    --download-ctetgen=1              \
    --download-hdf5=1                 \
    --download-hypre=1                \
    --download-metis=1                \
    --download-ml=1                   \
    --download-netcdf=1               \
    --download-parmetis=1             \
    --download-triangle=1             \
    --download-yaml=1                 \
    --with-debugging=1                \
    --with-shared-libraries=1         \
    --with-x11=1

Blaise

On Jan 23, 2017, at 7:55 AM, Mark Adams <mfadams at lbl.gov<mailto:mfadams at lbl.gov>> wrote:

And I trust you updated all system software (like gcc, NetCDF and ExodusII). OSX upgrades are hell.

On Mon, Jan 23, 2017 at 12:36 AM, Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>> wrote:
On Sun, Jan 22, 2017 at 11:18 PM, Fande Kong <fdkong.jd at gmail.com<mailto:fdkong.jd at gmail.com>> wrote:
Thanks, Matt,

Clang does not have this issue. The code runs fine with clang.

Okay, it sounds like a gcc bug on Mac 10.6, or at least in the version you have.

   Matt

Fande,

On Sun, Jan 22, 2017 at 8:03 PM, Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>> wrote:
On Sun, Jan 22, 2017 at 8:40 PM, Fande Kong <fdkong.jd at gmail.com<mailto:fdkong.jd at gmail.com>> wrote:
Thanks, Matt.

It is a weird bug.

Do we have an alternative solution to this? I was wondering whether it is possible to read the ".exo" files without using the ExodusII. For example, can we read the ".exo" files using the netcdf only?

Well, ExodusII is only a think layer on NetCDF, just like other wrappers are thin layers on HDF5. It is
really NetCDF that is failing. Can you switch compilers and see if that helps?

  Matt

Fande Kong,



On Sun, Jan 22, 2017 at 6:50 PM, Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>> wrote:
On Sun, Jan 22, 2017 at 5:28 PM, Fande Kong <fdkong.jd at gmail.com<mailto:fdkong.jd at gmail.com>> wrote:
On Sun, Jan 22, 2017 at 12:35 PM, Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>> wrote:
On Sun, Jan 22, 2017 at 12:41 PM, Fande Kong <fdkong.jd at gmail.com<mailto:fdkong.jd at gmail.com>> wrote:
On Sat, Jan 21, 2017 at 10:47 PM, Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>> wrote:
On Sat, Jan 21, 2017 at 10:38 PM, Fande Kong <fdkong.jd at gmail.com<mailto:fdkong.jd at gmail.com>> wrote:
Hi All,

I upgraded the OS system to macOS Sierra, and observed that PETSc can not read the exodus file any more. The same code runs fine on macOS Capitan. I also tested the function DMPlexCreateExodusFromFile() against different versions of the GCC compiler such as GCC-5.4 and GCC-6, and neither of them work. I guess this issue is related to the external package exodus, and PETSc might not pick up the right enveriment variables for the exodus.

This issue can be reproduced using the following simple code:

1) This is just a standard check. Have you reconfigured so that you know ExodusII was built with the same compilers and system libraries?

2) If so, can you get a stack trace with gdb or lldb?

0   libsystem_kernel.dylib         0x00007fffad8b8dda __pthread_kill + 10
1   libsystem_pthread.dylib       0x00007fffad9a4787 pthread_kill + 90
2   libsystem_c.dylib             0x00007fffad81e420 abort + 129
3   libpetsc.3.7.dylib             0x00000001100eb9ee PetscAbortErrorHandler + 506 (errstop.c:40)
4   libpetsc.3.7.dylib             0x00000001100e631d PetscError + 916 (err.c:379)
5   libpetsc.3.7.dylib             0x00000001100ed830 PetscSignalHandlerDefault + 1927 (signal.c:160)
6   libpetsc.3.7.dylib             0x00000001100ed088 PetscSignalHandler_Private(int) + 630 (signal.c:49)
7   libsystem_platform.dylib       0x00007fffad997bba _sigtramp + 26
8   ???                           0x000000011ea09370 initialPoolContent + 19008
9   libnetcdf.7.dylib             0x000000011228fc62 utf8proc_map + 210 (dutf8proc.c:543)
10  libnetcdf.7.dylib             0x000000011228fd0f utf8proc_NFC + 38 (dutf8proc.c:568)
11  libnetcdf.7.dylib             0x00000001122a7928 NC_findattr + 110 (attr.c:341)
12  libnetcdf.7.dylib             0x00000001122a7a4e NC_lookupattr + 119 (attr.c:384)
13  libnetcdf.7.dylib             0x00000001122a93ef NC3_get_att + 47 (attr.c:1138)
14  libnetcdf.7.dylib             0x0000000112286126 nc_get_att_float + 90 (dattget.c:192)
15  libpetsc.3.7.dylib             0x00000001117f3a5b ex_open_int + 171 (ex_open.c:259)
16  libpetsc.3.7.dylib             0x0000000110c36609 DMPlexCreateExodusFromFile + 781 (plexexodusii.c:43)
17  DMPlexCreateExodusFromFile     0x000000010fed4cfc main + 397 (DMPlexCreateExodusFromFile.cpp:24)
18  libdyld.dylib                 0x00007fffad78a255 start + 1

This is a NetCDF error on ex_open_int(). My guess is that your NetCDF build is old and when it calls the system DLL
you bomb. Can you do a completely new build, meaning either reclone PETSc somewhere else, or delete the whole
$PETSC_DIR/$PETSC_ARCH/externalpackage directory and reconfigure/build?

  Thanks,

      Matt


Hi Matt,

Thanks for reply.  I recloned  PETSc (the old petsc folder is deleted completely) and reconfigure. And still has the same issue. I also checked if the binary is complied against any other netcdf. The binary is actually complied against the right netcdf installed through PETSc.

You can see that this crash happens on the call to

  int   CPU_word_size = 0, IO_word_size = 0, exoid = -1;
  float version;

  exoid = ex_open(filename, EX_READ, &CPU_word_size, &IO_word_size, &version);

which means the fault is not in PETSc, but rather in ExodusII for your machine. We could definitely
confirm this if you made a 5 line program that only called this, but I don't see why it should be different.
I am not sure what to do, since I am not in control of anything about ExodusII. Can you report this to
their dev team? It is strange since Blaise has not reported this, and I know he uses it all the time.

 Thanks,

    Matt

LiviadeMacBook-Pro:partition livia$ otool -L  DMPlexCreateExodusFromFile
DMPlexCreateExodusFromFile:
/Users/livia/math/petsc/arch-darwin-cxx-debug/lib/libpetsc.3.7.dylib (compatibility version 3.7.0, current version 3.7.5)
/Users/livia/math/petsc/arch-darwin-cxx-debug/lib/libsuperlu_dist.5.dylib (compatibility version 5.0.0, current version 5.1.3)
/Users/livia/math/petsc/arch-darwin-cxx-debug/lib/libparmetis.dylib (compatibility version 0.0.0, current version 0.0.0)
/Users/livia/math/petsc/arch-darwin-cxx-debug/lib/libmetis.dylib (compatibility version 0.0.0, current version 0.0.0)
/Users/livia/math/petsc/arch-darwin-cxx-debug/lib/libnetcdf.7.dylib (compatibility version 10.0.0, current version 10.0.0)
/Users/livia/math/petsc/arch-darwin-cxx-debug/lib/libhdf5_hl.8.dylib (compatibility version 9.0.0, current version 9.1.0)
/Users/livia/math/petsc/arch-darwin-cxx-debug/lib/libhdf5.8.dylib (compatibility version 9.0.0, current version 9.1.0)
/opt/X11/lib/libX11.6.dylib (compatibility version 10.0.0, current version 10.0.0)
/Users/livia/math/mpich-3.2_install/lib/libmpifort.12.dylib (compatibility version 14.0.0, current version 14.0.0)
/usr/local/opt/gcc at 5/lib/gcc/5/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0)
/usr/local/opt/gcc at 5/lib/gcc/5/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/Users/livia/math/mpich-3.2_install/lib/libmpicxx.12.dylib (compatibility version 14.0.0, current version 14.0.0)
/usr/local/opt/gcc at 5/lib/gcc/5/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.21.0)
/usr/local/opt/gcc at 5/lib/gcc/5/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/Users/livia/math/mpich-3.2_install/lib/libmpi.12.dylib (compatibility version 14.0.0, current version 14.0.0)
/Users/livia/math/mpich-3.2_install/lib/libpmpi.12.dylib (compatibility version 14.0.0, current version 14.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
/usr/local/lib/gcc/5/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)






   Matt

static char help[] = " create mesh from exodus.\n\n";

#include <petscdm.h>
#include <petsc/private/dmpleximpl.h>

#undef __FUNCT__
#define __FUNCT__ "main"
int main(int argc,char **argv)
{
  char                fineMeshFileName[2048];
  DM                  dm;
  MPI_Comm            comm;
  PetscBool           flg;

  PetscErrorCode      ierr;

  ierr = PetscInitialize(&argc,&argv,(char *)0,help);CHKERRQ(ierr);
  comm = PETSC_COMM_WORLD;
  ierr = PetscOptionsGetString(NULL,NULL,"-file",fineMeshFileName,sizeof(fineMeshFileName),&flg);CHKERRQ(ierr);
  if(!flg){
SETERRQ(comm,PETSC_ERR_ARG_NULL,"please specify a fine mesh file \n");
   }
  ierr = DMPlexCreateExodusFromFile( comm,fineMeshFileName, PETSC_FALSE, &dm);CHKERRQ(ierr);
  ierr = DMDestroy(&dm);CHKERRQ(ierr);
  ierr = PetscFinalize();CHKERRQ(ierr);
}


LiviadeMacBook-Pro:partition livia$ ./DMPlexCreateExodusFromFile -file Tri3.exo
[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[0]PETSC ERROR: or see http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind
[0]PETSC ERROR: or try http://valgrind.org<http://valgrind.org/> on GNU/linux and Apple Mac OS X to find memory corruption errors
[0]PETSC ERROR: likely location of problem given in stack below
[0]PETSC ERROR: ---------------------  Stack Frames ------------------------------------
[0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,
[0]PETSC ERROR:       INSTEAD the line number of the start of the function
[0]PETSC ERROR:       is given.
[0]PETSC ERROR: [0] DMPlexCreateExodusFromFile line 38 /Users/livia/math/petsc/src/dm/impls/plex/plexexodusii.c
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Signal received
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.7.5, unknown
[0]PETSC ERROR: ./DMPlexCreateExodusFromFile on a arch-darwin-cxx-debug named LiviadeMacBook-Pro.local by livia Sat Jan 21 21:04:22 2017
[0]PETSC ERROR: Configure options --with-clanguage=cxx --with-shared-libraries=1 --download-fblaslapack=1 --with-mpi=1 --download-parmetis=1 --download-metis=1 --download-netcdf=1 --download-exodusii=1 --download-hdf5=1 --with-debugging=yes --with-c2html=0 --download-hypre=1 --with-64-bit-indices=1 --download-superlu_dist=1 PETSC_ARCH=arch-darwin-cxx-debug
[0]PETSC ERROR: #1 User provided function() line 0 in  unknown file
application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0
[unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=59
:
system msg for write_line failure : Bad file descriptor


The log files of make and configuration are also attached.  If you have any idea on this issue, please let me know!

Fande Kong,




--
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener




--
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener




--
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener




--
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener




--
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener


--
Department of Mathematics and Center for Computation & Technology
Louisiana State University, Baton Rouge, LA 70803, USA
Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 http://www.math.lsu.edu/~bourdin







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170124/35ba63f9/attachment-0001.html>


More information about the petsc-users mailing list