-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nour A Abouelnadar
committed
Dec 12, 2021
1 parent
ebe6089
commit cc72fe8
Showing
12 changed files
with
155 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#include <string> | ||
#include <vector> | ||
#include <chrono> | ||
|
||
#include <algorithm> | ||
#include <mpi.h> | ||
// include common component | ||
#include <common/Common.h> | ||
using namespace tlrmat; | ||
|
||
// include tlrmvm component | ||
#include <tlrmvm/Tlrmvm.h> | ||
using namespace tlrmvm; | ||
using namespace std; | ||
|
||
// This App is used to generate synthetic dataset as input of tlrmvm. | ||
// The rank is constant. | ||
|
||
struct Params{ | ||
int originM; | ||
int originN; | ||
int nb; | ||
int constrank; | ||
string acc; | ||
string datafolder; | ||
string problemname; | ||
string rankfile; | ||
string Ufile; | ||
string Vfile; | ||
string dtype; | ||
Params(){} | ||
}; | ||
|
||
|
||
|
||
template<typename T> | ||
void generate_data(Params & pm){ | ||
char rpath[100]; | ||
sprintf(rpath, "%s/%s_Rmat_nb%d_acc%s.bin", pm.datafolder.c_str(), pm.problemname.c_str(), pm.nb, pm.acc.c_str()); | ||
int nb = pm.nb; | ||
int mtiles = pm.originM / nb; | ||
if(pm.originM % nb != 0) mtiles++; | ||
int ntiles = pm.originN / nb; | ||
if(pm.originN % nb != 0) ntiles++; | ||
int paddingM = mtiles * nb; | ||
int paddingN = ntiles * nb; | ||
int grank = mtiles * ntiles * pm.constrank; | ||
T* uvec = new T[grank * nb]; | ||
T* vvec = new T[grank * nb]; | ||
T* xvec = new T[paddingN]; | ||
for(int i=0; i<grank*nb; i++) uvec[i] = (T)1.0; | ||
for(int i=0; i<grank*nb; i++) vvec[i] = (T)1.0; | ||
for(int i=0; i<paddingN; i++) xvec[i] = (T)1.0; | ||
int * rvec = new int[mtiles * ntiles]; | ||
for(int i=0; i<mtiles * ntiles; i++) rvec[i] = pm.constrank; | ||
char upath[100]; | ||
sprintf(upath, "%s/%s_Ubases_nb%d_acc%s.bin", pm.datafolder.c_str(), | ||
pm.problemname.c_str(), pm.nb, pm.acc.c_str()); | ||
char vpath[100]; | ||
sprintf(vpath, "%s/%s_Vbases_nb%d_acc%s.bin", pm.datafolder.c_str(), | ||
pm.problemname.c_str(), pm.nb, pm.acc.c_str()); | ||
char xpath[100]; | ||
sprintf(xpath, "%s/%s_x.bin", pm.datafolder.c_str(), | ||
pm.problemname.c_str()); | ||
auto umat = Matrix<T>(uvec, grank, nb); | ||
umat.Tofile(upath); | ||
auto vmat = Matrix<T>(vvec, grank, nb); | ||
vmat.Tofile(vpath); | ||
auto rmat = Matrix<int>(rvec, mtiles, ntiles); | ||
rmat.Tofile(rpath); | ||
auto xmat = Matrix<T>(xvec, paddingN, 1); | ||
xmat.Tofile(xpath); | ||
delete[] rvec; | ||
delete[] uvec; | ||
delete[] vvec; | ||
} | ||
|
||
int main(int argc, char** argv){ | ||
Params pm = Params(); | ||
vector<double> timestat; | ||
vector<double> bandstat; | ||
double bytesprocessed; | ||
size_t granksum; | ||
auto argparser = ArgsParser(argc, argv); | ||
pm.originM = argparser.getint("M"); | ||
pm.originN = argparser.getint("N"); | ||
pm.nb = argparser.getint("nb"); | ||
pm.acc = argparser.getstring("errorthreshold"); | ||
pm.problemname = argparser.getstring("problemname"); | ||
pm.datafolder = argparser.getstring("datafolder"); | ||
pm.constrank = argparser.getint("constrank"); | ||
pm.dtype = argparser.getstring("dtype"); | ||
if(pm.dtype == "float"){ | ||
generate_data<float>(pm); | ||
}else if(pm.dtype == "complexfloat"){ | ||
generate_data<complex<float>>(pm); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
./install/test/ex1basic_float --M=4802 --N=19078 \ | ||
--errorthreshold=0.0001 --problemname=mavis_000_R \ | ||
--datafolder=$WORK_ROOT --nb=256 | ||
|
||
./install/test/ex1basic_complexfloat --M=9801 --N=9801 \ | ||
--errorthreshold=0.001 --problemname=SeismicFreq100 \ | ||
--datafolder=$WORK_ROOT --nb=256 | ||
|
||
./install/test/ex1basic_float --M=4802 --N=19078 \ | ||
--errorthreshold=0.0001 --problemname=mavis_000_R \ | ||
--datafolder=$WORK_ROOT --nb=256 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
# for NEC, for some reason the proof of concept matrix is running very slow, | ||
# one can try to by pass the logic so that you can get speed up. | ||
|
||
OMP_NUM_THREADS=8 mpirun -ve 0-1 -np 2 \ | ||
./install/test/ex2mpitlrmvm_float --M=4802 --N=19078 \ | ||
--errorthreshold=0.0001 --problemname=mavis_000_R \ | ||
--datafolder=$WORK_ROOT --nb=256 --loopsize=5000 | ||
#135 us 1138.03 GB/s | ||
|
||
OMP_NUM_THREADS=8 mpirun -ve 0-1 -np 2 \ | ||
./install/test/ex2mpitlrmvm_complexfloat --M=9801 --N=9801 \ | ||
--errorthreshold=0.001 --problemname=SeismicFreq100 \ | ||
--datafolder=$WORK_ROOT --nb=256 | ||
--datafolder=$WORK_ROOT --nb=256 --loopsize=5000 | ||
# 262us, 1025.71 GB/s | ||
|
||
|
||
OMP_NUM_THREADS=8 mpirun -ve 0-1 -np 2 \ | ||
./install/test/ex2mpitlrmvm_float --M=4802 --N=19078 \ | ||
--errorthreshold=0.0001 --problemname=mavis_000_R \ | ||
--datafolder=$WORK_ROOT --nb=256 | ||
#135 us 1138.03 GB/s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# run on AMD Milan 2 sockets 1 cpu/socket | ||
|
||
OMP_NUM_THREADS=8 mpirun -np 16 --map-by L3cache:PE=8 \ | ||
./install/test/ex2mpitlrmvm_float --M=4802 --N=19078 \ | ||
--errorthreshold=0.0001 --problemname=Sytheticfloat \ | ||
--datafolder=$WORK_ROOT --nb=256 --loopsize=1000 | ||
|
||
OMP_NUM_THREADS=8 mpirun -np 16 --map-by L3cache:PE=8 \ | ||
./install/test/ex2mpitlrmvm_complexfloat --M=9801 --N=9801 \ | ||
--errorthreshold=0.001 --problemname=Sytheticcomplex \ | ||
--datafolder=$WORK_ROOT --nb=256 --loopsize=1000 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
OMP_NUM_THREADS=28 mpirun -np 2 --map-by L3cache:PE=28 \ | ||
./install/test/ex2mpitlrmvm_complexfloat --M=9801 --N=9801 \ | ||
--errorthreshold=0.001 --problemname=SeismicFreq100 \ | ||
--datafolder=$WORK_ROOT --nb=256 | ||
--datafolder=$WORK_ROOT --nb=256 --loopsize=5000 | ||
# 859us, 312.75 GB/s | ||
|
||
|
||
OMP_NUM_THREADS=28 mpirun -np 2 --map-by L3cache:PE=28 \ | ||
./install/test/ex2mpitlrmvm_float --M=4802 --N=19078 \ | ||
--errorthreshold=0.0001 --problemname=mavis_000_R \ | ||
--datafolder=$WORK_ROOT --nb=256 | ||
--datafolder=$WORK_ROOT --nb=256 --loopsize=5000 | ||
#400 us 384.0 GB/s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
./install/test/ex3_gendata --M=4802 --N=19078 \ | ||
--errorthreshold=0.0001 --problemname=Sytheticfloat \ | ||
--datafolder=$WORK_ROOT --nb=256 --constrank=100 --dtype=float | ||
|
||
./install/test/ex3_gendata --M=9801 --N=9801 \ | ||
--errorthreshold=0.001 --problemname=Sytheticcomplex \ | ||
--datafolder=$WORK_ROOT --nb=256 --constrank=100 --dtype=complexfloat | ||
|