From e139b671d400037317cbf4a92f4db554f21d96f9 Mon Sep 17 00:00:00 2001 From: Wendi-L Date: Fri, 18 Aug 2023 20:15:30 +0100 Subject: [PATCH 1/5] Add residual output to Fixed Relaxation Demos --- .../9-0-0-basic/heat-left.cpp | 5 +- .../9-0-0-basic/heat-right.cpp | 50 +++++++------ .../9-0-1-restart/heat-left.cpp | 5 +- .../9-0-1-restart/heat-right.cpp | 4 +- .../9-0-2-dynamic_points/heat-left.cpp | 26 ++++--- .../9-0-2-dynamic_points/heat-right.cpp | 74 ++++++++++--------- 6 files changed, 87 insertions(+), 77 deletions(-) diff --git a/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-left.cpp b/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-left.cpp index f702587..69558d5 100755 --- a/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-left.cpp +++ b/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-left.cpp @@ -125,7 +125,7 @@ int main( int argc, char ** argv ) { // fetch data from the other solver sampler_pseudo_nearest_neighbor1d s1(0.1); temporal_sampler_exact1d s2; - algo_fixed_relaxation1d fr(0.01,ptsVluInit); + algo_fixed_relaxation1d fr(0.01,world,ptsVluInit); // Print off a hello world message printf("Hello world from Left rank %d out of %d MUI processors\n", @@ -151,7 +151,8 @@ int main( int argc, char ** argv ) { interface.commit( iter ); u[6] = interface.fetch( "u0", 6 * H, iter, s1, s2, fr ); - + printf( "Left under relaxation factor at iter= %d is %f\n", iter, fr.get_under_relaxation_factor(iter)); + printf( "Left residual L2 Norm at iter= %d is %f\n", iter, fr.get_residual_L2_Norm(iter)); // calculate 'interior' points for ( int i = 1; i < 6; i++ ) v[i] = u[i] + k / ( H * H ) * ( u[i - 1] + u[i + 1] - 2 * u[i] ); diff --git a/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-right.cpp b/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-right.cpp index d9b78dd..0791407 100755 --- a/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-right.cpp +++ b/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-right.cpp @@ -69,35 +69,35 @@ int main( int argc, char ** argv ) { /// Initialise values from file std::string inoutFilenameL = "Resources/right_FR.csv"; - std::fstream inFile; - std::vector> content; - std::vector row; + std::fstream inFile; + std::vector> content; + std::vector row; std::string line, word; inFile.open(inoutFilenameL, std::ios::in); if(inFile.is_open()) { - while(getline(inFile, line)) { - row.clear(); - std::stringstream str(line); - while (std::getline(str, word, ',')) { - row.push_back(word); - } - content.push_back(row); - } - - for ( int i = 4; i < 11; i++ ) u1[i] = stod(content[i-3][1]); - - } else { - std::cerr<<"right_FR.csv missing" << std::endl; - for ( int i = 4; i < 11; i++ ) u1[i] = 0.0; - } + while(getline(inFile, line)) { + row.clear(); + std::stringstream str(line); + while (std::getline(str, word, ',')) { + row.push_back(word); + } + content.push_back(row); + } + + for ( int i = 4; i < 11; i++ ) u1[i] = stod(content[i-3][1]); + + } else { + std::cerr<<"right_FR.csv missing" << std::endl; + for ( int i = 4; i < 11; i++ ) u1[i] = 0.0; + } inFile.close(); uniface1d interface( "mpi://right/ifs" ); - MPI_Comm world = mui::mpi_split_by_app(); - MPI_Comm* Cppworld = &world; + MPI_Comm world = mui::mpi_split_by_app(); + MPI_Comm* Cppworld = &world; int rankLocal = MPI::COMM_WORLD.Get_rank(); int sizeLocal = MPI::COMM_WORLD.Get_size(); @@ -116,14 +116,14 @@ int main( int argc, char ** argv ) { std::vector> ptsVluInit; for ( int i = 4; i < 11; i++ ) { - mui::point1d pt(i); - ptsVluInit.push_back(std::make_pair(pt,u1[i])); - } + mui::point1d pt(i); + ptsVluInit.push_back(std::make_pair(pt,u1[i])); + } // fetch data from the other solver sampler_pseudo_nearest_neighbor1d s1(0.1); temporal_sampler_exact1d s2; - algo_fixed_relaxation1d fr(0.01,ptsVluInit); + algo_fixed_relaxation1d fr(0.01,world,ptsVluInit); // Print off a hello world message printf("Hello world from Right rank %d out of %d MUI processors\n", @@ -145,6 +145,8 @@ int main( int argc, char ** argv ) { printf( "Right grid iteration %d\n", iter ); u[4] = interface.fetch( "u", 4 * H, iter, s1, s2, fr ); + printf( "Right under relaxation factor at iter= %d is %f\n", iter, fr.get_under_relaxation_factor(iter)); + printf( "Right residual L2 Norm at iter= %d is %f\n", iter, fr.get_residual_L2_Norm(iter)); // calculate 'interior' points for ( int i = 5; i < 11; i++ ) v[i] = u[i] + k / ( H * H ) * ( u[i - 1] + u[i + 1] - 2 * u[i] ); diff --git a/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-left.cpp b/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-left.cpp index bad65f6..f09b354 100755 --- a/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-left.cpp +++ b/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-left.cpp @@ -125,7 +125,7 @@ int main( int argc, char ** argv ) { // fetch data from the other solver sampler_pseudo_nearest_neighbor1d s1(0.1); temporal_sampler_exact1d s2; - algo_fixed_relaxation1d fr(0.01,ptsVluInit); + algo_fixed_relaxation1d fr(0.01,world,ptsVluInit); // Print off a hello world message printf("Hello world from Left rank %d out of %d MUI processors\n", @@ -151,7 +151,8 @@ int main( int argc, char ** argv ) { interface.commit( t ); u[6] = interface.fetch( "u0", 6 * H, t, s1, s2, fr ); - + printf( "Left under relaxation factor at t= %d is %f\n", t, fr.get_under_relaxation_factor(t)); + printf( "Left residual L2 Norm at t= %d is %f\n", t, fr.get_residual_L2_Norm(t)); // calculate 'interior' points for ( int i = 1; i < 6; i++ ) v[i] = u[i] + k / ( H * H ) * ( u[i - 1] + u[i + 1] - 2 * u[i] ); diff --git a/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-right.cpp b/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-right.cpp index 87c3f5f..e8b291c 100755 --- a/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-right.cpp +++ b/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-right.cpp @@ -123,7 +123,7 @@ int main( int argc, char ** argv ) { // fetch data from the other solver sampler_pseudo_nearest_neighbor1d s1(0.1); temporal_sampler_exact1d s2; - algo_fixed_relaxation1d fr(0.01,ptsVluInit); + algo_fixed_relaxation1d fr(0.01,world,ptsVluInit); // Print off a hello world message printf("Hello world from Right rank %d out of %d MUI processors\n", @@ -145,6 +145,8 @@ int main( int argc, char ** argv ) { printf( "Right grid step %d\n", t ); u[4] = interface.fetch( "u", 4 * H, t, s1, s2, fr ); + printf( "Right under relaxation factor at t= %d is %f\n", t, fr.get_under_relaxation_factor(t)); + printf( "Right residual L2 Norm at t= %d is %f\n", t, fr.get_residual_L2_Norm(t)); // calculate 'interior' points for ( int i = 5; i < 11; i++ ) v[i] = u[i] + k / ( H * H ) * ( u[i - 1] + u[i + 1] - 2 * u[i] ); diff --git a/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-left.cpp b/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-left.cpp index 47ae398..40d72d0 100755 --- a/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-left.cpp +++ b/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-left.cpp @@ -125,7 +125,7 @@ int main( int argc, char ** argv ) { // fetch data from the other solver sampler_pseudo_nearest_neighbor1d s1(30); temporal_sampler_exact1d s2; - algo_fixed_relaxation1d fr(0.01,ptsVluInit); + algo_fixed_relaxation1d fr(0.01,world,ptsVluInit); // Print off a hello world message printf("Hello world from Left rank %d out of %d MUI processors\n", @@ -152,9 +152,11 @@ int main( int argc, char ** argv ) { u[60] = interface.fetch( "u0", 60 * H, t, s1, s2, fr ); - if ((t>=150) && (t<250)) { - u[58] = interface.fetch( "u0", 58 * H, t, s1, s2, fr ); - } + if ((t>=150) && (t<250)) { + u[58] = interface.fetch( "u0", 58 * H, t, s1, s2, fr ); + } + printf( "Left under relaxation factor at t= %d is %f\n", t, fr.get_under_relaxation_factor(t)); + printf( "Left residual L2 Norm at t= %d is %f\n", t, fr.get_residual_L2_Norm(t)); // calculate 'interior' points for ( int i = 10; i < 60; i+=10 ) v[i] = u[i] + k / ( H * H ) * ( u[i - 10] + u[i + 10] - 2 * u[i] ); @@ -163,9 +165,9 @@ int main( int argc, char ** argv ) { v[N - 10] = u[N - 10]; - if ((t>=150) && (t<250)) { - v[58] = u[58]; - } + if ((t>=150) && (t<250)) { + v[58] = u[58]; + } // I/O std::swap( u, v ); @@ -176,13 +178,13 @@ int main( int argc, char ** argv ) { outputFileLeft.open(filenameL); outputFileLeft << "\"X\",\"u\"\n"; - for ( int i = 0; i < 60; i+=10 ) outputFileLeft << i * H << "," << u[i] << ", \n"; + for ( int i = 0; i < 60; i+=10 ) outputFileLeft << i * H << "," << u[i] << ", \n"; - if ((t>=150) && (t<250)) { - outputFileLeft << 58 * H << "," << u[58] << ", \n"; - } + if ((t>=150) && (t<250)) { + outputFileLeft << 58 * H << "," << u[58] << ", \n"; + } - outputFileLeft << 60 * H << "," << u[60] << ", \n"; + outputFileLeft << 60 * H << "," << u[60] << ", \n"; outputFileLeft.close(); diff --git a/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-right.cpp b/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-right.cpp index 8512b21..54dad5f 100755 --- a/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-right.cpp +++ b/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-right.cpp @@ -69,35 +69,35 @@ int main( int argc, char ** argv ) { /// Initialise values from file std::string inoutFilenameL = "Resources/right_FR.csv"; - std::fstream inFile; - std::vector> content; - std::vector row; + std::fstream inFile; + std::vector> content; + std::vector row; std::string line, word; inFile.open(inoutFilenameL, std::ios::in); if(inFile.is_open()) { - while(getline(inFile, line)) { - row.clear(); - std::stringstream str(line); - while (std::getline(str, word, ',')) { - row.push_back(word); - } - content.push_back(row); - } - - for ( int i = 40; i < 110; i+=10 ) u1[i] = stod(content[i*0.1-3][1]); - - } else { - std::cerr<<"right_FR.csv missing" << std::endl; - for ( int i = 40; i < 110; i+=10 ) u1[i] = 0.0; - } + while(getline(inFile, line)) { + row.clear(); + std::stringstream str(line); + while (std::getline(str, word, ',')) { + row.push_back(word); + } + content.push_back(row); + } + + for ( int i = 40; i < 110; i+=10 ) u1[i] = stod(content[i*0.1-3][1]); + + } else { + std::cerr<<"right_FR.csv missing" << std::endl; + for ( int i = 40; i < 110; i+=10 ) u1[i] = 0.0; + } inFile.close(); uniface1d interface( "mpi://right/ifs" ); - MPI_Comm world = mui::mpi_split_by_app(); - MPI_Comm* Cppworld = &world; + MPI_Comm world = mui::mpi_split_by_app(); + MPI_Comm* Cppworld = &world; int rankLocal = MPI::COMM_WORLD.Get_rank(); int sizeLocal = MPI::COMM_WORLD.Get_size(); @@ -116,14 +116,14 @@ int main( int argc, char ** argv ) { std::vector> ptsVluInit; for ( int i = 40; i < 110; i+=10 ) { - mui::point1d pt(i); - ptsVluInit.push_back(std::make_pair(pt,u1[i])); - } + mui::point1d pt(i); + ptsVluInit.push_back(std::make_pair(pt,u1[i])); + } // fetch data from the other solver sampler_pseudo_nearest_neighbor1d s1(30); temporal_sampler_exact1d s2; - algo_fixed_relaxation1d fr(0.01,ptsVluInit); + algo_fixed_relaxation1d fr(0.01,world,ptsVluInit); // Print off a hello world message printf("Hello world from Right rank %d out of %d MUI processors\n", @@ -146,9 +146,11 @@ int main( int argc, char ** argv ) { u[40] = interface.fetch( "u", 40 * H, t, s1, s2, fr ); - if ((t>=100) && (t<200)) { - u[42] = interface.fetch( "u", 42 * H, t, s1, s2, fr ); - } + if ((t>=100) && (t<200)) { + u[42] = interface.fetch( "u", 42 * H, t, s1, s2, fr ); + } + printf( "Right under relaxation factor at t= %d is %f\n", t, fr.get_under_relaxation_factor(t)); + printf( "Right residual L2 Norm at t= %d is %f\n", t, fr.get_residual_L2_Norm(t)); // calculate 'interior' points for ( int i = 50; i < 110; i+=10 ) v[i] = u[i] + k / ( H * H ) * ( u[i - 10] + u[i + 10] - 2 * u[i] ); @@ -156,9 +158,9 @@ int main( int argc, char ** argv ) { v[N - 10] = 0.0; v[40] = u[40 ]; - if ((t>=100) && (t<200)) { - v[42] = u[42 ]; - } + if ((t>=100) && (t<200)) { + v[42] = u[42 ]; + } // push data to the other solver interface.push( "u0", 60 * H, u[60] ); @@ -173,14 +175,14 @@ int main( int argc, char ** argv ) { outputFileRight.open(filenameR); outputFileRight << "\"X\",\"u\"\n"; - outputFileRight << 40 * H << "," << u[40] << ", \n"; + outputFileRight << 40 * H << "," << u[40] << ", \n"; - if ((t>=100) && (t<200)) { - outputFileRight << 42 * H << "," << u[42] << ", \n"; - } + if ((t>=100) && (t<200)) { + outputFileRight << 42 * H << "," << u[42] << ", \n"; + } - for ( int i = 50; i < 110; i+=10 ) outputFileRight << i * H << "," << u[i] << ", \n"; - outputFileRight.close(); + for ( int i = 50; i < 110; i+=10 ) outputFileRight << i * H << "," << u[i] << ", \n"; + outputFileRight.close(); } From d5370a86e50cf7de24039b35aaefac1a99d0710e Mon Sep 17 00:00:00 2001 From: Wendi-L Date: Mon, 4 Sep 2023 16:30:55 +0100 Subject: [PATCH 2/5] Revert "Add residual output to Fixed Relaxation Demos" This reverts commit e139b671d400037317cbf4a92f4db554f21d96f9. --- .../9-0-0-basic/heat-left.cpp | 5 +- .../9-0-0-basic/heat-right.cpp | 50 ++++++------- .../9-0-1-restart/heat-left.cpp | 5 +- .../9-0-1-restart/heat-right.cpp | 4 +- .../9-0-2-dynamic_points/heat-left.cpp | 26 +++---- .../9-0-2-dynamic_points/heat-right.cpp | 74 +++++++++---------- 6 files changed, 77 insertions(+), 87 deletions(-) diff --git a/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-left.cpp b/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-left.cpp index 69558d5..f702587 100755 --- a/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-left.cpp +++ b/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-left.cpp @@ -125,7 +125,7 @@ int main( int argc, char ** argv ) { // fetch data from the other solver sampler_pseudo_nearest_neighbor1d s1(0.1); temporal_sampler_exact1d s2; - algo_fixed_relaxation1d fr(0.01,world,ptsVluInit); + algo_fixed_relaxation1d fr(0.01,ptsVluInit); // Print off a hello world message printf("Hello world from Left rank %d out of %d MUI processors\n", @@ -151,8 +151,7 @@ int main( int argc, char ** argv ) { interface.commit( iter ); u[6] = interface.fetch( "u0", 6 * H, iter, s1, s2, fr ); - printf( "Left under relaxation factor at iter= %d is %f\n", iter, fr.get_under_relaxation_factor(iter)); - printf( "Left residual L2 Norm at iter= %d is %f\n", iter, fr.get_residual_L2_Norm(iter)); + // calculate 'interior' points for ( int i = 1; i < 6; i++ ) v[i] = u[i] + k / ( H * H ) * ( u[i - 1] + u[i + 1] - 2 * u[i] ); diff --git a/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-right.cpp b/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-right.cpp index 0791407..d9b78dd 100755 --- a/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-right.cpp +++ b/09-algorithms/9-0-fixedRelaxation/9-0-0-basic/heat-right.cpp @@ -69,35 +69,35 @@ int main( int argc, char ** argv ) { /// Initialise values from file std::string inoutFilenameL = "Resources/right_FR.csv"; - std::fstream inFile; - std::vector> content; - std::vector row; + std::fstream inFile; + std::vector> content; + std::vector row; std::string line, word; inFile.open(inoutFilenameL, std::ios::in); if(inFile.is_open()) { - while(getline(inFile, line)) { - row.clear(); - std::stringstream str(line); - while (std::getline(str, word, ',')) { - row.push_back(word); - } - content.push_back(row); - } - - for ( int i = 4; i < 11; i++ ) u1[i] = stod(content[i-3][1]); - - } else { - std::cerr<<"right_FR.csv missing" << std::endl; - for ( int i = 4; i < 11; i++ ) u1[i] = 0.0; - } + while(getline(inFile, line)) { + row.clear(); + std::stringstream str(line); + while (std::getline(str, word, ',')) { + row.push_back(word); + } + content.push_back(row); + } + + for ( int i = 4; i < 11; i++ ) u1[i] = stod(content[i-3][1]); + + } else { + std::cerr<<"right_FR.csv missing" << std::endl; + for ( int i = 4; i < 11; i++ ) u1[i] = 0.0; + } inFile.close(); uniface1d interface( "mpi://right/ifs" ); - MPI_Comm world = mui::mpi_split_by_app(); - MPI_Comm* Cppworld = &world; + MPI_Comm world = mui::mpi_split_by_app(); + MPI_Comm* Cppworld = &world; int rankLocal = MPI::COMM_WORLD.Get_rank(); int sizeLocal = MPI::COMM_WORLD.Get_size(); @@ -116,14 +116,14 @@ int main( int argc, char ** argv ) { std::vector> ptsVluInit; for ( int i = 4; i < 11; i++ ) { - mui::point1d pt(i); - ptsVluInit.push_back(std::make_pair(pt,u1[i])); - } + mui::point1d pt(i); + ptsVluInit.push_back(std::make_pair(pt,u1[i])); + } // fetch data from the other solver sampler_pseudo_nearest_neighbor1d s1(0.1); temporal_sampler_exact1d s2; - algo_fixed_relaxation1d fr(0.01,world,ptsVluInit); + algo_fixed_relaxation1d fr(0.01,ptsVluInit); // Print off a hello world message printf("Hello world from Right rank %d out of %d MUI processors\n", @@ -145,8 +145,6 @@ int main( int argc, char ** argv ) { printf( "Right grid iteration %d\n", iter ); u[4] = interface.fetch( "u", 4 * H, iter, s1, s2, fr ); - printf( "Right under relaxation factor at iter= %d is %f\n", iter, fr.get_under_relaxation_factor(iter)); - printf( "Right residual L2 Norm at iter= %d is %f\n", iter, fr.get_residual_L2_Norm(iter)); // calculate 'interior' points for ( int i = 5; i < 11; i++ ) v[i] = u[i] + k / ( H * H ) * ( u[i - 1] + u[i + 1] - 2 * u[i] ); diff --git a/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-left.cpp b/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-left.cpp index f09b354..bad65f6 100755 --- a/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-left.cpp +++ b/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-left.cpp @@ -125,7 +125,7 @@ int main( int argc, char ** argv ) { // fetch data from the other solver sampler_pseudo_nearest_neighbor1d s1(0.1); temporal_sampler_exact1d s2; - algo_fixed_relaxation1d fr(0.01,world,ptsVluInit); + algo_fixed_relaxation1d fr(0.01,ptsVluInit); // Print off a hello world message printf("Hello world from Left rank %d out of %d MUI processors\n", @@ -151,8 +151,7 @@ int main( int argc, char ** argv ) { interface.commit( t ); u[6] = interface.fetch( "u0", 6 * H, t, s1, s2, fr ); - printf( "Left under relaxation factor at t= %d is %f\n", t, fr.get_under_relaxation_factor(t)); - printf( "Left residual L2 Norm at t= %d is %f\n", t, fr.get_residual_L2_Norm(t)); + // calculate 'interior' points for ( int i = 1; i < 6; i++ ) v[i] = u[i] + k / ( H * H ) * ( u[i - 1] + u[i + 1] - 2 * u[i] ); diff --git a/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-right.cpp b/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-right.cpp index e8b291c..87c3f5f 100755 --- a/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-right.cpp +++ b/09-algorithms/9-0-fixedRelaxation/9-0-1-restart/heat-right.cpp @@ -123,7 +123,7 @@ int main( int argc, char ** argv ) { // fetch data from the other solver sampler_pseudo_nearest_neighbor1d s1(0.1); temporal_sampler_exact1d s2; - algo_fixed_relaxation1d fr(0.01,world,ptsVluInit); + algo_fixed_relaxation1d fr(0.01,ptsVluInit); // Print off a hello world message printf("Hello world from Right rank %d out of %d MUI processors\n", @@ -145,8 +145,6 @@ int main( int argc, char ** argv ) { printf( "Right grid step %d\n", t ); u[4] = interface.fetch( "u", 4 * H, t, s1, s2, fr ); - printf( "Right under relaxation factor at t= %d is %f\n", t, fr.get_under_relaxation_factor(t)); - printf( "Right residual L2 Norm at t= %d is %f\n", t, fr.get_residual_L2_Norm(t)); // calculate 'interior' points for ( int i = 5; i < 11; i++ ) v[i] = u[i] + k / ( H * H ) * ( u[i - 1] + u[i + 1] - 2 * u[i] ); diff --git a/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-left.cpp b/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-left.cpp index 40d72d0..47ae398 100755 --- a/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-left.cpp +++ b/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-left.cpp @@ -125,7 +125,7 @@ int main( int argc, char ** argv ) { // fetch data from the other solver sampler_pseudo_nearest_neighbor1d s1(30); temporal_sampler_exact1d s2; - algo_fixed_relaxation1d fr(0.01,world,ptsVluInit); + algo_fixed_relaxation1d fr(0.01,ptsVluInit); // Print off a hello world message printf("Hello world from Left rank %d out of %d MUI processors\n", @@ -152,11 +152,9 @@ int main( int argc, char ** argv ) { u[60] = interface.fetch( "u0", 60 * H, t, s1, s2, fr ); - if ((t>=150) && (t<250)) { - u[58] = interface.fetch( "u0", 58 * H, t, s1, s2, fr ); - } - printf( "Left under relaxation factor at t= %d is %f\n", t, fr.get_under_relaxation_factor(t)); - printf( "Left residual L2 Norm at t= %d is %f\n", t, fr.get_residual_L2_Norm(t)); + if ((t>=150) && (t<250)) { + u[58] = interface.fetch( "u0", 58 * H, t, s1, s2, fr ); + } // calculate 'interior' points for ( int i = 10; i < 60; i+=10 ) v[i] = u[i] + k / ( H * H ) * ( u[i - 10] + u[i + 10] - 2 * u[i] ); @@ -165,9 +163,9 @@ int main( int argc, char ** argv ) { v[N - 10] = u[N - 10]; - if ((t>=150) && (t<250)) { - v[58] = u[58]; - } + if ((t>=150) && (t<250)) { + v[58] = u[58]; + } // I/O std::swap( u, v ); @@ -178,13 +176,13 @@ int main( int argc, char ** argv ) { outputFileLeft.open(filenameL); outputFileLeft << "\"X\",\"u\"\n"; - for ( int i = 0; i < 60; i+=10 ) outputFileLeft << i * H << "," << u[i] << ", \n"; + for ( int i = 0; i < 60; i+=10 ) outputFileLeft << i * H << "," << u[i] << ", \n"; - if ((t>=150) && (t<250)) { - outputFileLeft << 58 * H << "," << u[58] << ", \n"; - } + if ((t>=150) && (t<250)) { + outputFileLeft << 58 * H << "," << u[58] << ", \n"; + } - outputFileLeft << 60 * H << "," << u[60] << ", \n"; + outputFileLeft << 60 * H << "," << u[60] << ", \n"; outputFileLeft.close(); diff --git a/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-right.cpp b/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-right.cpp index 54dad5f..8512b21 100755 --- a/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-right.cpp +++ b/09-algorithms/9-0-fixedRelaxation/9-0-2-dynamic_points/heat-right.cpp @@ -69,35 +69,35 @@ int main( int argc, char ** argv ) { /// Initialise values from file std::string inoutFilenameL = "Resources/right_FR.csv"; - std::fstream inFile; - std::vector> content; - std::vector row; + std::fstream inFile; + std::vector> content; + std::vector row; std::string line, word; inFile.open(inoutFilenameL, std::ios::in); if(inFile.is_open()) { - while(getline(inFile, line)) { - row.clear(); - std::stringstream str(line); - while (std::getline(str, word, ',')) { - row.push_back(word); - } - content.push_back(row); - } - - for ( int i = 40; i < 110; i+=10 ) u1[i] = stod(content[i*0.1-3][1]); - - } else { - std::cerr<<"right_FR.csv missing" << std::endl; - for ( int i = 40; i < 110; i+=10 ) u1[i] = 0.0; - } + while(getline(inFile, line)) { + row.clear(); + std::stringstream str(line); + while (std::getline(str, word, ',')) { + row.push_back(word); + } + content.push_back(row); + } + + for ( int i = 40; i < 110; i+=10 ) u1[i] = stod(content[i*0.1-3][1]); + + } else { + std::cerr<<"right_FR.csv missing" << std::endl; + for ( int i = 40; i < 110; i+=10 ) u1[i] = 0.0; + } inFile.close(); uniface1d interface( "mpi://right/ifs" ); - MPI_Comm world = mui::mpi_split_by_app(); - MPI_Comm* Cppworld = &world; + MPI_Comm world = mui::mpi_split_by_app(); + MPI_Comm* Cppworld = &world; int rankLocal = MPI::COMM_WORLD.Get_rank(); int sizeLocal = MPI::COMM_WORLD.Get_size(); @@ -116,14 +116,14 @@ int main( int argc, char ** argv ) { std::vector> ptsVluInit; for ( int i = 40; i < 110; i+=10 ) { - mui::point1d pt(i); - ptsVluInit.push_back(std::make_pair(pt,u1[i])); - } + mui::point1d pt(i); + ptsVluInit.push_back(std::make_pair(pt,u1[i])); + } // fetch data from the other solver sampler_pseudo_nearest_neighbor1d s1(30); temporal_sampler_exact1d s2; - algo_fixed_relaxation1d fr(0.01,world,ptsVluInit); + algo_fixed_relaxation1d fr(0.01,ptsVluInit); // Print off a hello world message printf("Hello world from Right rank %d out of %d MUI processors\n", @@ -146,11 +146,9 @@ int main( int argc, char ** argv ) { u[40] = interface.fetch( "u", 40 * H, t, s1, s2, fr ); - if ((t>=100) && (t<200)) { - u[42] = interface.fetch( "u", 42 * H, t, s1, s2, fr ); - } - printf( "Right under relaxation factor at t= %d is %f\n", t, fr.get_under_relaxation_factor(t)); - printf( "Right residual L2 Norm at t= %d is %f\n", t, fr.get_residual_L2_Norm(t)); + if ((t>=100) && (t<200)) { + u[42] = interface.fetch( "u", 42 * H, t, s1, s2, fr ); + } // calculate 'interior' points for ( int i = 50; i < 110; i+=10 ) v[i] = u[i] + k / ( H * H ) * ( u[i - 10] + u[i + 10] - 2 * u[i] ); @@ -158,9 +156,9 @@ int main( int argc, char ** argv ) { v[N - 10] = 0.0; v[40] = u[40 ]; - if ((t>=100) && (t<200)) { - v[42] = u[42 ]; - } + if ((t>=100) && (t<200)) { + v[42] = u[42 ]; + } // push data to the other solver interface.push( "u0", 60 * H, u[60] ); @@ -175,14 +173,14 @@ int main( int argc, char ** argv ) { outputFileRight.open(filenameR); outputFileRight << "\"X\",\"u\"\n"; - outputFileRight << 40 * H << "," << u[40] << ", \n"; + outputFileRight << 40 * H << "," << u[40] << ", \n"; - if ((t>=100) && (t<200)) { - outputFileRight << 42 * H << "," << u[42] << ", \n"; - } + if ((t>=100) && (t<200)) { + outputFileRight << 42 * H << "," << u[42] << ", \n"; + } - for ( int i = 50; i < 110; i+=10 ) outputFileRight << i * H << "," << u[i] << ", \n"; - outputFileRight.close(); + for ( int i = 50; i < 110; i+=10 ) outputFileRight << i * H << "," << u[i] << ", \n"; + outputFileRight.close(); } From 8d6dfb7b42f166c01a816e02e2b9b9964ac14a6e Mon Sep 17 00:00:00 2001 From: Wendi-L Date: Mon, 4 Sep 2023 16:58:09 +0100 Subject: [PATCH 3/5] Update Python demo 10-2-6-pseudo-diffusion with the new RBF core code --- .../3D-pseudo-diffusion-coarse.py | 11 ++--------- .../3D-pseudo-diffusion-fine.cpp | 5 ++--- .../10-2-Python/10-2-6-pseudo-diffusion/run_case.sh | 6 +++--- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/10-wrappers/10-2-Python/10-2-6-pseudo-diffusion/3D-pseudo-diffusion-coarse.py b/10-wrappers/10-2-Python/10-2-6-pseudo-diffusion/3D-pseudo-diffusion-coarse.py index e8011b3..8fa18cc 100755 --- a/10-wrappers/10-2-Python/10-2-6-pseudo-diffusion/3D-pseudo-diffusion-coarse.py +++ b/10-wrappers/10-2-Python/10-2-6-pseudo-diffusion/3D-pseudo-diffusion-coarse.py @@ -96,20 +96,13 @@ conservative = True # Enable conservative OR consistent RBF form cutOff = 1e-9 # Cut-off value for Gaussian RBF basis function smoothFunc = False # Enable/disable RBF smoothing function during matrix creation -writeMatrix = True # Enable/disable writing of the matrix (if not reading) +generateMatrix = True # Enable/disable writing of the matrix (if not reading) cgSolveTol = 1e-6; # Conjugate Gradient solver tolerance cgMaxIter = 500; # Conjugate Gradient solver maximum iterations (-1 = value determined by tolerance) preconditioner = 1; # Preconditioner of Conjugate Gradient solver pouSize = 50; # RBF Partition of Unity patch size rbfMatrixFolder = "rbfCoarseMatrix" + str(rank) # Output folder for the RBF matrix files -# Create the RBF Matrix Folder includes all intermediate folders if don't exists -if not os.path.exists(rbfMatrixFolder): - os.makedirs(rbfMatrixFolder) - print("Folder " , rbfMatrixFolder, " created ") -else: - print("Folder " , rbfMatrixFolder, " already exists") - # Setup diffusion rate dr = 0.5 @@ -219,7 +212,7 @@ # Spatial/temporal samplers t_sampler = mui4py.TemporalSamplerExact() -s_sampler = mui4py.SamplerRbf(rSampler, point2dList, basisFunc, conservative, smoothFunc, writeMatrix, rbfMatrixFolder, cutOff, cgSolveTol, cgMaxIter, pouSize, preconditioner, MUI_COMM_WORLD) +s_sampler = mui4py.SamplerRbf(rSampler, point2dList, basisFunc, conservative, smoothFunc, generateMatrix, rbfMatrixFolder, cutOff, cgSolveTol, cgMaxIter, pouSize, preconditioner, MUI_COMM_WORLD) # Commit ZERO step MUI_Interfaces["interface2D02"].commit(0) diff --git a/10-wrappers/10-2-Python/10-2-6-pseudo-diffusion/3D-pseudo-diffusion-fine.cpp b/10-wrappers/10-2-Python/10-2-6-pseudo-diffusion/3D-pseudo-diffusion-fine.cpp index 0faa9ee..9d473b9 100644 --- a/10-wrappers/10-2-Python/10-2-6-pseudo-diffusion/3D-pseudo-diffusion-fine.cpp +++ b/10-wrappers/10-2-Python/10-2-6-pseudo-diffusion/3D-pseudo-diffusion-fine.cpp @@ -77,7 +77,6 @@ int main(int argc, char ** argv) { /// Create rbf matrix folder std::string makedirMString = "rbfFineMatrix" + std::to_string(rank); - mkdir(makedirMString.c_str(), 0777); /// Define the name of MUI domain std::string domain = "fineDomain"; @@ -104,7 +103,7 @@ int main(int argc, char ** argv) { bool conservative = true; double cutoff = 1e-9; bool smoothFunc = false; - bool writeMatrix = true; + bool generateMatrix = true; double cgSolveTol = 1e-6; int cgMaxIter = 500; int preconditioner= 1; @@ -280,7 +279,7 @@ int main(int argc, char ** argv) { /// Define spatial and temporal samplers mui::sampler_rbf spatial_sampler(rSampler, point2dvec, - basisFunc, conservative, smoothFunc, writeMatrix, fileAddress, + basisFunc, conservative, smoothFunc, generateMatrix, fileAddress, cutoff, cgSolveTol, cgMaxIter, pouSize, preconditioner, world); mui::temporal_sampler_exact temporal_sampler; diff --git a/10-wrappers/10-2-Python/10-2-6-pseudo-diffusion/run_case.sh b/10-wrappers/10-2-Python/10-2-6-pseudo-diffusion/run_case.sh index 4b69827..d30fb6a 100755 --- a/10-wrappers/10-2-Python/10-2-6-pseudo-diffusion/run_case.sh +++ b/10-wrappers/10-2-Python/10-2-6-pseudo-diffusion/run_case.sh @@ -24,8 +24,8 @@ START=$SECONDS # aborts. If a python process exit with failure all processes in MPI_COMM_WORLD # will be aborted so hangs are avoided. -mpirun -np 2 3D-pseudo-diffusion-fine :\ - -np 2 python3 -m mpi4py 3D-pseudo-diffusion-coarse.py 2>&1 | tee output.log +mpirun -np 1 3D-pseudo-diffusion-fine :\ + -np 1 python3 -m mpi4py 3D-pseudo-diffusion-coarse.py 2>&1 | tee output.log DURATION=$(( SECONDS - START )) @@ -44,4 +44,4 @@ else echo "Completed in $DURATION seconds" fi -paraview Resources/view.pvsm \ No newline at end of file +# paraview Resources/view.pvsm \ No newline at end of file From 8ff5afd01e380b934f3b98d89fee01c2ef030fcd Mon Sep 17 00:00:00 2001 From: Wendi-L Date: Mon, 23 Oct 2023 17:09:38 +0100 Subject: [PATCH 4/5] Update CMakeLists and run_case.sh for C and Fortran wrappers --- .../10-0-C/10-0-0-simple/CMakeLists.txt | 7 ++--- 10-wrappers/10-0-C/10-0-0-simple/run_case.sh | 2 +- .../10-0-1-multiple-interfaces/CMakeLists.txt | 7 ++--- .../10-0-1-multiple-interfaces/run_case.sh | 2 +- .../CMakeLists.txt | 7 ++--- .../10-0-2-smart-send-dual-times/run_case.sh | 2 +- .../10-0-3-pseudo-diffusion/CMakeLists.txt | 26 ++++------------- .../10-0-3-pseudo-diffusion/run_case.sh | 4 +-- .../CMakeLists.txt | 24 +++------------- .../10-0-4-basic-fixed-relaxation/run_case.sh | 4 +-- .../CMakeLists.txt | 24 +++------------- .../10-0-5-dynamic-points-aitken/run_case.sh | 4 +-- .../10-1-Fortran/10-1-0-simple/CMakeLists.txt | 10 ++----- .../10-1-Fortran/10-1-0-simple/run_case.sh | 2 +- .../10-1-1-multiple-interfaces/CMakeLists.txt | 9 ++---- .../10-1-1-multiple-interfaces/run_case.sh | 2 +- .../CMakeLists.txt | 9 ++---- .../10-1-2-smart-send-dual-times/run_case.sh | 2 +- .../10-1-3-pseudo-diffusion/CMakeLists.txt | 28 ++++--------------- .../10-1-3-pseudo-diffusion/run_case.sh | 4 +-- .../CMakeLists.txt | 28 ++++--------------- .../10-1-4-basic-fixed-relaxation/run_case.sh | 4 +-- .../CMakeLists.txt | 28 ++++--------------- .../10-1-5-dynamic-points-aitken/run_case.sh | 4 +-- .../10-2-5-dual-time-types/run_case.sh | 2 +- 25 files changed, 66 insertions(+), 179 deletions(-) diff --git a/10-wrappers/10-0-C/10-0-0-simple/CMakeLists.txt b/10-wrappers/10-0-C/10-0-0-simple/CMakeLists.txt index ec49218..a86bf11 100644 --- a/10-wrappers/10-0-C/10-0-0-simple/CMakeLists.txt +++ b/10-wrappers/10-0-C/10-0-0-simple/CMakeLists.txt @@ -13,11 +13,8 @@ include_directories(${MPI_INCLUDE_PATH}) find_package(MUI QUIET) if(MUI_BASE_DIR) - set(MUI_C_LIB_DIR "${MUI_LIB_DIR}") - set(MUI_C_INCLUDE_DIR "${MUI_INCLUDE_DIR}/wrappers/C") -elseif(MUI_BASE_C_DIR) - set(MUI_C_LIB_DIR "${MUI_BASE_C_DIR}/lib") - set(MUI_C_INCLUDE_DIR "${MUI_BASE_C_DIR}/include/wrappers/C") + set(MUI_C_LIB_DIR "${MUI_BASE_DIR}/lib") + set(MUI_C_INCLUDE_DIR "${MUI_BASE_DIR}/include/wrappers/C") endif() find_library(MUI_C_WRAPPER_LIB NAMES MUI_C_wrapper PATHS ${MUI_C_LIB_DIR}) diff --git a/10-wrappers/10-0-C/10-0-0-simple/run_case.sh b/10-wrappers/10-0-C/10-0-0-simple/run_case.sh index bcb8976..4363df3 100755 --- a/10-wrappers/10-0-C/10-0-0-simple/run_case.sh +++ b/10-wrappers/10-0-C/10-0-0-simple/run_case.sh @@ -13,7 +13,7 @@ if [ -n "$1" ]; then cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_C_INCLUDE_DIR=$1 -DMUI_C_LIB_DIR=$2 else # Run cmake with the provided path as the MUI base directory - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DCMAKE_PREFIX_PATH=$1 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_BASE_DIR=$1 fi else # Run cmake with the default MUI directory diff --git a/10-wrappers/10-0-C/10-0-1-multiple-interfaces/CMakeLists.txt b/10-wrappers/10-0-C/10-0-1-multiple-interfaces/CMakeLists.txt index a92581e..0a65a0d 100644 --- a/10-wrappers/10-0-C/10-0-1-multiple-interfaces/CMakeLists.txt +++ b/10-wrappers/10-0-C/10-0-1-multiple-interfaces/CMakeLists.txt @@ -13,11 +13,8 @@ include_directories(${MPI_INCLUDE_PATH}) find_package(MUI QUIET) if(MUI_BASE_DIR) - set(MUI_C_LIB_DIR "${MUI_LIB_DIR}") - set(MUI_C_INCLUDE_DIR "${MUI_INCLUDE_DIR}/wrappers/C") -elseif(MUI_BASE_C_DIR) - set(MUI_C_LIB_DIR "${MUI_BASE_C_DIR}/lib") - set(MUI_C_INCLUDE_DIR "${MUI_BASE_C_DIR}/include/wrappers/C") + set(MUI_C_LIB_DIR "${MUI_BASE_DIR}/lib") + set(MUI_C_INCLUDE_DIR "${MUI_BASE_DIR}/include/wrappers/C") endif() find_library(MUI_C_WRAPPER_LIB NAMES MUI_C_wrapper PATHS ${MUI_C_LIB_DIR}) diff --git a/10-wrappers/10-0-C/10-0-1-multiple-interfaces/run_case.sh b/10-wrappers/10-0-C/10-0-1-multiple-interfaces/run_case.sh index ecc0500..4464d38 100755 --- a/10-wrappers/10-0-C/10-0-1-multiple-interfaces/run_case.sh +++ b/10-wrappers/10-0-C/10-0-1-multiple-interfaces/run_case.sh @@ -13,7 +13,7 @@ if [ -n "$1" ]; then cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_C_INCLUDE_DIR=$1 -DMUI_C_LIB_DIR=$2 else # Run cmake with the provided path as the MUI base directory - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DCMAKE_PREFIX_PATH=$1 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_BASE_DIR=$1 fi else # Run cmake with the default MUI directory diff --git a/10-wrappers/10-0-C/10-0-2-smart-send-dual-times/CMakeLists.txt b/10-wrappers/10-0-C/10-0-2-smart-send-dual-times/CMakeLists.txt index 7f36d4e..c53489a 100644 --- a/10-wrappers/10-0-C/10-0-2-smart-send-dual-times/CMakeLists.txt +++ b/10-wrappers/10-0-C/10-0-2-smart-send-dual-times/CMakeLists.txt @@ -15,11 +15,8 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MPI_LINK_FLAGS}") find_package(MUI QUIET) if(MUI_BASE_DIR) - set(MUI_C_LIB_DIR "${MUI_LIB_DIR}") - set(MUI_C_INCLUDE_DIR "${MUI_INCLUDE_DIR}/wrappers/C") -elseif(MUI_BASE_C_DIR) - set(MUI_C_LIB_DIR "${MUI_BASE_C_DIR}/lib") - set(MUI_C_INCLUDE_DIR "${MUI_BASE_C_DIR}/include/wrappers/C") + set(MUI_C_LIB_DIR "${MUI_BASE_DIR}/lib") + set(MUI_C_INCLUDE_DIR "${MUI_BASE_DIR}/include/wrappers/C") endif() find_library(MUI_C_WRAPPER_LIB NAMES MUI_C_wrapper PATHS ${MUI_C_LIB_DIR}) diff --git a/10-wrappers/10-0-C/10-0-2-smart-send-dual-times/run_case.sh b/10-wrappers/10-0-C/10-0-2-smart-send-dual-times/run_case.sh index 54927dd..ba2f5c5 100755 --- a/10-wrappers/10-0-C/10-0-2-smart-send-dual-times/run_case.sh +++ b/10-wrappers/10-0-C/10-0-2-smart-send-dual-times/run_case.sh @@ -13,7 +13,7 @@ if [ -n "$1" ]; then cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_C_INCLUDE_DIR=$1 -DMUI_C_LIB_DIR=$2 else # Run cmake with the provided path as the MUI base directory - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DCMAKE_PREFIX_PATH=$1 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_BASE_DIR=$1 fi else # Run cmake with the default MUI directory diff --git a/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/CMakeLists.txt b/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/CMakeLists.txt index 9e40f09..a393654 100644 --- a/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/CMakeLists.txt +++ b/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/CMakeLists.txt @@ -10,33 +10,19 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(MUI_C_CPP_SEPERATE_PATH 0) - find_package(MPI REQUIRED) include_directories(${MPI_INCLUDE_PATH}) find_package(MUI REQUIRED) -if(DEFINED MUI_C_CPP_SEPERATE_PATH AND ${MUI_C_CPP_SEPERATE_PATH} EQUAL 1) - if(MUI_BASE_DIR) - include_directories(${MUI_INCLUDE_DIR}) - elseif(MUI_BASE_C_DIR) - set(MUI_C_LIB_DIR "${MUI_BASE_C_DIR}/lib") - set(MUI_C_INCLUDE_DIR "${MUI_BASE_C_DIR}/include/wrappers/C") - include_directories(${MUI_BASE_C_DIR}) - endif() -else() - if(MUI_BASE_DIR) - set(MUI_C_LIB_DIR "${MUI_LIB_DIR}") - set(MUI_C_INCLUDE_DIR "${MUI_INCLUDE_DIR}/wrappers/C") - include_directories(${MUI_INCLUDE_DIR}) - elseif(MUI_BASE_C_DIR) - set(MUI_C_LIB_DIR "${MUI_BASE_C_DIR}/lib") - set(MUI_C_INCLUDE_DIR "${MUI_BASE_C_DIR}/include/wrappers/C") - include_directories(${MUI_BASE_C_DIR}) - endif() +if(MUI_BASE_DIR) + set(MUI_C_LIB_DIR "${MUI_BASE_DIR}/lib") + set(MUI_C_INCLUDE_DIR "${MUI_BASE_DIR}/include/wrappers/C") + set(MUI_INCLUDE_DIR "${MUI_BASE_DIR}/include") + include_directories(${MUI_INCLUDE_DIR}) endif() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_COMPILE_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MPI_LINK_FLAGS}") diff --git a/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/run_case.sh b/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/run_case.sh index 4adf06d..f157c09 100755 --- a/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/run_case.sh +++ b/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/run_case.sh @@ -11,14 +11,14 @@ if [ -n "$1" ]; then if [ -n "$2" ]; then if [ -n "$3" ]; then # Run cmake with the provided path as the MUI include and lib directories - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_C_INCLUDE_DIR=$1 -DMUI_C_LIB_DIR=$2 -DCMAKE_PREFIX_PATH=$3 $4 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_C_INCLUDE_DIR=$1 -DMUI_C_LIB_DIR=$2 -DCMAKE_PREFIX_PATH=$3 else # Run cmake with the provided path as the MUI include and lib directories cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_C_INCLUDE_DIR=$1 -DMUI_C_LIB_DIR=$2 fi else # Run cmake with the provided path as the MUI base directory - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DCMAKE_PREFIX_PATH=$1 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_BASE_DIR=$1 -DCMAKE_PREFIX_PATH=$1/share/MUI-2.0/cmake fi else # Run cmake with the default MUI directory diff --git a/10-wrappers/10-0-C/10-0-4-basic-fixed-relaxation/CMakeLists.txt b/10-wrappers/10-0-C/10-0-4-basic-fixed-relaxation/CMakeLists.txt index d91c6cf..8ab4201 100644 --- a/10-wrappers/10-0-C/10-0-4-basic-fixed-relaxation/CMakeLists.txt +++ b/10-wrappers/10-0-C/10-0-4-basic-fixed-relaxation/CMakeLists.txt @@ -10,31 +10,15 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(MUI_C_CPP_SEPERATE_PATH 0) - find_package(MPI REQUIRED) include_directories(${MPI_INCLUDE_PATH}) find_package(MUI REQUIRED) -if(${MUI_C_CPP_SEPERATE_PATH} EQUAL 1) - if(MUI_BASE_DIR) - include_directories(${MUI_INCLUDE_DIR}) - elseif(MUI_BASE_C_DIR) - set(MUI_C_LIB_DIR "${MUI_BASE_C_DIR}/lib") - set(MUI_C_INCLUDE_DIR "${MUI_BASE_C_DIR}/include/wrappers/C") - include_directories(${MUI_BASE_C_DIR}) - endif() -else() - if(MUI_BASE_DIR) - set(MUI_C_LIB_DIR "${MUI_LIB_DIR}") - set(MUI_C_INCLUDE_DIR "${MUI_INCLUDE_DIR}/wrappers/C") - include_directories(${MUI_INCLUDE_DIR}) - elseif(MUI_BASE_C_DIR) - set(MUI_C_LIB_DIR "${MUI_BASE_C_DIR}/lib") - set(MUI_C_INCLUDE_DIR "${MUI_BASE_C_DIR}/include/wrappers/C") - include_directories(${MUI_BASE_C_DIR}) - endif() +if(MUI_BASE_DIR) + set(MUI_C_LIB_DIR "${MUI_BASE_DIR}/lib") + set(MUI_C_INCLUDE_DIR "${MUI_BASE_DIR}/include/wrappers/C") + include_directories(${MUI_INCLUDE_DIR}) endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_COMPILE_FLAGS}") diff --git a/10-wrappers/10-0-C/10-0-4-basic-fixed-relaxation/run_case.sh b/10-wrappers/10-0-C/10-0-4-basic-fixed-relaxation/run_case.sh index 7e3091e..1e67efc 100755 --- a/10-wrappers/10-0-C/10-0-4-basic-fixed-relaxation/run_case.sh +++ b/10-wrappers/10-0-C/10-0-4-basic-fixed-relaxation/run_case.sh @@ -11,14 +11,14 @@ if [ -n "$1" ]; then if [ -n "$2" ]; then if [ -n "$3" ]; then # Run cmake with the provided path as the MUI include and lib directories - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_C_INCLUDE_DIR=$1 -DMUI_C_LIB_DIR=$2 -DCMAKE_PREFIX_PATH=$3 $4 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_C_INCLUDE_DIR=$1 -DMUI_C_LIB_DIR=$2 -DCMAKE_PREFIX_PATH=$3 else # Run cmake with the provided path as the MUI include and lib directories cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_C_INCLUDE_DIR=$1 -DMUI_C_LIB_DIR=$2 fi else # Run cmake with the provided path as the MUI base directory - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DCMAKE_PREFIX_PATH=$1 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_BASE_DIR=$1 -DCMAKE_PREFIX_PATH=$1/share/MUI-2.0/cmake fi else # Run cmake with the default MUI directory diff --git a/10-wrappers/10-0-C/10-0-5-dynamic-points-aitken/CMakeLists.txt b/10-wrappers/10-0-C/10-0-5-dynamic-points-aitken/CMakeLists.txt index 2ba33b6..ecd3465 100644 --- a/10-wrappers/10-0-C/10-0-5-dynamic-points-aitken/CMakeLists.txt +++ b/10-wrappers/10-0-C/10-0-5-dynamic-points-aitken/CMakeLists.txt @@ -10,31 +10,15 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(MUI_C_CPP_SEPERATE_PATH 0) - find_package(MPI REQUIRED) include_directories(${MPI_INCLUDE_PATH}) find_package(MUI REQUIRED) -if(${MUI_C_CPP_SEPERATE_PATH} EQUAL 1) - if(MUI_BASE_DIR) - include_directories(${MUI_INCLUDE_DIR}) - elseif(MUI_BASE_C_DIR) - set(MUI_C_LIB_DIR "${MUI_BASE_C_DIR}/lib") - set(MUI_C_INCLUDE_DIR "${MUI_BASE_C_DIR}/include/wrappers/C") - include_directories(${MUI_BASE_C_DIR}) - endif() -else() - if(MUI_BASE_DIR) - set(MUI_C_LIB_DIR "${MUI_LIB_DIR}") - set(MUI_C_INCLUDE_DIR "${MUI_INCLUDE_DIR}/wrappers/C") - include_directories(${MUI_INCLUDE_DIR}) - elseif(MUI_BASE_C_DIR) - set(MUI_C_LIB_DIR "${MUI_BASE_C_DIR}/lib") - set(MUI_C_INCLUDE_DIR "${MUI_BASE_C_DIR}/include/wrappers/C") - include_directories(${MUI_BASE_C_DIR}) - endif() +if(MUI_BASE_DIR) + set(MUI_C_LIB_DIR "${MUI_BASE_DIR}/lib") + set(MUI_C_INCLUDE_DIR "${MUI_BASE_DIR}/include/wrappers/C") + include_directories(${MUI_INCLUDE_DIR}) endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_COMPILE_FLAGS}") diff --git a/10-wrappers/10-0-C/10-0-5-dynamic-points-aitken/run_case.sh b/10-wrappers/10-0-C/10-0-5-dynamic-points-aitken/run_case.sh index 7058fdd..2d6f845 100755 --- a/10-wrappers/10-0-C/10-0-5-dynamic-points-aitken/run_case.sh +++ b/10-wrappers/10-0-C/10-0-5-dynamic-points-aitken/run_case.sh @@ -11,14 +11,14 @@ if [ -n "$1" ]; then if [ -n "$2" ]; then if [ -n "$3" ]; then # Run cmake with the provided path as the MUI include and lib directories - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_C_INCLUDE_DIR=$1 -DMUI_C_LIB_DIR=$2 -DCMAKE_PREFIX_PATH=$3 $4 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_C_INCLUDE_DIR=$1 -DMUI_C_LIB_DIR=$2 -DCMAKE_PREFIX_PATH=$3 else # Run cmake with the provided path as the MUI include and lib directories cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_C_INCLUDE_DIR=$1 -DMUI_C_LIB_DIR=$2 fi else # Run cmake with the provided path as the MUI base directory - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DCMAKE_PREFIX_PATH=$1 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_BASE_DIR=$1 -DCMAKE_PREFIX_PATH=$1/share/MUI-2.0/cmake fi else # Run cmake with the default MUI directory diff --git a/10-wrappers/10-1-Fortran/10-1-0-simple/CMakeLists.txt b/10-wrappers/10-1-Fortran/10-1-0-simple/CMakeLists.txt index 5b8ee69..c153cec 100644 --- a/10-wrappers/10-1-Fortran/10-1-0-simple/CMakeLists.txt +++ b/10-wrappers/10-1-Fortran/10-1-0-simple/CMakeLists.txt @@ -14,15 +14,11 @@ include_directories(${MPI_INCLUDE_PATH}) find_package(MUI QUIET) if(MUI_BASE_DIR) - set(MUI_FORTRAN_LIB_DIR "${MUI_LIB_DIR}") + set(MUI_FORTRAN_LIB_DIR "${MUI_BASE_DIR}/lib") # Add the include directories - include_directories(${MUI_LIB_DIR}/mod) - set(MUI_FORTRAN_INCLUDE_DIR "${MUI_INCLUDE_DIR}/wrappers/Fortran") + include_directories(${MUI_BASE_DIR}/lib/mod) + set(MUI_FORTRAN_INCLUDE_DIR "${MUI_BASE_DIR}/include/wrappers/Fortran") include_directories(${MUI_INCLUDE_DIR}) -elseif(MUI_BASE_FORTRAN_DIR) - set(MUI_FORTRAN_LIB_DIR "${MUI_BASE_FORTRAN_DIR}/lib") - set(MUI_FORTRAN_INCLUDE_DIR "${MUI_BASE_FORTRAN_DIR}/include/wrappers/Fortran") - include_directories(${MUI_BASE_FORTRAN_DIR}) endif() find_library(MUI_FORTRAN_WRAPPER_LIB NAMES MUI_Fortran_wrapper PATHS ${MUI_FORTRAN_LIB_DIR}) diff --git a/10-wrappers/10-1-Fortran/10-1-0-simple/run_case.sh b/10-wrappers/10-1-Fortran/10-1-0-simple/run_case.sh index 934dc1f..2b308f8 100755 --- a/10-wrappers/10-1-Fortran/10-1-0-simple/run_case.sh +++ b/10-wrappers/10-1-Fortran/10-1-0-simple/run_case.sh @@ -13,7 +13,7 @@ if [ -n "$1" ]; then cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_FORTRAN_INCLUDE_DIR=$1 -DMUI_FORTRAN_LIB_DIR=$2 else # Run cmake with the provided path as the MUI base directory - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DCMAKE_PREFIX_PATH=$1 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_BASE_DIR=$1 fi else # Run cmake with the default MUI directory diff --git a/10-wrappers/10-1-Fortran/10-1-1-multiple-interfaces/CMakeLists.txt b/10-wrappers/10-1-Fortran/10-1-1-multiple-interfaces/CMakeLists.txt index 52a33c7..a8d3064 100644 --- a/10-wrappers/10-1-Fortran/10-1-1-multiple-interfaces/CMakeLists.txt +++ b/10-wrappers/10-1-Fortran/10-1-1-multiple-interfaces/CMakeLists.txt @@ -14,14 +14,11 @@ include_directories(${MPI_INCLUDE_PATH}) find_package(MUI QUIET) if(MUI_BASE_DIR) - set(MUI_FORTRAN_LIB_DIR "${MUI_LIB_DIR}") + set(MUI_FORTRAN_LIB_DIR "${MUI_BASE_DIR}/lib") # Add the include directories - include_directories(${MUI_LIB_DIR}/mod) - set(MUI_FORTRAN_INCLUDE_DIR "${MUI_INCLUDE_DIR}/wrappers/Fortran") + include_directories(${MUI_BASE_DIR}/lib/mod) + set(MUI_FORTRAN_INCLUDE_DIR "${MUI_BASE_DIR}/include/wrappers/Fortran") include_directories(${MUI_INCLUDE_DIR}) -elseif(MUI_BASE_FORTRAN_DIR) - set(MUI_FORTRAN_LIB_DIR "${MUI_BASE_FORTRAN_DIR}/lib") - set(MUI_FORTRAN_INCLUDE_DIR "${MUI_BASE_FORTRAN_DIR}/include/wrappers/Fortran") endif() find_library(MUI_FORTRAN_WRAPPER_LIB NAMES MUI_Fortran_wrapper PATHS ${MUI_FORTRAN_LIB_DIR}) diff --git a/10-wrappers/10-1-Fortran/10-1-1-multiple-interfaces/run_case.sh b/10-wrappers/10-1-Fortran/10-1-1-multiple-interfaces/run_case.sh index dd5f04c..260cf79 100755 --- a/10-wrappers/10-1-Fortran/10-1-1-multiple-interfaces/run_case.sh +++ b/10-wrappers/10-1-Fortran/10-1-1-multiple-interfaces/run_case.sh @@ -13,7 +13,7 @@ if [ -n "$1" ]; then cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_FORTRAN_INCLUDE_DIR=$1 -DMUI_FORTRAN_LIB_DIR=$2 else # Run cmake with the provided path as the MUI base directory - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DCMAKE_PREFIX_PATH=$1 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_BASE_DIR=$1 fi else # Run cmake with the default MUI directory diff --git a/10-wrappers/10-1-Fortran/10-1-2-smart-send-dual-times/CMakeLists.txt b/10-wrappers/10-1-Fortran/10-1-2-smart-send-dual-times/CMakeLists.txt index a16a786..72aef59 100644 --- a/10-wrappers/10-1-Fortran/10-1-2-smart-send-dual-times/CMakeLists.txt +++ b/10-wrappers/10-1-Fortran/10-1-2-smart-send-dual-times/CMakeLists.txt @@ -17,14 +17,11 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MPI_LINK_FLAGS}") find_package(MUI QUIET) if(MUI_BASE_DIR) - set(MUI_FORTRAN_LIB_DIR "${MUI_LIB_DIR}") + set(MUI_FORTRAN_LIB_DIR "${MUI_BASE_DIR}/lib") # Add the include directories - include_directories(${MUI_LIB_DIR}/mod) - set(MUI_FORTRAN_INCLUDE_DIR "${MUI_INCLUDE_DIR}/wrappers/Fortran") + include_directories(${MUI_BASE_DIR}/lib/mod) + set(MUI_FORTRAN_INCLUDE_DIR "${MUI_BASE_DIR}/include/wrappers/Fortran") include_directories(${MUI_INCLUDE_DIR}) -elseif(MUI_BASE_FORTRAN_DIR) - set(MUI_FORTRAN_LIB_DIR "${MUI_BASE_FORTRAN_DIR}/lib") - set(MUI_FORTRAN_INCLUDE_DIR "${MUI_BASE_FORTRAN_DIR}/include/wrappers/Fortran") endif() find_library(MUI_FORTRAN_WRAPPER_LIB NAMES MUI_Fortran_wrapper PATHS ${MUI_FORTRAN_LIB_DIR}) diff --git a/10-wrappers/10-1-Fortran/10-1-2-smart-send-dual-times/run_case.sh b/10-wrappers/10-1-Fortran/10-1-2-smart-send-dual-times/run_case.sh index e594b98..9b2f09c 100755 --- a/10-wrappers/10-1-Fortran/10-1-2-smart-send-dual-times/run_case.sh +++ b/10-wrappers/10-1-Fortran/10-1-2-smart-send-dual-times/run_case.sh @@ -13,7 +13,7 @@ if [ -n "$1" ]; then cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_FORTRAN_INCLUDE_DIR=$1 -DMUI_FORTRAN_LIB_DIR=$2 else # Run cmake with the provided path as the MUI base directory - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DCMAKE_PREFIX_PATH=$1 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_BASE_DIR=$1 fi else # Run cmake with the default MUI directory diff --git a/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/CMakeLists.txt b/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/CMakeLists.txt index 7028e7e..7efd1ee 100644 --- a/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/CMakeLists.txt +++ b/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/CMakeLists.txt @@ -12,8 +12,6 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(MUI_FORTRAN_CPP_SEPERATE_PATH 0) - find_package(MPI REQUIRED) include_directories(${MPI_INCLUDE_PATH}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_COMPILE_FLAGS}") @@ -21,26 +19,12 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MPI_LINK_FLAGS}") find_package(MUI REQUIRED) -if(${MUI_FORTRAN_CPP_SEPERATE_PATH} EQUAL 1) - if(MUI_BASE_DIR) - include_directories(${MUI_INCLUDE_DIR}) - elseif(MUI_BASE_FORTRAN_DIR) - set(MUI_FORTRAN_LIB_DIR "${MUI_BASE_FORTRAN_DIR}/lib") - set(MUI_FORTRAN_INCLUDE_DIR "${MUI_BASE_FORTRAN_DIR}/include/wrappers/Fortran") - include_directories(${MUI_BASE_FORTRAN_DIR}) - endif() -else() - if(MUI_BASE_DIR) - set(MUI_FORTRAN_LIB_DIR "${MUI_LIB_DIR}") - # Add the include directories - include_directories(${MUI_LIB_DIR}/mod) - set(MUI_FORTRAN_INCLUDE_DIR "${MUI_INCLUDE_DIR}/wrappers/Fortran") - include_directories(${MUI_INCLUDE_DIR}) - elseif(MUI_BASE_FORTRAN_DIR) - set(MUI_FORTRAN_LIB_DIR "${MUI_BASE_FORTRAN_DIR}/lib") - set(MUI_FORTRAN_INCLUDE_DIR "${MUI_BASE_FORTRAN_DIR}/include/wrappers/Fortran") - include_directories(${MUI_BASE_FORTRAN_DIR}) - endif() +if(MUI_BASE_DIR) + set(MUI_FORTRAN_LIB_DIR "${MUI_BASE_DIR}/lib") + # Add the include directories + include_directories(${MUI_BASE_DIR}/lib/mod) + set(MUI_FORTRAN_INCLUDE_DIR "${MUI_BASE_DIR}/include/wrappers/Fortran") + include_directories(${MUI_INCLUDE_DIR}) endif() find_library(MUI_FORTRAN_WRAPPER_LIB NAMES MUI_Fortran_wrapper PATHS ${MUI_FORTRAN_LIB_DIR}) diff --git a/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/run_case.sh b/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/run_case.sh index 107bf35..09edf63 100755 --- a/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/run_case.sh +++ b/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/run_case.sh @@ -11,14 +11,14 @@ if [ -n "$1" ]; then if [ -n "$2" ]; then if [ -n "$3" ]; then # Run cmake with the provided path as the MUI include and lib directories - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_FORTRAN_INCLUDE_DIR=$1 -DMUI_FORTRAN_LIB_DIR=$2 -DCMAKE_PREFIX_PATH=$3 $4 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_FORTRAN_INCLUDE_DIR=$1 -DMUI_FORTRAN_LIB_DIR=$2 -DCMAKE_PREFIX_PATH=$3 else # Run cmake with the provided path as the MUI include and lib directories cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_FORTRAN_INCLUDE_DIR=$1 -DMUI_FORTRAN_LIB_DIR=$2 fi else # Run cmake with the provided path as the MUI base directory - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DCMAKE_PREFIX_PATH=$1 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_BASE_DIR=$1 -DCMAKE_PREFIX_PATH=$1/share/MUI-2.0/cmake fi else # Run cmake with the default MUI directory diff --git a/10-wrappers/10-1-Fortran/10-1-4-basic-fixed-relaxation/CMakeLists.txt b/10-wrappers/10-1-Fortran/10-1-4-basic-fixed-relaxation/CMakeLists.txt index 72886ec..6f5a31c 100644 --- a/10-wrappers/10-1-Fortran/10-1-4-basic-fixed-relaxation/CMakeLists.txt +++ b/10-wrappers/10-1-Fortran/10-1-4-basic-fixed-relaxation/CMakeLists.txt @@ -12,8 +12,6 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(MUI_FORTRAN_CPP_SEPERATE_PATH 0) - find_package(MPI REQUIRED) include_directories(${MPI_INCLUDE_PATH}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_COMPILE_FLAGS}") @@ -21,26 +19,12 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MPI_LINK_FLAGS}") find_package(MUI REQUIRED) -if(${MUI_FORTRAN_CPP_SEPERATE_PATH} EQUAL 1) - if(MUI_BASE_DIR) - include_directories(${MUI_INCLUDE_DIR}) - elseif(MUI_BASE_FORTRAN_DIR) - set(MUI_FORTRAN_LIB_DIR "${MUI_BASE_FORTRAN_DIR}/lib") - set(MUI_FORTRAN_INCLUDE_DIR "${MUI_BASE_FORTRAN_DIR}/include/wrappers/Fortran") - include_directories(${MUI_BASE_FORTRAN_DIR}) - endif() -else() - if(MUI_BASE_DIR) - set(MUI_FORTRAN_LIB_DIR "${MUI_LIB_DIR}") - # Add the include directories - include_directories(${MUI_LIB_DIR}/mod) - set(MUI_FORTRAN_INCLUDE_DIR "${MUI_INCLUDE_DIR}/wrappers/Fortran") - include_directories(${MUI_INCLUDE_DIR}) - elseif(MUI_BASE_FORTRAN_DIR) - set(MUI_FORTRAN_LIB_DIR "${MUI_BASE_FORTRAN_DIR}/lib") - set(MUI_FORTRAN_INCLUDE_DIR "${MUI_BASE_FORTRAN_DIR}/include/wrappers/Fortran") - include_directories(${MUI_BASE_FORTRAN_DIR}) - endif() +if(MUI_BASE_DIR) + set(MUI_FORTRAN_LIB_DIR "${MUI_BASE_DIR}/lib") + # Add the include directories + include_directories(${MUI_BASE_DIR}/lib/mod) + set(MUI_FORTRAN_INCLUDE_DIR "${MUI_BASE_DIR}/include/wrappers/Fortran") + include_directories(${MUI_INCLUDE_DIR}) endif() find_library(MUI_FORTRAN_WRAPPER_LIB NAMES MUI_Fortran_wrapper PATHS ${MUI_FORTRAN_LIB_DIR}) diff --git a/10-wrappers/10-1-Fortran/10-1-4-basic-fixed-relaxation/run_case.sh b/10-wrappers/10-1-Fortran/10-1-4-basic-fixed-relaxation/run_case.sh index 18db999..877b6e3 100755 --- a/10-wrappers/10-1-Fortran/10-1-4-basic-fixed-relaxation/run_case.sh +++ b/10-wrappers/10-1-Fortran/10-1-4-basic-fixed-relaxation/run_case.sh @@ -11,14 +11,14 @@ if [ -n "$1" ]; then if [ -n "$2" ]; then if [ -n "$3" ]; then # Run cmake with the provided path as the MUI include and lib directories - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_FORTRAN_INCLUDE_DIR=$1 -DMUI_FORTRAN_LIB_DIR=$2 -DCMAKE_PREFIX_PATH=$3 $4 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_FORTRAN_INCLUDE_DIR=$1 -DMUI_FORTRAN_LIB_DIR=$2 -DCMAKE_PREFIX_PATH=$3 else # Run cmake with the provided path as the MUI include and lib directories cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_FORTRAN_INCLUDE_DIR=$1 -DMUI_FORTRAN_LIB_DIR=$2 fi else # Run cmake with the provided path as the MUI base directory - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DCMAKE_PREFIX_PATH=$1 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_BASE_DIR=$1 -DCMAKE_PREFIX_PATH=$1/share/MUI-2.0/cmake fi else # Run cmake with the default MUI directory diff --git a/10-wrappers/10-1-Fortran/10-1-5-dynamic-points-aitken/CMakeLists.txt b/10-wrappers/10-1-Fortran/10-1-5-dynamic-points-aitken/CMakeLists.txt index bf30206..9dcaa61 100644 --- a/10-wrappers/10-1-Fortran/10-1-5-dynamic-points-aitken/CMakeLists.txt +++ b/10-wrappers/10-1-Fortran/10-1-5-dynamic-points-aitken/CMakeLists.txt @@ -12,8 +12,6 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(MUI_FORTRAN_CPP_SEPERATE_PATH 0) - find_package(MPI REQUIRED) include_directories(${MPI_INCLUDE_PATH}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_COMPILE_FLAGS}") @@ -21,26 +19,12 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MPI_LINK_FLAGS}") find_package(MUI REQUIRED) -if(${MUI_FORTRAN_CPP_SEPERATE_PATH} EQUAL 1) - if(MUI_BASE_DIR) - include_directories(${MUI_INCLUDE_DIR}) - elseif(MUI_BASE_FORTRAN_DIR) - set(MUI_FORTRAN_LIB_DIR "${MUI_BASE_FORTRAN_DIR}/lib") - set(MUI_FORTRAN_INCLUDE_DIR "${MUI_BASE_FORTRAN_DIR}/include/wrappers/Fortran") - include_directories(${MUI_BASE_FORTRAN_DIR}) - endif() -else() - if(MUI_BASE_DIR) - set(MUI_FORTRAN_LIB_DIR "${MUI_LIB_DIR}") - # Add the include directories - include_directories(${MUI_LIB_DIR}/mod) - set(MUI_FORTRAN_INCLUDE_DIR "${MUI_INCLUDE_DIR}/wrappers/Fortran") - include_directories(${MUI_INCLUDE_DIR}) - elseif(MUI_BASE_FORTRAN_DIR) - set(MUI_FORTRAN_LIB_DIR "${MUI_BASE_FORTRAN_DIR}/lib") - set(MUI_FORTRAN_INCLUDE_DIR "${MUI_BASE_FORTRAN_DIR}/include/wrappers/Fortran") - include_directories(${MUI_BASE_FORTRAN_DIR}) - endif() +if(MUI_BASE_DIR) + set(MUI_FORTRAN_LIB_DIR "${MUI_BASE_DIR}/lib") + # Add the include directories + include_directories(${MUI_BASE_DIR}/lib/mod) + set(MUI_FORTRAN_INCLUDE_DIR "${MUI_BASE_DIR}/include/wrappers/Fortran") + include_directories(${MUI_INCLUDE_DIR}) endif() find_library(MUI_FORTRAN_WRAPPER_LIB NAMES MUI_Fortran_wrapper PATHS ${MUI_FORTRAN_LIB_DIR}) diff --git a/10-wrappers/10-1-Fortran/10-1-5-dynamic-points-aitken/run_case.sh b/10-wrappers/10-1-Fortran/10-1-5-dynamic-points-aitken/run_case.sh index 6ee931c..fb3e560 100755 --- a/10-wrappers/10-1-Fortran/10-1-5-dynamic-points-aitken/run_case.sh +++ b/10-wrappers/10-1-Fortran/10-1-5-dynamic-points-aitken/run_case.sh @@ -11,14 +11,14 @@ if [ -n "$1" ]; then if [ -n "$2" ]; then if [ -n "$3" ]; then # Run cmake with the provided path as the MUI include and lib directories - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_FORTRAN_INCLUDE_DIR=$1 -DMUI_FORTRAN_LIB_DIR=$2 -DCMAKE_PREFIX_PATH=$3 $4 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_FORTRAN_INCLUDE_DIR=$1 -DMUI_FORTRAN_LIB_DIR=$2 -DCMAKE_PREFIX_PATH=$3 else # Run cmake with the provided path as the MUI include and lib directories cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_FORTRAN_INCLUDE_DIR=$1 -DMUI_FORTRAN_LIB_DIR=$2 fi else # Run cmake with the provided path as the MUI base directory - cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DCMAKE_PREFIX_PATH=$1 + cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=../ .. -DMUI_BASE_DIR=$1 -DCMAKE_PREFIX_PATH=$1/share/MUI-2.0/cmake fi else # Run cmake with the default MUI directory diff --git a/10-wrappers/10-2-Python/10-2-5-dual-time-types/run_case.sh b/10-wrappers/10-2-Python/10-2-5-dual-time-types/run_case.sh index c82cdb0..8636b4f 100755 --- a/10-wrappers/10-2-Python/10-2-5-dual-time-types/run_case.sh +++ b/10-wrappers/10-2-Python/10-2-5-dual-time-types/run_case.sh @@ -24,7 +24,7 @@ START=$SECONDS # aborts. If a python process exit with failure all processes in MPI_COMM_WORLD # will be aborted so hangs are avoided. -mpirun -np 1 PUSHER_FETCHER_0 :\ +mpirun -np 1 ./PUSHER_FETCHER_0 :\ -np 1 python3 -m mpi4py PUSHER_FETCHER_1.py 2>&1 | tee output.log DURATION=$(( SECONDS - START )) From cecf8ded4994c93a5ea2becd8fb4200d26ac69a5 Mon Sep 17 00:00:00 2001 From: Wendi-L Date: Mon, 23 Oct 2023 17:10:21 +0100 Subject: [PATCH 5/5] Update pseudo diffusion demos for C and Fortran wrappers on new RBF functions --- .../10-0-3-pseudo-diffusion/3D-pseudo-diffusion-coarse.c | 5 ++--- .../10-0-3-pseudo-diffusion/3D-pseudo-diffusion-fine.cpp | 5 ++--- .../10-1-3-pseudo-diffusion/3D-pseudo-diffusion-coarse.f90 | 7 +++---- .../10-1-3-pseudo-diffusion/3D-pseudo-diffusion-fine.cpp | 5 ++--- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/3D-pseudo-diffusion-coarse.c b/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/3D-pseudo-diffusion-coarse.c index d6697d1..af1e60d 100644 --- a/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/3D-pseudo-diffusion-coarse.c +++ b/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/3D-pseudo-diffusion-coarse.c @@ -77,7 +77,6 @@ int main(int argc, char **argv) { /// Create rbf matrix folder char makedirMString[32]; sprintf(makedirMString, "rbfCoarseMatrix%d", mui_ranks); - mkdir(makedirMString, 0777); /// Define the name of MUI domain char *domain = (char*) malloc(strlen("coarseDomain") + 1); @@ -124,7 +123,7 @@ int main(int argc, char **argv) { int conservative = 1; double cutoff = 1e-9; int smoothFunc = 0; - int writeMatrix = 1; + int generateMatrix = 1; double cgSolveTol = 1e-6; int cgMaxIter = 500; int preconditioner= 1; @@ -248,7 +247,7 @@ int main(int argc, char **argv) { /// Define spatial and temporal samplers mui_sampler_rbf_2d *spatial_sampler2d = mui_create_sampler_rbf_2d(rSampler, point2d, point_count, basisFunc, conservative, - smoothFunc, writeMatrix, fileAddress, cutoff, cgSolveTol, cgMaxIter, pouSize, preconditioner, MUI_COMM_WORLD); + smoothFunc, generateMatrix, fileAddress, cutoff, cgSolveTol, cgMaxIter, pouSize, preconditioner, MUI_COMM_WORLD); mui_temporal_sampler_exact_2d *temporal_sampler2d = mui_create_temporal_sampler_exact_2d(8e-1); /// Commit ZERO step of MUI diff --git a/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/3D-pseudo-diffusion-fine.cpp b/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/3D-pseudo-diffusion-fine.cpp index 9f42ad6..6465037 100644 --- a/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/3D-pseudo-diffusion-fine.cpp +++ b/10-wrappers/10-0-C/10-0-3-pseudo-diffusion/3D-pseudo-diffusion-fine.cpp @@ -76,7 +76,6 @@ int main(int argc, char ** argv) { /// Create rbf matrix folder std::string makedirMString = "rbfFineMatrix" + std::to_string(rank); - mkdir(makedirMString.c_str(), 0777); /// Define the name of MUI domain std::string domain = "fineDomain"; @@ -103,7 +102,7 @@ int main(int argc, char ** argv) { bool conservative = true; double cutoff = 1e-9; bool smoothFunc = false; - bool writeMatrix = true; + bool generateMatrix = true; double cgSolveTol = 1e-6; int cgMaxIter = 500; int preconditioner= 1; @@ -279,7 +278,7 @@ int main(int argc, char ** argv) { /// Define spatial and temporal samplers mui::sampler_rbf2d spatial_sampler(rSampler, point2dvec, - basisFunc, conservative, smoothFunc, writeMatrix, fileAddress, + basisFunc, conservative, smoothFunc, generateMatrix, fileAddress, cutoff, cgSolveTol, cgMaxIter, pouSize, preconditioner, world); mui::temporal_sampler_exact2d temporal_sampler; diff --git a/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/3D-pseudo-diffusion-coarse.f90 b/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/3D-pseudo-diffusion-coarse.f90 index f9b1b7c..b8c3898 100644 --- a/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/3D-pseudo-diffusion-coarse.f90 +++ b/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/3D-pseudo-diffusion-coarse.f90 @@ -59,7 +59,7 @@ program main integer(c_int) :: basisFunc = 1 integer(c_int) :: conservative = 1 integer(c_int) :: smoothFunc = 0 - integer(c_int) :: writeMatrix = 1 + integer(c_int) :: generateMatrix = 1 integer(c_int) :: cgMaxIter = 500 integer(c_int) :: preconditioner = 1 integer(c_int) :: pouSize = 50 @@ -164,9 +164,8 @@ program main tolerance = (lx / (Nx - 1)) * 0.5 - ! Create rbf matrix folder + ! Define rbf matrix folder write(makedirMString,'(a,i0)') "rbfCoarseMatrix", mui_ranks - call system('mkdir -m 777 '//trim(makedirMString), ierr) fileAddress = TRIM(makedirMString) ! Check if directory was created successfully @@ -242,7 +241,7 @@ program main !Create spatial and temporal samplers for fetch operation call mui_create_sampler_rbf_2d_f(spatial_sampler_rbf_2d,rSampler,point2dY,point2dZ, & point_count,basisFunc,conservative,smoothFunc, & - writeMatrix,TRIM(makedirMString),cutoff,cgSolveTol, & + generateMatrix,TRIM(makedirMString),cutoff,cgSolveTol, & cgMaxIter,pouSize,preconditioner,MUI_COMM_WORLD) call mui_create_temporal_sampler_exact_2d_f(temporal_sampler_exact_2d, tolerance_sampler) diff --git a/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/3D-pseudo-diffusion-fine.cpp b/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/3D-pseudo-diffusion-fine.cpp index 579a4e6..b7605de 100644 --- a/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/3D-pseudo-diffusion-fine.cpp +++ b/10-wrappers/10-1-Fortran/10-1-3-pseudo-diffusion/3D-pseudo-diffusion-fine.cpp @@ -76,7 +76,6 @@ int main(int argc, char ** argv) { /// Create rbf matrix folder std::string makedirMString = "rbfFineMatrix" + std::to_string(rank); - mkdir(makedirMString.c_str(), 0777); /// Define the name of MUI domain std::string domain = "fineDomain"; @@ -103,7 +102,7 @@ int main(int argc, char ** argv) { bool conservative = true; double cutoff = 1e-9; bool smoothFunc = false; - bool writeMatrix = true; + bool generateMatrix = true; double cgSolveTol = 1e-6; int cgMaxIter = 500; int preconditioner= 1; @@ -279,7 +278,7 @@ int main(int argc, char ** argv) { /// Define spatial and temporal samplers mui::sampler_rbf2d spatial_sampler(rSampler, point2dvec, - basisFunc, conservative, smoothFunc, writeMatrix, fileAddress, + basisFunc, conservative, smoothFunc, generateMatrix, fileAddress, cutoff, cgSolveTol, cgMaxIter, pouSize, preconditioner, world); mui::temporal_sampler_exact2d temporal_sampler;