From 93d0049ec918b0d53abe9b6affde52176571a1e7 Mon Sep 17 00:00:00 2001 From: Andreas Naumann <andreas.naumann@tu-dresden.de> Date: Wed, 24 Nov 2010 08:48:26 +0000 Subject: [PATCH] providing petsc directly now, dont know, if it works on deimos --- AMDiS/AMDiSConfig.cmake.in | 28 +++++++++++++++++++++++++++- AMDiS/AMDiSUse.cmake | 13 ++++++++++--- AMDiS/CMakeLists.txt | 11 +++++++---- AMDiS/src/parallel/StdMpi.cc | 2 +- 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/AMDiS/AMDiSConfig.cmake.in b/AMDiS/AMDiSConfig.cmake.in index f03f7fc5..087dae41 100644 --- a/AMDiS/AMDiSConfig.cmake.in +++ b/AMDiS/AMDiSConfig.cmake.in @@ -1,3 +1,30 @@ +#This configuration file is shipped with the great FEM-Toolbox AMDiS. +#It simplifies the configure of different amdis-version and sets some variables. +#We set the following variables: +# AMDiS_INCLUDE_DIR the amdis-directory only +# AMDiS_INCLUDE_DIRS all include directories (mtl, umfpack, parmetis, metis, ...) +# AMDiS_LIBRARIES the needed libraries +# AMDiS_LIBRARY_DIRS the link directories +# AMDiS_COMPILEFLAGS some compile flags for amdis +# +# +# For a fast start, you use this package in the following way +# simply look for it, possibly set the AMDiS directory +# find_package(AMDiS ) +# include(${AMDiS_USE_FILE}) +# add_executable(yourTarget <yourSources>) +# target_link_libraries(yourTarget ${AMDiS_LIBRARIES}) +# +# +#The AMDiS_USE_FILE adds the include and link-directories for amdis to cmake. +# +#If you use the parallel amdis-version, the AMDiS_USE_FILE also trys to detect +#the mpi and petsc configuration. If those versions don't fit your needs, +#you can change the corresponding directories, or simply do this work at your own +#and omit the AMDiS_USE_FILE. Then you also have to set the flags, include +#and library directories. + + #try to detect the AMDiS include directory find_file(_AMDiS_H AMDiS.h PATHS ${AMDiS_INCLUDE_DIR} ${AMDiS_DIR}/../../include/amdis/ /usr/include/amdis/) if(_AMDiS_H) @@ -31,7 +58,6 @@ set(AMDiS_NEED_PARMETIS @ENABLE_PARMETIS@) set(AMDiS_HAS_PARALLEL_DOMAIN @ENABLE_PARALLEL_DOMAIN@) set(AMDiS_NEED_UMFPACK @ENABLE_UMFPACK@) set(AMDiS_NEED_MKL @ENABLE_MKL@) -set(AMDiS_NEED_DUNE @ENABLE_DUNE@) set(AMDiS_USE_FILE ${AMDiS_DIR}/AMDiSUse.cmake) set(AMDiS_COMPILEFLAGS "@COMPILEFLAGS@") message("find-components: ${AMDiS_FIND_COMPONENTS}") diff --git a/AMDiS/AMDiSUse.cmake b/AMDiS/AMDiSUse.cmake index 6c36dfdb..f4404fc7 100644 --- a/AMDiS/AMDiSUse.cmake +++ b/AMDiS/AMDiSUse.cmake @@ -1,6 +1,3 @@ -link_directories(${AMDiS_LIBRARY_DIRS}) -include_directories(${AMDiS_INCLUDE_DIRS}) - #load mpi-compiler for use with parmetis and parallel_domain if(${AMDiS_HAS_PARALLEL_DOMAIN}) if(NOT ${AMDiS_NEED_PARMETIS}) @@ -12,5 +9,15 @@ if(${AMDiS_HAS_PARALLEL_DOMAIN}) CMAKE_FORCE_CXX_COMPILER(mpicxx "The MPI C++ compiler") CMAKE_FORCE_C_COMPILER(mpicc "The MPI C Compiler") endif(MPI_FOUND) + find_package(PETSc REQUIRED) + if(PETSC_FOUND) + list(APPEND AMDiS_LIBRARIES ${PETSC_LIBRARIES}) + list(APPEND AMDiS_INCLUDE_DIRS ${PETSC_INCLUDES}) + endif(PETSc_FOUND) endif(NOT ${AMDiS_NEED_PARMETIS}) endif(${AMDiS_HAS_PARALLEL_DOMAIN}) +#thats bad because it affects each target +add_definitions(${AMDiS_COMPILEFLAGS}) +link_directories(${AMDiS_LIBRARY_DIRS}) +include_directories(${AMDiS_INCLUDE_DIRS}) + diff --git a/AMDiS/CMakeLists.txt b/AMDiS/CMakeLists.txt index dc20b34e..07cddfbe 100644 --- a/AMDiS/CMakeLists.txt +++ b/AMDiS/CMakeLists.txt @@ -22,8 +22,9 @@ endif() #option(ENABLE_INTEL "use intel compiler" false) option(ENABLE_OPENMP "use openmp" false) option(ENABLE_PARALLEL_DOMAIN "use parallel domain decomposition" false) -SET(PETSC_DIR "" CACHE PATH "Petsc directory for parallel domain decomposition" ) -SET(PETSC_ARCH "" CACHE STRING "Petsc architecture") +set(ENABLE_PARMETIS off) +#SET(PETSC_DIR "" CACHE PATH "Petsc directory for parallel domain decomposition" ) +#SET(PETSC_ARCH "" CACHE STRING "Petsc architecture") option(ENABLE_UMFPACK "use umfpack solver" false) option(ENABLE_MKL "use the mkl" false) SET(MKL_DIR "" CACHE PATH "MKL directory") @@ -172,14 +173,15 @@ if(ENABLE_PARALLEL_DOMAIN) ${LIB_DIR}/ParMetis-3.1/libmetis.a DESTINATION lib/parmetis ) + set(ENABLE_PARMETIS ON) + find_package(PETSc REQUIRED) include_directories(${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include) SET(PARALLEL_DOMAIN_AMDIS_SRC ${SOURCE_DIR}/parallel/ParMetisPartitioner.cc ${SOURCE_DIR}/parallel/MeshDistributor.cc ${SOURCE_DIR}/parallel/StdMpi.cc ${SOURCE_DIR}/parallel/ParallelDebug.cc - ${SOURCE_DIR}/parallel/GlobalMatrixSolver.cc ${SOURCE_DIR}/parallel/MpiHelper.cc ${SOURCE_DIR}/parallel/ElementObjectData.cc ${SOURCE_DIR}/parallel/PetscSolver.cc) @@ -257,7 +259,8 @@ if(WIN32) SET(COMPILEFLAGS "${COMPILEFLAGS} -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS") endif(WIN32) message("compileflags: ${COMPILEFLAGS}") -SET_TARGET_PROPERTIES(amdis PROPERTIES COMPILE_FLAGS "${COMPILEFLAGS}") +#SET_TARGET_PROPERTIES(amdis PROPERTIES COMPILE_FLAGS "${COMPILEFLAGS}") +add_definitions(${COMPILEFLAGS}) if(ENABLE_MARMOT) Message("please set marmotcc manually") endif(ENABLE_MARMOT) diff --git a/AMDiS/src/parallel/StdMpi.cc b/AMDiS/src/parallel/StdMpi.cc index 73c93978..c22962b1 100644 --- a/AMDiS/src/parallel/StdMpi.cc +++ b/AMDiS/src/parallel/StdMpi.cc @@ -148,7 +148,7 @@ namespace AMDiS { while (pos < bufSize) { int codeSize = buf[pos++]; int nElements = buf[pos++]; - std::vector<unsigned long int> code; + std::vector<long long unsigned int> code; code.resize(codeSize); for (int i = 0; i < codeSize; i++) code[i] = buf[pos++]; -- GitLab