[petsc-users] PETSC_VIEWER_DRAW_(Comm) Fortran interface missing?

Smith, Barry F. bsmith at mcs.anl.gov
Thu Mar 8 10:57:34 CST 2018


   Thanks Satish!


> On Mar 8, 2018, at 9:50 AM, Satish Balay <balay at mcs.anl.gov> wrote:
> 
> Great! I've merged balay/ftn-VIEWER_DRAW/maint to 'maint'
> 
> Satish
> 
> On Thu, 8 Mar 2018, Tim Steinhoff wrote:
> 
>> Yeah, thanks Satish.
>> PETSC_VIEWER_DRAW_() works perfectly and I could not reproduce my
>> above mentioned issue with PETSC_VIEWER_STDOUT_(), so probably I
>> messed something up.
>> Thanks again for your great support,
>> Volker
>> 
>> 2018-03-06 18:14 GMT+01:00 Satish Balay <balay at mcs.anl.gov>:
>>> Ok - I've added ftn interface for PETSC_VIEWER_DRAW_() [similar to
>>> PETSC_VIEWER_STDOUT_()] in branch balay/ftn-VIEWER_DRAW/maint.
>>> 
>>> You can give it a try and see if it works.
>>> 
>>> Satish
>>> 
>>> On Tue, 6 Mar 2018, Satish Balay wrote:
>>> 
>>>> Hm - I do see the fortran interface code for PETSC_VIEWER_STDOUT_()
>>>> 
>>>> https://bitbucket.org/petsc/petsc/src/049452fa31a1384b9850ba16ebcec79c99e4198c/src/sys/classes/viewer/impls/ascii/ftn-custom/zvcreatef.c?at=master&fileviewer=file-view-default
>>>> 
>>>> and it does appear to work for me.
>>>> 
>>>> balay at asterix /home/balay/petsc/src/mat/examples/tests (master *=)
>>>> $ git diff
>>>> diff --git a/src/mat/examples/tests/ex16f90.F90 b/src/mat/examples/tests/ex16f90.F90
>>>> index 6bb83b4644..fee44aea95 100644
>>>> --- a/src/mat/examples/tests/ex16f90.F90
>>>> +++ b/src/mat/examples/tests/ex16f90.F90
>>>> @@ -15,6 +15,7 @@
>>>>       PetscInt one
>>>>       PetscScalar  v(1)
>>>>       PetscScalar, pointer :: array(:,:)
>>>> +      PetscViewer vw
>>>> 
>>>> 
>>>>       call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
>>>> @@ -49,7 +50,8 @@
>>>> !
>>>> !       Print the matrix to the screen
>>>> !
>>>> -      call MatView(A,PETSC_VIEWER_STDOUT_WORLD,ierr);CHKERRA(ierr)
>>>> +      vw = PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
>>>> +      call MatView(A,vw,ierr);CHKERRA(ierr)
>>>> 
>>>> 
>>>> !
>>>> balay at asterix /home/balay/petsc/src/mat/examples/tests (master *=)
>>>> $ mpiexec -n 2 ./ex16f90
>>>> Mat Object: 2 MPI processes
>>>>  type: mpidense
>>>> 9.0000000000000000e+00 4.5000000000000000e+00
>>>> 4.5000000000000000e+00 3.0000000000000000e+00
>>>> 3.0000000000000000e+00 2.2500000000000000e+00
>>>> balay at asterix /home/balay/petsc/src/mat/examples/tests (master *=)
>>>> $
>>>> 
>>>> 
>>>> Satish
>>>> 
>>>> 
>>>> On Tue, 6 Mar 2018, Tim Steinhoff wrote:
>>>> 
>>>>> Hi Barry,
>>>>> 
>>>>> thanks for your fast response. Yes, I'm fine with that.
>>>>> Indeed, my code with the routine PETSC_VIEWER_STDOUT_(comm) was
>>>>> compilable, but turned out it did not work properly at runtime
>>>>> (hangs).
>>>>> When using PETSC_VIEWER_DRAW_(comm), the compiler immediately gives an
>>>>> error and I was confused.
>>>>> 
>>>>> Thanks,
>>>>> 
>>>>> Volker
>>>>> 
>>>>> By the way, the output parameter description of
>>>>> PetscViewerASCIIGetStdout is missing in the documentation:
>>>>> http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerASCIIGetStdout.html
>>>>> 
>>>>> 
>>>>> 2018-03-06 16:26 GMT+01:00 Smith, Barry F. <bsmith at mcs.anl.gov>:
>>>>>> 
>>>>>> 
>>>>>>   Tim,
>>>>>> 
>>>>>>     The PETSC_VIEWER_STDOUT_(comm)  construct doesn't work in Fortran. Only the
>>>>>> PETSC_VIEWER_STDOUT_WORLD or PETSC_VIEWER_STDOUT_SELF work. This is also true for
>>>>>> draw see src/ksp/ksp/examples/tutorials/ex100f.F90
>>>>>> 
>>>>>>   Note that you can use PetscViewerDrawOpen() to get a draw to open on any communicator you like.
>>>>>> 
>>>>>> 
>>>>>>   Does this answer your question or did I misunderstand?
>>>>>> 
>>>>>>   Barry
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Mar 6, 2018, at 9:02 AM, Tim Steinhoff <kandanovian at gmail.com> wrote:
>>>>>>> 
>>>>>>> Hi all,
>>>>>>> 
>>>>>>> it seems like the routine PETSC_VIEWER_DRAW_(comm)  is not available
>>>>>>> in Fortran, while PETSC_VIEWER_STDOUT_(comm) is.
>>>>>>> Is there anything I can do about it? (I am using the current maint
>>>>>>> branch of PETSc)
>>>>>>> 
>>>>>>> Thank you very much and kind regards,
>>>>>>> 
>>>>>>> Volker
>>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>> 
> 



More information about the petsc-users mailing list