error with petscviewer

Issue #32 invalid
Claire Lestringant created an issue

Hello,

I am working with petsc4py and petsc development versions (compiled weekly from master), and I notice an error with the following code :

    viewer = PETSc.Viewer().createBinary(filename+'.dat', 'w')
viewer(obj)

obj being whether PETScmatrix (.mat()) or PETScvector (.vec()).

The error is the following :

File "PETSc/Viewer.pyx", line 88, in petsc4py.PETSc.Viewer.__call__ (src/petsc4py.PETSc.c:66143)
petsc4py.PETSc.Error: error code 65
[0] PetscObjectView() line 106 in /tmp/petsc-3.6.0/src/sys/objects/destroy.c
[0] MatView() line 888 in /tmp/petsc-3.6.0/src/mat/interface/matrix.c
[0] MatView_SeqAIJ() line 964 in /tmp/petsc-3.6.0/src/mat/impls/aij/seq/aij.c
[0] MatView_SeqAIJ_Binary() line 556 in /tmp/petsc-3.6.0/src/mat/impls/aij/seq/aij.c
[0] PetscViewerBinaryGetDescriptor() line 333 in /tmp/petsc 3.6.0/src/sys/classes/viewer/impls/binary/binv.c
[0] PetscViewerSetUp() line 276 in /tmp/petsc-3.6.0/src/sys/classes/viewer/interface/view.c
[0] PetscViewerSetUp_Binary() line 1384 in /tmp/petsc-3.6.0/src/sys/classes/viewer/impls/binary/binv.c
[0] PetscViewerFileSetUp_Binary() line 1244 in /tmp/petsc-3.6.0/src/sys/classes/viewer/impls/binary/binv.c
[0] Unable to open file
[0] Cannot create file filename.dat for writing

I wonder whether this is linked to some recent update in PETSc ?

CL

Comments (14)

  1. Lisandro Dalcin

    Well, looking more closely, I have no idea what's going on in your system, this does not seem to be any obvious issue in either PETSc or petsc4py. Maybe you could try to compile and run a simple C program to debug the issue? Could you try to reproduce the stuff below?

    $ cat creat-test.c 
    #include <assert.h>
    #include <fcntl.h>
    int main() {
      assert(creat("filename.dat",0666) != -1);
      return 0;
    }
    
    $ ls -al filename.dat
    ls: cannot access filename.dat: No such file or directory
    
    $ cc creat-test.c 
    
    $ ./a.out 
    
    $ ls -al filename.dat
    -rw-rw-r--. 1 dalcinl dalcinl 0 Sep  9 15:06 filename.dat
    
  2. Claire Lestringant reporter
    $ cc creat-test.c
    cc: error trying to exec '/usr/lib/gcc/x86_64-linux-gnu/4.8/cc1': execv: Argument list too long
    
  3. Lisandro Dalcin

    Could you try gcc instead of cc? If that not work, well, sorry, I have no idea how you manage to compile C code in your system.

  4. Claire Lestringant reporter

    Ok, thanks for trying, though !

    $ gcc creat-test.c 
    bash: fork: Cannot allocate memory
    
  5. Claire Lestringant reporter

    So it was a memory problem (!), now I get :

    $ ./a.out 
    fenics@b0053ff92fb7:/shared/Matrices/Matrices_micro/FouthOrder$ ls -al filename.dat
    

    petscviewer still not working..

  6. Lisandro Dalcin

    Mmm, something weird is going on in your system. I would try again after a reboot. Is /shared a NFS-mounted filesystem?

  7. Claire Lestringant reporter

    I am working on a virtual machine and /shared is a directory shared with my machine and the virtual one...

  8. Lisandro Dalcin

    Well, in that case, try to run your petsc4py code in other directory, if it works, then the issue is within the VM filesystem sharing, and then I have no clue about how to help you further.

  9. Jack Hale

    I am confident this is an issue related to Docker and sharing permissions, nothing to do with petsc4py/PETSc, I will deal with it in our fenics-virtual bugtracker. Thanks for your help Lisandro, feel free to close.

  10. Log in to comment