<div dir="ltr">Matt and Jed,<div><br></div><div>Thanks for your comments. </div><div><br></div><div>I still have a trouble in using FindPETSc.cmake. I removed the directory: (i.e. canceling <span style="font-size:12.8px">cp - r /home/evan/petsc//lib/petsc/</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">conf/rules /home/evan/petsc//l</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">ib/petsc/conf/petscrules) and explicitly set SET (PETSC_ARCH "arch-linux2-c-debug all").</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Now, FindPETSc.cmake does not recognize PETSC_DIR and PETSC_ARCH. When I read the comments inside FindPETSc.cmake, the twos should be refined by FindPETSc.cmake. </span><span style="font-size:12.8px">BTW, I have my petsc at /home/evan/petsc. So all are defaults.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Thanks for your kind help.</span></div><div><br></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Evan</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">--------------</span><br></div><div><div><span style="font-size:12.8px">cmake_minimum_required(VERSION 3.10)</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">project(hellopetsc)</span></div><div><span style="font-size:12.8px">list (APPEND CMAKE_MODULE_PATH /home/evan/CLionProjects/hellopetsc)</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">SET(CMAKE_CXX_STANDARD 11)</span></div><div><span style="font-size:12.8px">SET(CMAKE_C_COMPILER mpicc)</span></div><div><span style="font-size:12.8px">SET(CMAKE_CXX_COMPILER mpicxx)</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">SET (PETSC_ARCH "arch-linux2-c-debug all")</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">find_package(PETSc COMPONENTS CXX)</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">add_executable(hellopetsc main.cpp)</span></div><div>--------------</div><div><div>/home/evan/opt/clion-2018.1.2/bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /home/evan/CLionProjects/hellopetsc</div><div>CMake Error at FindPETSc.cmake:140 (message):</div><div>  The pair PETSC_DIR=/home/evan/petsc PETSC_ARCH=arch-linux2-c-debug all do</div><div>  not specify a valid PETSc installation</div><div>Call Stack (most recent call first):</div><div>  CMakeLists.txt:12 (find_package)</div><div><br></div><div><br></div><div>-- PETSc could not be found.  Be sure to set PETSC_DIR and PETSC_ARCH. (missing: PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS) (found version "3.9.1")</div><div>-- Configuring incomplete, errors occurred!</div><div>See also "/home/evan/CLionProjects/hellopetsc/cmake-build-debug/CMakeFiles/CMakeOutput.log".</div><div>See also "/home/evan/CLionProjects/hellopetsc/cmake-build-debug/CMakeFiles/CMakeError.log".</div><div><br></div><div>[Finished]</div></div><div>--------------</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 11, 2018 at 2:13 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Fri, May 11, 2018 at 5:06 PM, Evan Um <span dir="ltr"><<a href="mailto:evanum@gmail.com" target="_blank">evanum@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Hi Jed,</span><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Thanks for the comment. I added the module but still saw errors (before I arrived here, I had to do cp - r /home/evan/petsc//lib/petsc/<wbr>conf/rules /home/evan/petsc//l<wbr>ib/petsc/conf/petscrules). </div></div></blockquote><div><br></div></span><div>That is wrong. It means PETSC_ARCH is (null) instead of the correct string.</div><div><br></div><div>   Matt</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">They are supposed to be defined by FindPETSc.cmake. How could I solve these errors? </div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Could you also explain a little bit about how to use pkg-config to find PETSc? Thanks!</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Evan</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">----------------</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div>cmake_minimum_required(VERSION 3.10)</div><div><br></div><div>project(hellopetsc)</div><div>list (APPEND CMAKE_MODULE_PATH /home/evan/CLionProjects/hello<wbr>petsc)</div><span class="m_-6969308871950949466m_-911485448018424950gmail-im" style="color:rgb(80,0,80)"><div><br></div><div>SET(CMAKE_CXX_STANDARD 11)</div><div>SET(CMAKE_C_COMPILER mpicc)</div><div>SET(CMAKE_CXX_COMPILER mpicxx)</div><div><br></div></span><div>find_package(PETSc COMPONENTS CXX)</div><div><br></div><div>add_executable(hellopetsc main.cpp)</div></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">-----------------</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">-----------------</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span class="m_-6969308871950949466m_-911485448018424950gmail-im" style="color:rgb(80,0,80)"><div>/home/evan/opt/clion-2018.1.2/<wbr>bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /home/evan/CLionProjects/hello<wbr>petsc</div></span><div>-- PETSc could not be found.  Be sure to set PETSC_DIR and PETSC_ARCH. (missing: PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS) (found version "3.9.1")</div><div>-- Configuring done</div><div>-- Generating done</div><div>-- Build files have been written to: /home/evan/CLionProjects/hello<wbr>petsc/cmake-build-debug</div><div><br></div><div>[Finished]</div></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">-----------------</div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 11, 2018 at 12:08 PM, Jed Brown <span dir="ltr"><<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes, it depends on this module from the same repository.<br>
<br>
Note that you can use pkg-config to find PETSc these days.<br>
<div class="m_-6969308871950949466m_-911485448018424950HOEnZb"><div class="m_-6969308871950949466m_-911485448018424950h5"><br>
Evan Um <<a href="mailto:evanum@gmail.com" target="_blank">evanum@gmail.com</a>> writes:<br>
<br>
> Hi Stefano,<br>
><br>
> Thanks for your comment. Now, cmake was able to locate FindPETSc.cmake file<br>
> in my project directory, but I see a new error.<br>
><br>
> Evan<br>
><br>
><br>
> Messages<br>
> ------------------------------<wbr>----------------<br>
> /home/evan/opt/clion-2018.1.2/<wbr>bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug<br>
> -G "CodeBlocks - Unix Makefiles" /home/evan/CLionProjects/hello<wbr>petsc<br>
> CMake Error at FindPETSc.cmake:123 (include):<br>
>   include could not find load file:<br>
><br>
>     FindPackageMultipass<br>
> Call Stack (most recent call first):<br>
>   CMakeLists.txt:10 (find_package)<br>
><br>
><br>
> CMake Error at FindPETSc.cmake:124 (find_package_multipass):<br>
>   Unknown CMake command "find_package_multipass".<br>
> Call Stack (most recent call first):<br>
>   CMakeLists.txt:10 (find_package)<br>
><br>
><br>
> -- Configuring incomplete, errors occurred!<br>
> See also<br>
> "/home/evan/CLionProjects/hell<wbr>opetsc/cmake-build-debug/CMake<wbr>Files/CMakeOutput.log".<br>
> See also<br>
> "/home/evan/CLionProjects/hell<wbr>opetsc/cmake-build-debug/CMake<wbr>Files/CMakeError.log".<br>
> ------------------------------<wbr>----------------<br>
><br>
> CMakeLists.txt<br>
> ------------------------------<wbr>----------------<br>
> /home/evan/opt/clion-2018.1.2/<wbr>bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug<br>
> -G "CodeBlocks - Unix Makefiles" /home/evan/CLionProjects/hello<wbr>petsc<br>
> CMake Error at FindPETSc.cmake:123 (include):<br>
>   include could not find load file:<br>
><br>
>     FindPackageMultipass<br>
> Call Stack (most recent call first):<br>
>   CMakeLists.txt:10 (find_package)<br>
><br>
><br>
> CMake Error at FindPETSc.cmake:124 (find_package_multipass):<br>
>   Unknown CMake command "find_package_multipass".<br>
> Call Stack (most recent call first):<br>
>   CMakeLists.txt:10 (find_package)<br>
><br>
><br>
> -- Configuring incomplete, errors occurred!<br>
> See also<br>
> "/home/evan/CLionProjects/hell<wbr>opetsc/cmake-build-debug/CMake<wbr>Files/CMakeOutput.log".<br>
> See also<br>
> "/home/evan/CLionProjects/hell<wbr>opetsc/cmake-build-debug/CMake<wbr>Files/CMakeError.log".<br>
><br>
> [Finished]<br>
><br>
><br>
><br>
> On Fri, May 11, 2018 at 11:34 AM, Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a><br>
>> wrote:<br>
><br>
>> CMAKE is case sensitive on this. You should use find_package(PETSc ….)<br>
>><br>
>><br>
>> > On May 11, 2018, at 9:28 PM, Evan Um <<a href="mailto:evanum@gmail.com" target="_blank">evanum@gmail.com</a>> wrote:<br>
>> ><br>
>> > Hi,<br>
>> ><br>
>> > I would like to ask a question about FindPETSc.cmake. I place the cmake<br>
>> file in the same directory where main.cpp is placed. I also placed the file<br>
>> in /usr/share/cmake_xx/Modules.<br>
>><br>
>> Actually, it can be put in any directory pointed by the variable<br>
>> CMAKE_MODULE_PATH. If I were you, I would not modify /usr/share/<br>
>><br>
>> > Where should i put the file? What else should I do to use the file in<br>
>> cmake? Do I need any other lines in my cmakelists.txt except<br>
>> find_package(petsc)? Thanks for your comments.<br>
>> ><br>
>> > Evan<br>
>> ><br>
>> > ------------------------------<wbr>------------------------------<wbr>-<br>
>> ><br>
>> > cmake_minimum_required(VERSION 3.10)<br>
>> ><br>
>> > project(hellopetsc)<br>
>> ><br>
>> > SET(CMAKE_CXX_STANDARD 11)<br>
>> > SET(CMAKE_C_COMPILER mpicc)<br>
>> > SET(CMAKE_CXX_COMPILER mpicxx)<br>
>> ><br>
>> > find_package(PETSC COMPONENTS CXX)<br>
>> ><br>
>> > add_executable(hellopetsc main.cpp)<br>
>> ><br>
>> > ------------------------------<wbr>------------------------------<br>
>> > CMake Warning at CMakeLists.txt:9 (find_package):<br>
>> >   By not providing "FindPETSC.cmake" in CMAKE_MODULE_PATH this project<br>
>> has<br>
>> >   asked CMake to find a package configuration file provided by "PETSC",<br>
>> but<br>
>> >   CMake did not find one.<br>
>> ><br>
>> >   Could not find a package configuration file provided by "PETSC" with<br>
>> any of<br>
>> >   the following names:<br>
>> ><br>
>> >     PETSCConfig.cmake<br>
>> >     petsc-config.cmake<br>
>> ><br>
>> >   Add the installation prefix of "PETSC" to CMAKE_PREFIX_PATH or set<br>
>> >   "PETSC_DIR" to a directory containing one of the above files.  If<br>
>> "PETSC"<br>
>> >   provides a separate development package or SDK, be sure it has been<br>
>> >   installed.<br>
>><br>
>><br>
</div></div></blockquote></div><br></div>
</blockquote></div></div></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_-6969308871950949466gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~<wbr>knepley/</a><br></div></div></div></div></div>
</font></span></div></div>
</blockquote></div><br></div>