[petsc-users] error: too few arguments to function call (PetscOptionsHasName)

huabel hu.ds.abel at icloud.com
Fri Apr 17 10:09:55 CDT 2020


Thanks.


> On Apr 17, 2020, at 22:46, Dave May <dave.mayhem23 at gmail.com> wrote:
> 
> 
> Please always use "reply-all" so that your messages go to the list.
> This is standard mailing list etiquette.  It is important to preserve
> threading for people who find this discussion later and so that we do
> not waste our time re-answering the same questions that have already
> been answered in private side-conversations.  You'll likely get an
> answer faster that way too.
> 
> 
> On Fri, 17 Apr 2020 at 09:20, huabel <hu.ds.abel at icloud.com <mailto:hu.ds.abel at icloud.com>> wrote:
> I have checked that manual, I mean why a new version release include old versions of petsc api, why not update them all to new version?
> 
> 
> I understand now. I thought that the code you couldn't compile was something you wrote, however I now see it is actually living in the PETSc src tree.
> I also note that PLogEvent.c also fails to compile for the same reason.
> 
> The fact the API change was not propagated throughout these two files in src/benchmarks (PetscMalloc.c and PLogEvent.c) is an oversight.
> 
> I am surprised that this did not get caught as: 
> (i) API changes are usually applied via smart scripting, 
> (ii) I imagined that the regression testing would have picked this up issue.
> These files were also broken in v 3.12.
> 
> Thanks for the bug report.
> 
> 
> 
> 
>  
> 
> 
>> On Apr 17, 2020, at 16:10, Dave May <dave.mayhem23 at gmail.com <mailto:dave.mayhem23 at gmail.com>> wrote:
>> 
>> Old versions of petsc had 3 args for this function, latest version expects 4 (as the compiler error indicates).
>> 
>> When in doubt as to what these args are, please refer to the extensive man pages. You can find them all here
>> 
>> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/singleindex.html <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/singleindex.html>
>> 
>> The page you want for this func is here
>> 
>> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscOptionsHasName.html <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscOptionsHasName.html>
>> 
>> Tip: It is wise to avoid performing a google search of the function name. It can bring you to the man page for an old version of petsc sometimes and this can lead to confusion. Best go directly to the URL above (or access the pages through the petsc web page) to ensure you are looking at the appropriate man pages
>> 
>> 
>> Thanks
>> Dave
>> 
>> 
>> 
>> On Fri 17. Apr 2020 at 09:43, huabel via petsc-users <petsc-users at mcs.anl.gov <mailto:petsc-users at mcs.anl.gov>> wrote:
>> Dear PETSc users,
>> 
>> I’m learn some base for PETSc , compile file src/benchmarks/PetscMalloc.c , get next error. (Use PETSc 3.13.0)
>> 
>> >pwd
>> src/benchmarks
>> 
>> >mpicc PetscMalloc.c 
>> PetscMalloc.c:53:49: error: too few arguments to function call, expected 4, have 3
>>   ierr = PetscOptionsHasName(NULL,"-malloc",&flg);CHKERRQ(ierr);
>>          ~~~~~~~~~~~~~~~~~~~                    ^
>> /usr/local/include/petscoptions.h:18:1: note: 'PetscOptionsHasName' declared here
>> PETSC_EXTERN PetscErrorCode PetscOptionsHasName(PetscOptions,const char[],const char[],PetscBool*);
>> ^
>> /usr/local/include/petscsys.h:106:24: note: expanded from macro 'PETSC_EXTERN'
>> #  define PETSC_EXTERN extern PETSC_VISIBILITY_PUBLIC
>>                        ^
>> 1 error generated.
>> 
>>  Thanks.
>>    Abel 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200417/b44fd355/attachment-0001.html>


More information about the petsc-users mailing list