[petsc-users] Petsc creates a random vector
Dmitry Karpeyev
dkarpeev at gmail.com
Mon Aug 17 11:16:30 CDT 2015
Xujun,
Regarding your original question: please send the complete error message.
Dmitry.
On Mon, Aug 17, 2015 at 11:15 AM Xujun Zhao <xzhao99 at gmail.com> wrote:
> Ahhhh, I should drink some coffee in the morning.
> Now it passed the test!
>
> On Mon, Aug 17, 2015 at 11:13 AM, Matthew Knepley <knepley at gmail.com>
> wrote:
>
>> On Mon, Aug 17, 2015 at 11:02 AM, Xujun Zhao <xzhao99 at gmail.com> wrote:
>>
>>> No. It gives the following error msg:
>>>
>>
>> Did you build the executable?
>>
>> cd src/vec/vec/examples/tutorials
>> make ex43
>>
>> Matt
>>
>>
>>> mpirun -np 2 ex43
>>>
>>> [proxy:0:0 at mcswl164.mcs.anl.gov] [proxy:0:0 at mcswl164.mcs.anl.gov]
>>> HYDU_create_process (utils/launch/launch.c:75): HYDU_create_process
>>> (utils/launch/launch.c:75): execvp error on file ex43 (No such file or
>>> directory)
>>>
>>> execvp error on file ex43 (No such file or directory)
>>>
>>> On Mon, Aug 17, 2015 at 10:57 AM, Matthew Knepley <knepley at gmail.com>
>>> wrote:
>>>
>>>> On Mon, Aug 17, 2015 at 10:49 AM, Xujun Zhao <xzhao99 at gmail.com> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I want PETSc to generate random vector using VecSetRandom() following
>>>>> given examples, but failed and showed some "out of memory" error. The
>>>>> following is the code, which goes well until it reaches VecSetRandom(). Can
>>>>> anyone help me figure out the reason? Thanks a lot.
>>>>>
>>>>
>>>> Does src/vec/vec/examples/tests/ex43.c run for you?
>>>>
>>>> Thanks,
>>>>
>>>> Matt
>>>>
>>>>
>>>>> XZ
>>>>>
>>>>>
>>>>>
>>>>> --------------------------------------------------------------------------------------------
>>>>> Vec u;
>>>>> PetscRandom rand_ctx; /* random number generator context */
>>>>> PetscMPIInt size, rank;
>>>>> PetscInt n, dn;
>>>>>
>>>>>
>>>>> MPI_Comm_rank(PETSC_COMM_WORLD,&rank);//CHKERRQ(ierr);
>>>>> MPI_Comm_size(PETSC_COMM_WORLD,&size);//CHKERRQ(ierr);
>>>>> n = N/size + 1;
>>>>> dn = n*size - N;
>>>>> if ( dn>0 && rank<dn ) n -= 1;
>>>>> printf("--->test in petsc_random_vector(): rank = %d, n =
>>>>> %d\n",rank,n);
>>>>>
>>>>>
>>>>> VecCreate(PETSC_COMM_WORLD,&u);
>>>>> VecSetSizes(u,n,N);
>>>>> PetscRandomCreate(PETSC_COMM_WORLD, &rand_ctx);
>>>>> #if defined(PETSC_HAVE_DRAND48)
>>>>> PetscRandomSetType(rand_ctx,PETSCRAND48);
>>>>> #elif defined(PETSC_HAVE_RAND)
>>>>> PetscRandomSetType(rand_ctx,PETSCRAND);
>>>>> #endif
>>>>> PetscRandomSetFromOptions(rand_ctx);
>>>>>
>>>>>
>>>>> VecSetRandom(u,rand_ctx);
>>>>> PetscRandomDestroy(&rand_ctx);
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> 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
>>>>
>>>
>>>
>>
>>
>> --
>> 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150817/dd764dcd/attachment-0001.html>
More information about the petsc-users
mailing list