Dear all, I am trying to print data from all the processes in a single file and I use the following command ierr = PetscViewerASCIIOpen(sys.comm, "cp.dat", &viewer1); CHKERRQ(ierr); ierr = PetscViewerASCIISynchronizedAllow(viewer1, PETSC_TRUE); CHKERRQ(ierr); . . /* Some user operations */ . . . ierr = PetscViewerASCIISynchronizedPrintf(viewer1, "%le\t%le\t%le\n", cp, x[0], x[1]); CHKERRQ(ierr); ierr = PetscViewerFlush(viewer1); CHKERRQ(ierr); but at run time the code hangs. What should I do? Kostas
On Feb 10, 2012, at 6:24 AM, Konstantinos Kontzialis wrote:
Dear all,
I am trying to print data from all the processes in a single file and I use the following command
ierr = PetscViewerASCIIOpen(sys.comm, "cp.dat", &viewer1); CHKERRQ(ierr);
ierr = PetscViewerASCIISynchronizedAllow(viewer1, PETSC_TRUE); CHKERRQ(ierr);
. .
/* Some user operations */ . . . ierr = PetscViewerASCIISynchronizedPrintf(viewer1, "%le\t%le\t%le\n", cp, x[0], x[1]); CHKERRQ(ierr);
ierr = PetscViewerFlush(viewer1); CHKERRQ(ierr);
but at run time the code hangs. What should I do?
Kostas
ASCII IO should only be used very sparingly. If you have lots of print statements and many processes it may appear to hang because it is taking forever to process the IO. You need to use binary IO for large amounts of data and or many processes. Barry
On Fri, Feb 10, 2012 at 8:17 AM, Barry Smith <[email protected]> wrote:
On Feb 10, 2012, at 6:24 AM, Konstantinos Kontzialis wrote:
Dear all,
I am trying to print data from all the processes in a single file and I use the following command
ierr = PetscViewerASCIIOpen(sys.comm, "cp.dat", &viewer1); CHKERRQ(ierr);
ierr = PetscViewerASCIISynchronizedAllow(viewer1, PETSC_TRUE); CHKERRQ(ierr);
. .
/* Some user operations */ . . . ierr = PetscViewerASCIISynchronizedPrintf(viewer1, "%le\t%le\t%le\n", cp, x[0], x[1]); CHKERRQ(ierr);
ierr = PetscViewerFlush(viewer1); CHKERRQ(ierr);
but at run time the code hangs. What should I do?
Kostas
ASCII IO should only be used very sparingly. If you have lots of print statements and many processes it may appear to hang because it is taking forever to process the IO. You need to use binary IO for large amounts of data and or many processes.
Also, those operations are collective, so you need every process to call that. Matt
Barry
-- 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
participants (3)
-
Barry Smith -
Konstantinos Kontzialis -
Matthew Knepley