c++ - Unable to generate makefile for basic PETSc program -
i have basic program using petsc
#include "petsc/petsc.h" #include "petsc/petscsys.h" #include "petsc/petscmat.h" int main(int argc, char *argv[]) { petscmpiint rank,size; petscinitialize(&argc,&argv,0,0); mpi_comm_size(petsc_comm_world,&size); mpi_comm_rank(petsc_comm_world,&rank); petscprintf(petsc_comm_world,"number of processors = %d, rank = %d\n",size,rank); petscsynchronizedprintf(petsc_comm_world,"synchronized rank = %d\n",rank); mpi_barrier(petsc_comm_world); petscfinalize(); return 0; }
however, got undefined reference errors petsc_comm_world
, petscinitialize
, other junk, when tried compile using mpic++
i trying use build
, cmake. attempt @ cmakelists
cmake_minimum_required(version 2.8) project(checkmpi) set(cmake_module_path "${cmake_source_dir}/cmake-modules") set(petsc_arch linux-gnu) set(petsc_dir l${project_source_dir}/third-party/petsc) find_package(petsc required) include_directories(${petsc_includes}) add_definitions(${petsc_definitions}) add_executable(checkmpi checkmpi.cpp) target_link_libraries(checkmpi ${petsc_libraries})
in addition, have directory cmake-modules
containing cmake-modules petsc
however, when try generate makefile typing ccmake ..
, c
, output
cmake error @ cmake-modules/findpetsc.cmake:127 (message): pair petsc_dir=l/directory/hpc/third-party/petsc petsc_arch=linux-gnu not specify valid petsc installation call stack (most recent call first): cmakelists.txt:10 (find_package) cmake error @ /usr/share/cmake/modules/findpackagehandlestandardargs.cmake:108 (message): petsc not found. sure set petsc_dir , petsc_arch. (missing: petsc_includes petsc_libraries petsc_executable_runs) call stack (most recent call first): /usr/share/cmake/modules/findpackagehandlestandardargs.cmake:315
anyone can help?
based on findpetsc.cmake seems default options petsc_arch
are:
linux-gnu-c-debug linux-gnu-c-opt x86_64-unknown-linux-gnu i386-unknown-linux-gnu
or 1 have used in case of manual build.
cmake tries find file ${petsc_dir}/${petsc_arch}/include/petscconf.h
or ${petsc_dir}/bmake/${petsc_arch}/petscconf.h
.
Comments
Post a Comment