From a14ce9f2bfbb95756cef48b6cf66b3f2b88f190e Mon Sep 17 00:00:00 2001 From: Hamidreza Norouzi Date: Sun, 1 Oct 2023 20:18:10 +0330 Subject: [PATCH] corrections --- src/MPIParallelization/CMakeLists.txt | 33 ------- src/MPIParallelization/partitioning.cpp | 92 -------------------- src/MPIParallelization/partitioning.hpp | 110 ------------------------ 3 files changed, 235 deletions(-) delete mode 100644 src/MPIParallelization/CMakeLists.txt delete mode 100644 src/MPIParallelization/partitioning.cpp delete mode 100644 src/MPIParallelization/partitioning.hpp diff --git a/src/MPIParallelization/CMakeLists.txt b/src/MPIParallelization/CMakeLists.txt deleted file mode 100644 index 3bac9dbb..00000000 --- a/src/MPIParallelization/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -#add Zoltan -set(Zoltan_Install_DIR) -if(DEFINED ENV{Zoltan_DIR}) - set(Zoltan_Install_DIR $ENV{Zoltan_DIR}/build) -else() - set(Zoltan_Install_DIR $ENV{HOME}/PhasicFlow/Zoltan/build) -endif() -message(STATUS "Zoltan install directory is ${Zoltan_Install_DIR}") - -set(ZOLTAN_PREFIX "${Zoltan_Install_DIR}" CACHE STRING "Zoltan install directory") - -find_path(ZOLTAN_INCLUDE_DIR zoltan.h PATHS "${ZOLTAN_PREFIX}/include") - -message(STATUS "Zoltan include path: ${ZOLTAN_INCLUDE_DIR}") - -find_library(ZOLTAN_LIBRARY zoltan PATHS "${ZOLTAN_PREFIX}/lib") -message(STATUS "Zoltan lib path: ${ZOLTAN_LIBRARY}") - - -set(SourceFiles partitioning) - -set(link_libs Kokkos::kokkos phasicFlow PRIVATE MPI::MPI_CXX ${ZOLTAN_LIBRARY} -lm ) - -pFlow_add_library_install(MPIParallelization SourceFiles link_libs) -target_include_directories(MPIParallelization PRIVATE ${ZOLTAN_INCLUDE_DIR}) - - - - - - - - diff --git a/src/MPIParallelization/partitioning.cpp b/src/MPIParallelization/partitioning.cpp deleted file mode 100644 index a786a89c..00000000 --- a/src/MPIParallelization/partitioning.cpp +++ /dev/null @@ -1,92 +0,0 @@ - -#include "zoltan_cpp.h" - -#include "partitioning.hpp" -#include "error.hpp" -#include "streams.hpp" - -void pFlow::partitioning::freeZoltan() -{ - if(validPointers_) - { - Zoltan::LB_Free_Part(&importGlobalGids_, &importLocalGids_, - &importProcs_, &importToPart_); - - Zoltan::LB_Free_Part(&exportGlobalGids_, &exportLocalGids_, - &exportProcs_, &exportToPart_); - validPointers_ = false; - } - - zoltan_.release(); -} - - -pFlow::partitioning::partitioning(int argc, char *argv[], const box& globalBox) -: - globalBox_(globalBox) -{ - if(!zoltanInitialized__) - { - auto rc = Zoltan_Initialize(argc, argv, &version_); - if (rc != ZOLTAN_OK) - { - fatalErrorInFunction<<"Cannot initialize zoltan"<(MPI::COMM_WORLD); - - zoltan_->Set_Param("DEBUG_LEVEL", "0"); - zoltan_->Set_Param("LB_METHOD", "RCB"); - zoltan_->Set_Param("NUM_GID_ENTRIES", "1"); - zoltan_->Set_Param("NUM_LID_ENTRIES", "1"); - zoltan_->Set_Param("OBJ_WEIGHT_DIM", "0"); - zoltan_->Set_Param("RETURN_LISTS", "ALL"); - -} - -pFlow::partitioning::~partitioning() -{ - freeZoltan(); -} - -void pFlow::partitioning::printBox()const -{ - pOutput<< "localBox:" << localBox_<(data); - - *ierr = ZOLTAN_OK; - - return obj->numberOfPOints(); -} - - -void partitioning::getPointList( - void *data, - int sizeGID, - int sizeLID, - ZOLTAN_ID_PTR globalID, - ZOLTAN_ID_PTR localID, - int wgt_dim, - float *obj_wgts, - int *ierr) -{ - - auto* obj = static_cast(data); - *ierr = ZOLTAN_OK; - - for (int i=0; i< obj->numberOfPOints(); i++) - { - globalID[i] = obj->globalIDList()[i]; - localID[i] = i; - } -}*/ \ No newline at end of file diff --git a/src/MPIParallelization/partitioning.hpp b/src/MPIParallelization/partitioning.hpp deleted file mode 100644 index 5d6da480..00000000 --- a/src/MPIParallelization/partitioning.hpp +++ /dev/null @@ -1,110 +0,0 @@ -/*------------------------------- phasicFlow --------------------------------- - O C enter of - O O E ngineering and - O O M ultiscale modeling of - OOOOOOO F luid flow ------------------------------------------------------------------------------- - Copyright (C): www.cemf.ir - email: hamid.r.norouzi AT gmail.com ------------------------------------------------------------------------------- -Licence: - This file is part of phasicFlow code. It is a free software for simulating - granular and multiphase flows. You can redistribute it and/or modify it under - the terms of GNU General Public License v3 or any other later versions. - - phasicFlow is distributed to help others in their research in the field of - granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - ------------------------------------------------------------------------------*/ - -#ifndef __rcbPartitioning_hpp__ -#define __rcbPartitioning_hpp__ - -#include "box.hpp" -#include "processors.hpp" - - - -namespace pFlow -{ - -class Zoltan; - - -class partitioning -{ - -protected: - - float version_ = 0.0; - - std::unique_ptr zoltan_ = nullptr; - - bool validPointers_ = false; - - const box& globalBox_; - - box localBox_; - - int32 changes_, numImport_, numExport_; - - id_t* importGlobalGids_, importLocalGids_, exportGlobalGids_, exportLocalGids_; - - int32*importProcs_, *importToPart_, *exportProcs_, *exportToPart_; - - static inline bool zoltanInitialized__ = false; - - void freeZoltan(); - -public: - - partitioning(int argc, char *argv[], const box& globalBox); - - virtual - ~partitioning(); - - - virtual - bool partition() = 0; - - inline - auto localBox()const - { - return localBox_; - } - - inline - const auto& globalBox()const - { - return globalBox_; - } - - inline - bool partitionsChanged()const - { - return changes_ == 1; - } - - void printBox()const; - - /*static - int getNumberOfPoints(void *data, int32 *ierr); - - static - void getPointList( - void *data, - int32 sizeGID, - int32 sizeLID, - id_t* globalID, - id_t* localID, - int32 wgt_dim, - float *obj_wgts, - int32 *ierr);*/ -}; - - -} - - -#endif //__rcbPartitioning_hpp__ \ No newline at end of file