merge complete / cpu tests

This commit is contained in:
James McClure 2021-01-06 11:58:43 -05:00
parent 7f4f74779c
commit 64b49f720e
26 changed files with 128 additions and 143 deletions

View File

@ -1,6 +1,6 @@
#include "IO/PIO.h"
#include "common/Utilities.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include <fstream>
#include <string>

View File

@ -1,6 +1,6 @@
#include "IO/silo.h"
#include "common/Utilities.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "ProfilerApp.h"

View File

@ -6,7 +6,7 @@
#include <array>
#include "common/Array.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "common/Communication.h"

View File

@ -3,7 +3,7 @@
#include "IO/silo.h"
#include "common/Utilities.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "ProfilerApp.h"

View File

@ -8,7 +8,7 @@
#include <vector>
#include "common/Domain.h"
#include "common/Utilities.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "common/Communication.h"
#include "analysis/analysis.h"
#include "analysis/distance.h"

View File

@ -10,7 +10,7 @@
#include "common/Communication.h"
#include "analysis/analysis.h"
#include "common/Utilities.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "IO/MeshDatabase.h"
#include "IO/Reader.h"
#include "IO/Writer.h"

View File

@ -12,7 +12,7 @@
#include "analysis/distance.h"
#include "analysis/Minkowski.h"
#include "common/Utilities.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "IO/MeshDatabase.h"
#include "IO/Reader.h"
#include "IO/Writer.h"

View File

@ -9,7 +9,7 @@
#include "common/Array.h"
#include "common/Utilities.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "common/Communication.h"
#include "common/Database.h"
#include "common/SpherePack.h"

View File

@ -12,7 +12,7 @@
#include "common/Array.h"
#include "common/Utilities.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "common/Communication.h"
#include "common/Database.h"

View File

@ -12,7 +12,7 @@ Implementation of color lattice boltzmann model
#include "common/Communication.h"
#include "analysis/TwoPhase.h"
#include "analysis/runAnalysis.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "ProfilerApp.h"
#include "threadpool/thread_pool.h"

View File

@ -11,7 +11,7 @@ Implementation of two-fluid greyscale color lattice boltzmann model
#include "common/Communication.h"
#include "analysis/GreyPhase.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "ProfilerApp.h"
#include "threadpool/thread_pool.h"

View File

@ -10,7 +10,7 @@ Implementation of color lattice boltzmann model
#include <fstream>
#include "common/Communication.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "common/Database.h"
#include "common/ScaLBL.h"
#include "ProfilerApp.h"

View File

@ -13,7 +13,7 @@
#include "common/ScaLBL.h"
#include "common/Communication.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "analysis/Minkowski.h"
#include "ProfilerApp.h"

View File

@ -7,7 +7,7 @@
#include <iostream>
#include <fstream>
#include "common/ScaLBL.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "models/ColorModel.h"
std::shared_ptr<Database> loadInputs( int nprocs )

View File

@ -1,5 +1,5 @@
#include <iostream>
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "common/Utilities.h"
#include "common/ScaLBL.h"

View File

@ -21,7 +21,8 @@ int main (int argc, char *argv[])
Utilities::startup( argc, argv );
Utilities::MPI comm( MPI_COMM_WORLD );
int rank = comm.getRank();
int toReturn = 0;
{
// Load inputs
string FILENAME = argv[1];
// Load inputs
@ -114,7 +115,6 @@ int main (int argc, char *argv[])
printf("-------------------------------- \n");
//.........................................................................
int toReturn = 0;
if (fabs(Averages->awn - 2*PI*RADIUS*RADIUS)/(2*PI*RADIUS*RADIUS) > 0.02){
toReturn = 1;
printf("TestCylinderArea.cpp: error tolerance exceeded for wn area \n");
@ -144,9 +144,8 @@ int main (int argc, char *argv[])
toReturn = 7;
}
return toReturn;
comm.barrier();
return 0;
Utilities::shutdown();
}
Utilities::shutdown();
return toReturn;
}

View File

@ -23,21 +23,22 @@ int main(int argc, char **argv)
Utilities::startup( argc, argv );
{ // Limit scope so variables that contain communicators will free before MPI_Finialize
MPI_Comm comm;
MPI_Comm_dup(MPI_COMM_WORLD,&comm);
int rank = comm_rank(comm);
int nprocs = comm_size(comm);
// Initialize MPI
Utilities::startup( argc, argv );
Utilities::MPI comm( MPI_COMM_WORLD );
int rank = comm.getRank();
int nprocs = comm.getSize();
if (rank == 0){
printf("**************************************\n");
printf("Running Test for Ion Transport \n");
printf("**************************************\n");
}
// Initialize compute device
ScaLBL_SetDevice(rank);
ScaLBL_DeviceBarrier();
MPI_Barrier(comm);
// Initialize compute device
int device=ScaLBL_SetDevice(rank);
NULL_USE( device );
ScaLBL_DeviceBarrier();
comm.barrier();
PROFILE_ENABLE(1);
//PROFILE_ENABLE_TRACE();
@ -62,7 +63,6 @@ int main(int argc, char **argv)
IonModel.DummyFluidVelocity();
IonModel.DummyElectricField();
int timestep=0;
double error = 1.0;
vector<double>ci_avg_previous{0.0,0.0};//assuming 1:1 solution
@ -85,8 +85,7 @@ int main(int argc, char **argv)
PROFILE_SAVE("TestIonModel",1);
// ****************************************************
MPI_Barrier(comm);
MPI_Comm_free(&comm);
comm.barrier();
} // Limit scope so variables that contain communicators will free before MPI_Finialize

View File

@ -8,7 +8,7 @@
#include <fstream>
#include "common/ScaLBL.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "models/ColorModel.h"
inline void InitializeBubble(ScaLBL_ColorModel &ColorModel, double BubbleRadius){

View File

@ -1,6 +1,6 @@
// Test reading high-resolution files from the microct database
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "common/UnitTest.h"
#include "common/Database.h"
#include "common/Domain.h"
@ -13,12 +13,14 @@
void testReadMicroCT( const std::string& filename, UnitTest& ut )
{
Utilities::MPI comm( MPI_COMM_WORLD );
// Get the domain info
auto db = std::make_shared<Database>( filename );
auto domain_db = db->getDatabase( "Domain" );
// Test reading microCT files
auto data = readMicroCT( *domain_db, MPI_COMM_WORLD );
auto data = readMicroCT( *domain_db, comm );
// Check if we loaded the data correctly
if ( data.size() == domain_db->getVector<size_t>( "n" ) )
@ -30,7 +32,7 @@ void testReadMicroCT( const std::string& filename, UnitTest& ut )
auto n = domain_db->getVector<int>( "n" );
auto nproc = domain_db->getVector<int>( "nproc" );
int N[3] = { n[0]*nproc[0], n[1]*nproc[1], n[2]*nproc[2] };
int rank = comm_rank(MPI_COMM_WORLD);
int rank = comm.getRank();
RankInfoStruct rankInfo( rank, nproc[0], nproc[1], nproc[2] );
std::vector<IO::MeshDataStruct> meshData( 1 );
auto Var = std::make_shared<IO::Variable>();
@ -41,7 +43,7 @@ void testReadMicroCT( const std::string& filename, UnitTest& ut )
meshData[0].meshName = "grid";
meshData[0].mesh = std::make_shared<IO::DomainMesh>(rankInfo,n[0],n[1],n[2],N[0],N[1],N[2]);
meshData[0].vars.push_back(Var);
IO::writeData( 0, meshData, MPI_COMM_WORLD );
IO::writeData( 0, meshData, comm );
}

View File

@ -1,24 +1,25 @@
#include <iostream>
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "common/Utilities.h"
#include "common/ScaLBL.h"
int main (int argc, char **argv)
{
MPI_Init(&argc,&argv);
int rank = MPI_WORLD_RANK();
int nprocs = MPI_WORLD_SIZE();
{
Utilities::startup( argc, argv );
Utilities::MPI comm( MPI_COMM_WORLD );
int rank = comm.getRank();
int nprocs = comm.getSize();
for (int i=0; i<nprocs; i++) {
if ( rank==i )
printf("%i of %i: Hello world\n",rank,nprocs);
MPI_Barrier(MPI_COMM_WORLD);
comm.barrier();
}
// Initialize compute device
ScaLBL_SetDevice(rank);
ScaLBL_DeviceBarrier();
MPI_Barrier(MPI_COMM_WORLD);
comm.barrier();
// Create a memory leak for valgrind to find
if ( nprocs==1 ) {
@ -29,9 +30,6 @@ int main (int argc, char **argv)
// set the error code
// Note: the error code should be consistent across all processors
int error = 0;
// Finished
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();
Utilities::shutdown();
return error;
}

View File

@ -8,7 +8,7 @@
#include "common/UnitTest.h"
#include "common/Utilities.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "IO/MeshDatabase.h"
#include "IO/Reader.h"
#include "IO/Writer.h"
@ -34,11 +34,9 @@ inline double distance( const Point& p )
// Test writing and reading the given format
void testWriter( const std::string& format, std::vector<IO::MeshDataStruct>& meshData, UnitTest& ut )
{
int rank, nprocs;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Comm_rank(comm,&rank);
MPI_Comm_size(comm,&nprocs);
MPI_Barrier(comm);
Utilities::MPI comm( MPI_COMM_WORLD );
int nprocs = comm.getSize();
comm.barrier();
// Get the format
std::string format2 = format;
@ -63,7 +61,7 @@ void testWriter( const std::string& format, std::vector<IO::MeshDataStruct>& mes
IO::initialize( "test_"+format, format2, false );
IO::writeData( 0, meshData, comm );
IO::writeData( 3, meshData, comm );
MPI_Barrier(comm);
comm.barrier();
PROFILE_STOP(format+"-write");
// Get the summary name for reading

View File

@ -23,6 +23,13 @@
int main(int argc, char **argv)
{
// Initialize MPI
Utilities::startup( argc, argv );
Utilities::MPI comm( MPI_COMM_WORLD );
int rank = comm.getRank();
int nprocs = comm.getSize();
// Load the input database
auto db = std::make_shared<Database>( argv[1] );
@ -33,20 +40,16 @@ int main(int argc, char **argv)
{ // Limit scope so variables that contain communicators will free before MPI_Finialize
MPI_Comm comm;
MPI_Comm_dup(MPI_COMM_WORLD,&comm);
int rank = comm_rank(comm);
int nprocs = comm_size(comm);
if (rank == 0){
printf("********************************************************\n");
printf("Running Color LBM \n");
printf("********************************************************\n");
}
// Initialize compute device
ScaLBL_SetDevice(rank);
ScaLBL_DeviceBarrier();
MPI_Barrier(comm);
// Initialize compute device
int device=ScaLBL_SetDevice(rank);
NULL_USE( device );
ScaLBL_DeviceBarrier();
comm.barrier();
PROFILE_ENABLE(1);
//PROFILE_ENABLE_TRACE();
@ -71,8 +74,6 @@ int main(int argc, char **argv)
PROFILE_SAVE(file,level);
// ****************************************************
MPI_Barrier(comm);
MPI_Comm_free(&comm);
} // Limit scope so variables that contain communicators will free before MPI_Finialize

View File

@ -26,21 +26,22 @@ int main(int argc, char **argv)
Utilities::startup( argc, argv );
{ // Limit scope so variables that contain communicators will free before MPI_Finialize
MPI_Comm comm;
MPI_Comm_dup(MPI_COMM_WORLD,&comm);
int rank = comm_rank(comm);
int nprocs = comm_size(comm);
// Initialize MPI
Utilities::startup( argc, argv );
Utilities::MPI comm( MPI_COMM_WORLD );
int rank = comm.getRank();
int nprocs = comm.getSize();
if (rank == 0){
printf("********************************************************\n");
printf("Running LBPM electrokinetic single-fluid solver \n");
printf("********************************************************\n");
}
// Initialize compute device
ScaLBL_SetDevice(rank);
ScaLBL_DeviceBarrier();
MPI_Barrier(comm);
// Initialize compute device
int device=ScaLBL_SetDevice(rank);
NULL_USE( device );
ScaLBL_DeviceBarrier();
comm.barrier();
PROFILE_ENABLE(1);
//PROFILE_ENABLE_TRACE();
@ -121,9 +122,6 @@ int main(int argc, char **argv)
PROFILE_STOP("Main");
PROFILE_SAVE("lbpm_electrokinetic_SingleFluid_simulator",1);
// ****************************************************
MPI_Barrier(comm);
MPI_Comm_free(&comm);
} // Limit scope so variables that contain communicators will free before MPI_Finialize

View File

@ -19,27 +19,25 @@ using namespace std;
int main(int argc, char **argv)
{
// Initialize MPI and error handlers
// Initialize MPI
Utilities::startup( argc, argv );
Utilities::MPI comm( MPI_COMM_WORLD );
int rank = comm.getRank();
int nprocs = comm.getSize();
{ // Limit scope so variables that contain communicators will free before MPI_Finialize
MPI_Comm comm;
MPI_Comm_dup(MPI_COMM_WORLD,&comm);
int rank = comm_rank(comm);
int nprocs = comm_size(comm);
if (rank == 0){
printf("****************************************\n");
printf("Running Greyscale Two-Phase Calculation \n");
printf("****************************************\n");
printf("****************************************\n");
printf("Running Greyscale Two-Phase Calculation \n");
printf("****************************************\n");
}
// Initialize compute device
ScaLBL_SetDevice(rank);
int device=ScaLBL_SetDevice(rank);
NULL_USE( device );
ScaLBL_DeviceBarrier();
MPI_Barrier(comm);
comm.barrier();
PROFILE_ENABLE(1);
//PROFILE_ENABLE_TRACE();
//PROFILE_ENABLE_MEMORY();
@ -61,9 +59,6 @@ int main(int argc, char **argv)
PROFILE_SAVE("lbpm_greyscaleColor_simulator",1);
// ****************************************************
MPI_Barrier(comm);
MPI_Comm_free(&comm);
} // Limit scope so variables that contain communicators will free before MPI_Finialize
Utilities::shutdown();

View File

@ -19,54 +19,49 @@ using namespace std;
int main(int argc, char **argv)
{
// Initialize MPI
Utilities::startup( argc, argv );
Utilities::MPI comm( MPI_COMM_WORLD );
int rank = comm.getRank();
int nprocs = comm.getSize();
// Initialize MPI and error handlers
Utilities::startup( argc, argv );
{ // Limit scope so variables that contain communicators will free before MPI_Finialize
{ // Limit scope so variables that contain communicators will free before MPI_Finialize
MPI_Comm comm;
MPI_Comm_dup(MPI_COMM_WORLD,&comm);
int rank = comm_rank(comm);
int nprocs = comm_size(comm);
if (rank == 0){
printf("********************************************************\n");
printf("Running Greyscale Single Phase Permeability Calculation \n");
printf("********************************************************\n");
}
// Initialize compute device
ScaLBL_SetDevice(rank);
ScaLBL_DeviceBarrier();
MPI_Barrier(comm);
PROFILE_ENABLE(1);
//PROFILE_ENABLE_TRACE();
//PROFILE_ENABLE_MEMORY();
PROFILE_SYNCHRONIZE();
PROFILE_START("Main");
Utilities::setErrorHandlers();
auto filename = argv[1];
ScaLBL_GreyscaleModel Greyscale(rank,nprocs,comm);
Greyscale.ReadParams(filename);
Greyscale.SetDomain();
Greyscale.ReadInput();
Greyscale.Create(); // creating the model will create data structure to match the pore structure and allocate variables
Greyscale.Initialize(); // initializing the model will set initial conditions for variables
Greyscale.Run();
Greyscale.VelocityField();
//Greyscale.WriteDebug();
PROFILE_STOP("Main");
PROFILE_SAVE("lbpm_greyscale_simulator",1);
// ****************************************************
MPI_Barrier(comm);
MPI_Comm_free(&comm);
} // Limit scope so variables that contain communicators will free before MPI_Finialize
if (rank == 0){
printf("********************************************************\n");
printf("Running Greyscale Single Phase Permeability Calculation \n");
printf("********************************************************\n");
}
// Initialize compute device
int device=ScaLBL_SetDevice(rank);
NULL_USE( device );
ScaLBL_DeviceBarrier();
comm.barrier();
PROFILE_ENABLE(1);
//PROFILE_ENABLE_TRACE();
//PROFILE_ENABLE_MEMORY();
PROFILE_SYNCHRONIZE();
PROFILE_START("Main");
Utilities::setErrorHandlers();
Utilities::shutdown();
auto filename = argv[1];
ScaLBL_GreyscaleModel Greyscale(rank,nprocs,comm);
Greyscale.ReadParams(filename);
Greyscale.SetDomain();
Greyscale.ReadInput();
Greyscale.Create(); // creating the model will create data structure to match the pore structure and allocate variables
Greyscale.Initialize(); // initializing the model will set initial conditions for variables
Greyscale.Run();
Greyscale.VelocityField();
//Greyscale.WriteDebug();
PROFILE_STOP("Main");
PROFILE_SAVE("lbpm_greyscale_simulator",1);
// ****************************************************
} // Limit scope so variables that contain communicators will free before MPI_Finialize
Utilities::shutdown();
}

View File

@ -14,7 +14,7 @@
#include "common/Array.h"
#include "common/Domain.h"
#include "common/Communication.h"
#include "common/MPI_Helpers.h"
#include "common/MPI.h"
#include "IO/MeshDatabase.h"
#include "IO/Mesh.h"
#include "IO/Writer.h"