[petsc-users] random vector

Benjamin Sanderse B.Sanderse at cwi.nl
Mon Jul 9 10:21:28 CDT 2012


So I updated to 3.3, but still get the same error:

Any ideas?

[0]PETSC ERROR: --------------------- Error Message ------------------------------------
[0]PETSC ERROR: Object is in wrong state!
[0]PETSC ERROR: PetscRandom object's type is not set: Argument # 1!
[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Petsc Release Version 3.3.0, Patch 1, Fri Jun 15 09:30:49 CDT 2012 
[0]PETSC ERROR: See docs/changes/index.html for recent updates.
[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[0]PETSC ERROR: See docs/index.html for manual pages.
[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: bin/navier-stokes on a arch-linu named slippy.sen.cwi.nl by sanderse Mon Jul  9 17:18:39 2012
[0]PETSC ERROR: Libraries linked from /export/scratch1/sanderse/software/petsc-3.3-p1_debug/arch-linux2-c-opt/lib
[0]PETSC ERROR: Configure run at Mon Jul  9 16:58:35 2012
[0]PETSC ERROR: Configure options --download-mpich=1 --with-shared-libraries --download-f-blas-lapack=1 --with-fc=gfortran --with-cxx=g++ --download-hypre --with-hdf5 --download-hdf5 --with-cc=gcc
[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: PetscRandomSeed() line 431 in /export/scratch1/sanderse/software/petsc-3.3-p1_debug/src/sys/random/interface/randomc.c
application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0
[cli_0]: aborting job:
application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0


----- Original Message -----
From: "Barry Smith" <bsmith at mcs.anl.gov>
To: "PETSc users list" <petsc-users at mcs.anl.gov>
Sent: Monday, July 9, 2012 4:08:08 PM
Subject: Re: [petsc-users] random vector


   Please update to using petsc-3.3

On Jul 9, 2012, at 9:03 AM, Benjamin Sanderse wrote:

> Thanks a lot. I need to have the PetscRandomCreate inside the loop,

    Why?

> so I will use the RandomSetSeed. 
> However, when running the code below I get the following error.
> 
>            PetscRandom    :: rctx
> 
>            call PetscRandomCreate(PETSC_COMM_WORLD,rctx,ierr); CHKERRQ(ierr)

    call PetscRandomSetType(rctx,PETSCRAND,ierr);

>            call PetscRandomSetSeed(rctx,I,ierr); CHKERRQ(ierr)
>            call PetscRandomSeed(rctx,ierr); CHKERRQ(ierr)
>            call VecSetRandom(f,rctx,ierr); CHKERRQ(ierr)
>            call PetscRandomDestroy(rctx,ierr); CHKERRQ(ierr)
> 
> In PetscRandomSetSeed, I is an integer.
> 
> [0]PETSC ERROR: --------------------- Error Message ------------------------------------
> [0]PETSC ERROR: Object is in wrong state!
> [0]PETSC ERROR: PetscRandom object's type is not set: Argument # 1!
> [0]PETSC ERROR: ------------------------------------------------------------------------
> [0]PETSC ERROR: Petsc Release Version 3.2.0, Patch 6, Wed Jan 11 09:28:45 CST 2012 
> [0]PETSC ERROR: See docs/changes/index.html for recent updates.
> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
> [0]PETSC ERROR: See docs/index.html for manual pages.
> [0]PETSC ERROR: ------------------------------------------------------------------------
> [0]PETSC ERROR: bin/navier-stokes on a arch-linu named slippy.sen.cwi.nl by sanderse Mon Jul  9 15:58:16 2012
> [0]PETSC ERROR: Libraries linked from /export/scratch1/sanderse/software/petsc-3.2-p6-debug/arch-linux2-c-opt/lib
> [0]PETSC ERROR: Configure run at Wed Feb 22 18:04:02 2012
> [0]PETSC ERROR: Configure options --download-mpich=1 --with-shared-libraries --download-f-blas-lapack=1 --with-fc=gfortran --with-cxx=g++ --download-hypre --with-hdf5 --download-hdf5 --with-cc=gcc
> [0]PETSC ERROR: ------------------------------------------------------------------------
> [0]PETSC ERROR: PetscRandomSeed() line 431 in /export/scratch1/sanderse/software/petsc-3.2-p6-debug/src/sys/random/interface/randomc.c
> application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0
> [cli_0]: aborting job:
> application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0
> 
> 
> Maybe something has changed from 3.2p6 to 3.3? I do not see what is wrong with the PetscRandom object.
> 
> Benjamin
> 
> 
> ----- Original Message -----
> From: "Barry Smith" <bsmith at mcs.anl.gov>
> To: "PETSc users list" <petsc-users at mcs.anl.gov>
> Sent: Monday, July 9, 2012 3:51:18 PM
> Subject: Re: [petsc-users] random vector
> 
> 
>   Create and destroy the random context OUTSIDE of the loop. Each time you create it it is using the same seed hence giving the same values.
> 
>   Note that it is also intentional that if you run the code twice you get the same values each time you run it to help write and debug codes. If you want different values each time you run it you need to call PetscRandomSetSeed() then PetscRandomSeed() after creating the context
> 
> 
>   Barry
> 
> On Jul 9, 2012, at 7:53 AM, Benjamin Sanderse wrote:
> 
>> Hello all,
>> 
>> I am trying to solve a Poisson equation several times with random right-hand side vectors in order to do parallel scalability tests.
>> Here is part of the code that I use to generate a random vector:
>> 
>> 
>> PetscRandom    :: rctx
>> 
>> ...
>> 
>> do I = 1,n
>> 
>> 
>> call PetscRandomCreate(PETSC_COMM_WORLD,rctx,ierr); CHKERRQ(ierr)
>> call VecSetRandom(f,rctx,ierr); CHKERRQ(ierr)
>> call PetscRandomDestroy(rctx,ierr); CHKERRQ(ierr)
>> 
>> call VecView(f,PETSC_VIEWER_STDOUT_WORLD,ierr); CHKERRQ(ierr)
>> 
>> call Poisson
>> 
>> end do
>> 
>> 
>> It appears that f does not change during the execution of the do-loop. In fact its value is even always the same for I=1 when I run the code several times. Apparently I am missing something. Can anybody help?
>> 
>> Regards,
>> 
>> 
>> Benjamin
> 



More information about the petsc-users mailing list