Hi Barry,

I've put the functions and fortran bindings in the attached
files. In our code, we use them as follows:

  CALL mpi_bcast(value,1,MPI_LOGICAL,iproc,MPI_COMM_WORLD,ier)
  IF(ier/=0) CALL tracing_abort('ERROR in bcast logical root !')

  IF (iproc==thisprocess) THEN
     ier = PetscAdminSend(1*(nprocesses-1),MPI_LOGICAL)
  ELSE
     ier = PetscAdminRecv(1,MPI_LOGICAL)
  END IF

I also noted that you changed the treshold from 0.1% to 0.01%, so
I tried to change it as a user with PetscLogSetThreshold, but
this function seems not accessible to users (and there's no
fortran version or manual page).

Chris


dr. ir. Christiaan Klaij  | Senior Researcher | Research & Development
MARIN | T +31 317 49 33 44 | mailto:c.kl...@marin.nl | http://www.marin.nl

MARIN news: 
http://www.marin.nl/web/News/News-items/Kom-zaterdag-10-november-naar-de-open-dag-in-Wageningen.htm

________________________________________
From: Smith, Barry F. <bsm...@mcs.anl.gov>
Sent: Saturday, April 07, 2018 5:36 PM
To: Klaij, Christiaan
Cc: petsc-dev@mcs.anl.gov; Koos Huijssen
Subject: Re: nested timers transfers and reductions

> On Apr 6, 2018, at 5:22 AM, Klaij, Christiaan <c.kl...@marin.nl> wrote:
>
> Hi Barry,
>
> In our version of the nested timers, we had the functions
> PetscAdminSend, PetscAdminRecv and PetscAdminReduce. So I was
> expecting to find them at the end of the file
> petsc-3.8.4/src/sys/logging/xmllogevent.c but apparently
> you (re)moved them?

   I do not remember why I would have removed these functions. If you can send 
a patch that would return them I would gladly try to get them working with 
PETSc again.

    Barry

>
> We basically used these functions to fill the transfer(GiB/s) and
> reductions/s columns of the log just like we use PetscLogFlops to
> fill the compute(Mflops) column for our registered events.
>
> How should I do this with the petsc version of the nested timers?
>
> Chris
>
>
> dr. ir. Christiaan Klaij  | Senior Researcher | Research & Development
> MARIN | T +31 317 49 33 44 | mailto:c.kl...@marin.nl | http://www.marin.nl
>
> MARIN news: 
> http://www.marin.nl/web/News/News-items/Application-of-potential-flow-methods-to-fast-displacement-ships-at-transcritical-speeds-in-shallow-water-1.htm
>

!*************************************************************************************
!*    M A R I T I M E  R E S E A R C H  I N S T I T U T E  N E T H E R L A N D S     *
!*************************************************************************************
!*    authors: Bas van 't Hof, Koos Huijssen, Christiaan M. Klaij                    *
!*************************************************************************************
!*    content: Support for nested PetscTimers                                        *
!*************************************************************************************

module petsc_MPIadminF
use iso_c_binding
   interface 
     function PetscAdminSend(count, datatype) bind(c,name='PetscAdminSend') result(ierr)
     use iso_c_binding
     implicit none
     integer(c_int), value :: count
     integer(c_int), value :: datatype
     integer(c_int)        :: ierr
     end function PetscAdminSend

     function PetscAdminRecv(count, datatype) bind(c,name='PetscAdminRecv') result(ierr)
     use iso_c_binding
     implicit none
     integer(c_int), value :: count
     integer(c_int), value :: datatype
     integer(c_int)        :: ierr
     end function PetscAdminRecv

     function PetscAdminReduce() bind(c,name='PetscAdminReduce') result(ierr)
     use iso_c_binding
     implicit none
     integer(c_int)        :: ierr
     end function PetscAdminReduce

   end interface 
end module petsc_MPIadminF

/*************************************************************************************
 *    M A R I T I M E  R E S E A R C H  I N S T I T U T E  N E T H E R L A N D S     *
 *************************************************************************************
 *    authors: Bas van 't Hof, Koos Huijssen, Christiaan M. Klaij                    *
 *************************************************************************************
 *    content: Support for nested PetscTimers                                        *
 *************************************************************************************/

#include <petsclog.h> 

/*****************************************************************/
#undef __FUNCT__
#define __FUNCT__ "PetscAdminSend"
PetscErrorCode PetscAdminSend(int count, int datatype) {
  PetscErrorCode    ierr;
  PetscFunctionBegin;
  petsc_send_ct++;
  ierr = PetscMPITypeSize(&petsc_send_len,count, MPI_Type_f2c((MPI_Fint) datatype)); CHKERRQ(ierr);
  PetscFunctionReturn(0);
}

/*****************************************************************/
#undef __FUNCT__
#define __FUNCT__ "PetscAdminRecv"
PetscErrorCode PetscAdminRecv(int count, int datatype) {
  PetscErrorCode    ierr;
  PetscFunctionBegin;
  petsc_recv_ct++;
  ierr = PetscMPITypeSize(&petsc_recv_len,count, MPI_Type_f2c((MPI_Fint) datatype)); CHKERRQ(ierr);
  PetscFunctionReturn(0);
}

/*****************************************************************/
#undef __FUNCT__
#define __FUNCT__ "PetscAdminReduce"
PetscErrorCode PetscAdminReduce() {
  PetscFunctionBegin;
  petsc_allreduce_ct++;
  PetscFunctionReturn(0);
}

Reply via email to