[petsc-users] Question - about the 'Hint for performance tuning'

Matthew Knepley knepley at gmail.com
Tue Jan 3 09:18:33 CST 2023


On Tue, Jan 3, 2023 at 10:09 AM 김성익 <ksi2443 at gmail.com> wrote:

> 2023년 1월 3일 (화) 오후 9:46, Matthew Knepley <knepley at gmail.com>님이 작성:
>
>> On Tue, Jan 3, 2023 at 7:22 AM 김성익 <ksi2443 at gmail.com> wrote:
>>
>>>
>>>
>>> 2023년 1월 3일 (화) 오후 8:55, Matthew Knepley <knepley at gmail.com>님이 작성:
>>>
>>>> On Tue, Jan 3, 2023 at 12:48 AM 김성익 <ksi2443 at gmail.com> wrote:
>>>>
>>>>> I got more questions so I resend this email with more questions.
>>>>>
>>>>> 1.After reconfigure by
>>>>> ./arch-main-debug/lib/petsc/conf/reconfigure-arch-main-debug.py
>>>>> --with-debugging=0 --PETSC_ARCH=arch-main-opt ,
>>>>> I tried to build my code.
>>>>>
>>>>> But I got an error as below
>>>>> [image: image.png]
>>>>> How can I fix this?
>>>>>
>>>>
>>>> You reconfigured with PETSC_ARCH=arch-main-opt, but your build is using
>>>> "arch-linux-c-opt". Why are you changing it?
>>>>
>>>
>>> At first Matthew told me use
>>> './arch-main-debug/lib/petsc/conf/reconfigure-arch-main-debug.py
>>> --with-debugging=0 --PETSC_ARCH=arch-main-opt' for build optimized.
>>> However, I got an error the error is as below.
>>>
>>
>> No, I did not say that. Here is the quote:
>>
>>   Suppose your current arch is named "arch-main-debug".
>>
>> But your arch was not arch-imain-debug. Instead it was
>> arch-linux-c-debug, which you used.
>>
>> [image: image.png]
>>> So Barry told me : "The previous value of PETSC_ARCH was not
>>> arch-main-debug do ls $PETSC_DIR and locate the directory whose name begins
>>> with arch- that will tell you the previous value used for PETSC_ARCH."
>>> So I used
>>> "./arch-linux-c-debug/lib/petsc/conf/reconfigure-arch-linux-c-debug.py
>>> --with-debugging=0 --PETSC_ARCH=arch-linux-c-opt"
>>> That command worked. However I got an error when I build my code and the
>>> error is as below.
>>>
>>
>> Your build is saying that the library does not exist. After
>> configuration, did you build the library?
>>
>>   cd $PETSC_DIR
>>   PETSC_ARCH=arch-linux-c-opt make all
>>
>
> You are Right I didn't do build. So following your comments, I did build.
> But, there are some errors when build my own code.
> It didn't happen when in debug mode, but the following error occurred.
> [image: image.png]
> What could be the reason and how to fix it?
>

It sounds like you may have had an old *.o file which you compiled with the
debug architecture. Remove all those and rebuild your project.

  Thanks,

    Matt


>
>>
>>> [image: image.png]
>>>
>>>
>>>>
>>>>>
>>>>> 2.
>>>>>
>>>>> CFLAGS       = -O3
>>>>> FFLAGS       =
>>>>> CPPFLAGS         =
>>>>> FPPFLAGS         =
>>>>> COPTFLAGS        = -march=native
>>>>>
>>>>>
>>>>> app : a1.o a2.o a3.o a4.o
>>>>>    $(LINK.C) -o $@ $^ $(LDLIBS)
>>>>>
>>>>>
>>>>> include ${PETSC_DIR}/lib/petsc/conf/rules
>>>>> include ${PETSC_DIR}/lib/petsc/conf/test
>>>>>
>>>>> Upper makefile is just for build my own code not for src of petsc.
>>>>> In this case, also has problem as your comments?
>>>>>
>>>>
>>>> I do not understand your question.
>>>>
>>>
>>> My questions is :
>>> When building my own code without reconfigure of PETSc, I wonder if
>>> there will be performance improvement by building with the high
>>> optimization level of compiler even if the makefile is configured as above.
>>>
>>
>> If significant time is spent in your code rather than PETSc, it is
>> possible.
>>
>>
>>>
>>>>
>>>>>
>>>>> 3.  I have no such processors. Where can I find benchmark information
>>>>> about STREAMS?
>>>>>  I mean I don't have such various processors. So I just wondering the
>>>>> results of STREAMS each processors (already existing results of various
>>>>> processors).
>>>>> Can anyone have results of benchmark of various desktop systems?
>>>>>
>>>>
>>>> There are catalogues of STREAMS results online.
>>>>
>>>
>>> Sorry, I can't find proper catalogues. What's the keyword for googling
>>> or could you please give a link of catalogues?
>>>
>>
>> https://www.cs.virginia.edu/stream/
>>
>>   Thanks,
>>
>>      Matt
>>
>>
>>> Thanks,
>>> Hyung Kim
>>>
>>>
>>>
>>>>
>>>>   Thanks,
>>>>
>>>>      Matt
>>>>
>>>>
>>>>> Thanks,
>>>>> Hyung Kim
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> 2023년 1월 3일 (화) 오후 2:19, 김성익 <ksi2443 at gmail.com>님이 작성:
>>>>>
>>>>>> After reconfigure by
>>>>>> ./arch-main-debug/lib/petsc/conf/reconfigure-arch-main-debug.py
>>>>>> --with-debugging=0 --PETSC_ARCH=arch-main-opt ,
>>>>>> I tried to build my code.
>>>>>>
>>>>>> But I got an error as below
>>>>>> [image: image.png]
>>>>>> How can I fix this?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> 2023년 1월 3일 (화) 오전 4:05, Barry Smith <bsmith at petsc.dev>님이 작성:
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Jan 2, 2023, at 9:27 AM, 김성익 <ksi2443 at gmail.com> wrote:
>>>>>>>
>>>>>>> There are more questions.
>>>>>>>
>>>>>>> 1. Following your comments, but there is an error as below.
>>>>>>> <image.png>
>>>>>>> How can I fix this?
>>>>>>>
>>>>>>>
>>>>>>>    The previous value of PETSC_ARCH was not arch-main-debug do ls
>>>>>>> $PETSC_DIR and locate the directory whose name begins with arch- that will
>>>>>>> tell you the previous value used for PETSC_ARCH.
>>>>>>>
>>>>>>>
>>>>>>> 2. After changing the optimized build, then how can I set the debug
>>>>>>> mode again?
>>>>>>>
>>>>>>>
>>>>>>>    export PETSC_ARCH=arch- whatever the previous value was and then
>>>>>>> recompile your code (note you do not need to recompile PETSc just your
>>>>>>> executable).
>>>>>>>
>>>>>>>
>>>>>>> 3.Following your comments, the new makefile is as below. Is it right?
>>>>>>> CFLAGS       = -O3
>>>>>>> FFLAGS       =
>>>>>>> CPPFLAGS         =
>>>>>>> FPPFLAGS         =
>>>>>>> COPTFLAGS        = -march=native
>>>>>>>
>>>>>>>
>>>>>>> app : a1.o a2.o a3.o a4.o
>>>>>>>    $(LINK.C) -o $@ $^ $(LDLIBS)
>>>>>>>
>>>>>>>
>>>>>>> include ${PETSC_DIR}/lib/petsc/conf/rules
>>>>>>> include ${PETSC_DIR}/lib/petsc/conf/test
>>>>>>>
>>>>>>>
>>>>>>> Best not to set these values in the makefile at all because they
>>>>>>> will affect all compilers. Just set them with ./configure CCOPTFLAGS="-O3
>>>>>>> -march=native"
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 4. I have no such processors. Where can I find benchmark information
>>>>>>> about STREAMS?
>>>>>>>
>>>>>>>
>>>>>>>   do make mpistreams in PETSC_DIR
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Hyung Kim
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 2023년 1월 2일 (월) 오후 11:03, Matthew Knepley <knepley at gmail.com>님이 작성:
>>>>>>>
>>>>>>>> On Mon, Jan 2, 2023 at 4:16 AM 김성익 <ksi2443 at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> Happy new year!!
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I have some questions about “Hint for performance tuning” in user
>>>>>>>>> guide of petsc.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 1.     In the “Performance Pitfalls and Advice” section, there
>>>>>>>>> are 2 modes “debug” and “optimized builds. My current setup is debug mode.
>>>>>>>>> So I want to change for test the performance the optimized build mode.
>>>>>>>>> However, if I configure again, does the existing debug mode disappear? Is
>>>>>>>>> there any way to coexist the 2 modes and use them in the run the
>>>>>>>>> application?
>>>>>>>>>
>>>>>>>> Suppose your current arch is named "arch-main-debug". Then you can
>>>>>>>> make an optimized version using
>>>>>>>>
>>>>>>>>   cd $PETSC_DIR
>>>>>>>>   ./arch-main-debug/lib/petsc/conf/reconfigure-arch-main-debug.py
>>>>>>>> --with-debugging=0 --PETSC_ARCH=arch-main-opt
>>>>>>>>
>>>>>>>>
>>>>>>>>> 2.     In the guide, there are some paragraphs about optimization
>>>>>>>>> level of compiler. To control the optimization level of compiler, I put the
>>>>>>>>> ‘-O3’ as below. Is this right??
>>>>>>>>> CFLAGS       = -O3
>>>>>>>>> FFLAGS       =
>>>>>>>>> CPPFLAGS         =
>>>>>>>>> FPPFLAGS         =
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> app : a1.o a2.o a3.o a4.o
>>>>>>>>>    $(LINK.C) -o $@ $^ $(LDLIBS)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> include ${PETSC_DIR}/lib/petsc/conf/rules
>>>>>>>>> include ${PETSC_DIR}/lib/petsc/conf/test
>>>>>>>>>
>>>>>>>>
>>>>>>>> You could dp this, but that only changes it for that directory. It
>>>>>>>> is best to do it by reconfiguring.
>>>>>>>>
>>>>>>>>
>>>>>>>>> 3.     In the guide, user should put ‘-march=native’ for using
>>>>>>>>> AVX2 or AVX-512. Where should I put the ‘-march=native’ for using AVX?
>>>>>>>>>
>>>>>>>> You can add --COPTFLAGS="<user flags>" with any flags you want to
>>>>>>>> the configure.
>>>>>>>>
>>>>>>>> 4.     After read the “Hint for performance tuning” I understood
>>>>>>>>> that for good performance and scalability user should use the multiple node
>>>>>>>>> and multiple socket . However, before composing cluster system, many users
>>>>>>>>> just can use desktop system.
>>>>>>>>> In that case, between intel 13th i9 and amd ryzen 7950x, can the
>>>>>>>>> 7950x, which has an arichitecture similar to the server processor, be more
>>>>>>>>> suitable for petsc? (Because the architecture of intel desktop cpu is
>>>>>>>>> big.little.)
>>>>>>>>>
>>>>>>>>
>>>>>>>> A good guide is to run the STREAMS benchmark on the processor.
>>>>>>>> PETSc performance closely tracks that.
>>>>>>>>
>>>>>>>>   Thanks,
>>>>>>>>
>>>>>>>>      Matt
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>>
>>>>>>>>> Hyung Kim
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> 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
>>>>>>>>
>>>>>>>> https://www.cse.buffalo.edu/~knepley/
>>>>>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>
>>>> --
>>>> 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
>>>>
>>>> https://www.cse.buffalo.edu/~knepley/
>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>
>>>
>>
>> --
>> 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
>>
>> https://www.cse.buffalo.edu/~knepley/
>> <http://www.cse.buffalo.edu/~knepley/>
>>
>

-- 
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

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230103/c0a1f3a0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 320891 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230103/c0a1f3a0/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 75744 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230103/c0a1f3a0/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 192554 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230103/c0a1f3a0/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 42231 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230103/c0a1f3a0/attachment-0007.png>


More information about the petsc-users mailing list