[petsc-dev] usage of Malloc2 at VecScatterCopy_MPI_ToAll

Barry Smith bsmith at mcs.anl.gov
Fri Jul 9 20:07:37 CDT 2010


  Hmm, looks like we could use a Malloc3() there :-) Even better.


   Barry

On Jul 9, 2010, at 8:00 PM, Lisandro Dalcin wrote:

> On 9 July 2010 21:26, Barry Smith <bsmith at mcs.anl.gov> wrote:
>> 
>>  I consider this bogus warnings.
>> 
> 
> I agree on that. My point is the actual usage of Malloc2.
> 
>  ierr                =
> PetscMalloc2(1,VecScatter_MPI_ToAll,&sto,size,PetscMPIInt,&sto->count);CHKERRQ(ierr);
>  ierr                =
> PetscMalloc(size*sizeof(PetscMPIInt),&sto->displx);CHKERRQ(ierr);
> 
> What's the point of allocating 1 struct + size ints, and next size
> more ints? I would use Malloc for the struct, and then Malloc2 for the
> two arrays.
> 
> 
>>   Barry
>> 
>> On Jul 9, 2010, at 7:22 PM, Lisandro Dalcin wrote:
>> 
>>> While building with nvcc, I looked at this warning:
>>> 
>>> libfast in: /usr/local/petsc/dev/src/vec/vec/utils
>>> vscat.c(322): warning: variable "sto" is used before its value is set
>>> 
>>> Do we really need to use Malloc2 in such line? Perhaps we should
>>> actually use Malloc2 for sto->count and sto->displx ?
>>> 
>>> --
>>> Lisandro Dalcin
>>> ---------------
>>> CIMEC (INTEC/CONICET-UNL)
>>> Predio CONICET-Santa Fe
>>> Colectora RN 168 Km 472, Paraje El Pozo
>>> Tel: +54-342-4511594 (ext 1011)
>>> Tel/Fax: +54-342-4511169
>> 
>> 
> 
> 
> 
> -- 
> Lisandro Dalcin
> ---------------
> CIMEC (INTEC/CONICET-UNL)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> Tel: +54-342-4511594 (ext 1011)
> Tel/Fax: +54-342-4511169




More information about the petsc-dev mailing list