mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-13 04:37:05 +01:00
Got command line args working
This commit is contained in:
@ -73,7 +73,11 @@ namespace Grid {
|
||||
std::string GridCmdOptionPayload(char ** begin, char ** end, const std::string & option);
|
||||
bool GridCmdOptionExists(char** begin, char** end, const std::string& option);
|
||||
void GridParseIntVector(std::string &str,std::vector<int> & vec);
|
||||
void GridParseLayout(char **argv,int argc,std::vector<int> &mpi,std::vector<int> &simd,std::vector<int> &latt);
|
||||
|
||||
void GridParseLayout(char **argv,int argc,
|
||||
std::vector<int> &simd,
|
||||
std::vector<int> &latt,
|
||||
std::vector<int> &mpi);
|
||||
|
||||
|
||||
};
|
||||
|
@ -2,42 +2,42 @@
|
||||
/* lib/Grid_config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* AVX */
|
||||
/* #undef AVX1 */
|
||||
#define AVX1 1
|
||||
|
||||
/* AVX2 */
|
||||
/* #undef AVX2 */
|
||||
|
||||
/* AVX512 */
|
||||
#define AVX512 1
|
||||
/* #undef AVX512 */
|
||||
|
||||
/* GRID_COMMS_MPI */
|
||||
/* #undef GRID_COMMS_MPI */
|
||||
#define GRID_COMMS_MPI 1
|
||||
|
||||
/* GRID_COMMS_NONE */
|
||||
#define GRID_COMMS_NONE 1
|
||||
/* #undef GRID_COMMS_NONE */
|
||||
|
||||
/* Define to 1 if you have the declaration of `be64toh', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL_BE64TOH 1
|
||||
#define HAVE_DECL_BE64TOH 0
|
||||
|
||||
/* Define to 1 if you have the declaration of `ntohll', and to 0 if you don't.
|
||||
*/
|
||||
#define HAVE_DECL_NTOHLL 0
|
||||
#define HAVE_DECL_NTOHLL 1
|
||||
|
||||
/* Define to 1 if you have the <endian.h> header file. */
|
||||
#define HAVE_ENDIAN_H 1
|
||||
/* #undef HAVE_ENDIAN_H */
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
/* #undef HAVE_GETTIMEOFDAY */
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#define HAVE_MALLOC_H 1
|
||||
/* #undef HAVE_MALLOC_H */
|
||||
|
||||
/* Define to 1 if you have the <malloc/malloc.h> header file. */
|
||||
/* #undef HAVE_MALLOC_MALLOC_H */
|
||||
#define HAVE_MALLOC_MALLOC_H 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
@ -78,6 +78,9 @@
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "grid"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "1.0"
|
||||
|
||||
|
@ -77,6 +77,9 @@
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
|
@ -76,54 +76,57 @@ void GridCmdOptionIntVector(std::string &str,std::vector<int> & vec)
|
||||
return;
|
||||
}
|
||||
|
||||
void GridParseLayout(char **argv,int argc,std::vector<int> &mpi,std::vector<int> &simd,std::vector<int> &latt)
|
||||
void GridParseLayout(char **argv,int argc,
|
||||
std::vector<int> &latt,
|
||||
std::vector<int> &simd,
|
||||
std::vector<int> &mpi)
|
||||
{
|
||||
mpi =std::vector<int>({1,1,1,1});
|
||||
#if defined(AVX) || defined (AVX2)
|
||||
simd=std::vector<int>({1,1,2,2});
|
||||
#endif
|
||||
latt=std::vector<int>({8,8,8,8});
|
||||
|
||||
#if defined(SSE4)
|
||||
simd=std::vector<int>({1,1,1,2});
|
||||
#endif
|
||||
#if defined(AVX1) || defined (AVX2)
|
||||
simd=std::vector<int>({1,1,2,2});
|
||||
#endif
|
||||
#if defined(AVX512)
|
||||
simd=std::vector<int>({1,2,2,2});
|
||||
#endif
|
||||
latt=std::vector<int>({8,8,8,8});
|
||||
|
||||
|
||||
std::string arg;
|
||||
if( GridCmdOptionExists(argv,argv+argc,"--mpi-layout") ){
|
||||
arg = GridCmdOptionPayload(argv,argv+argc,"--mpi-layout");
|
||||
if( GridCmdOptionExists(argv,argv+argc,"--mpi") ){
|
||||
arg = GridCmdOptionPayload(argv,argv+argc,"--mpi");
|
||||
GridCmdOptionIntVector(arg,mpi);
|
||||
std::cout<<"MPI ";
|
||||
for(int i=0;i<mpi.size();i++){
|
||||
std::cout<<mpi[i]<<" ";
|
||||
}
|
||||
std::cout<<std::endl;
|
||||
}
|
||||
if( GridCmdOptionExists(argv,argv+argc,"--simd-layout") ){
|
||||
arg= GridCmdOptionPayload(argv,argv+argc,"--simd-layout");
|
||||
if( GridCmdOptionExists(argv,argv+argc,"--simd") ){
|
||||
arg= GridCmdOptionPayload(argv,argv+argc,"--simd");
|
||||
GridCmdOptionIntVector(arg,simd);
|
||||
std::cout<<"SIMD ";
|
||||
for(int i=0;i<simd.size();i++){
|
||||
std::cout<<simd[i]<<" ";
|
||||
}
|
||||
std::cout<<std::endl;
|
||||
}
|
||||
if( GridCmdOptionExists(argv,argv+argc,"--lattice") ){
|
||||
arg= GridCmdOptionPayload(argv,argv+argc,"--lattice");
|
||||
if( GridCmdOptionExists(argv,argv+argc,"--grid") ){
|
||||
arg= GridCmdOptionPayload(argv,argv+argc,"--grid");
|
||||
GridCmdOptionIntVector(arg,latt);
|
||||
std::cout<<"Grid ";
|
||||
for(int i=0;i<latt.size();i++){
|
||||
std::cout<<latt[i]<<" ";
|
||||
}
|
||||
std::cout<<std::endl;
|
||||
}
|
||||
std::cout<<"MPI layout";
|
||||
for(int i=0;i<mpi.size();i++){
|
||||
std::cout<<mpi[i]<<" ";
|
||||
}
|
||||
std::cout<<std::endl;
|
||||
|
||||
std::cout<<"SIMD layout";
|
||||
for(int i=0;i<simd.size();i++){
|
||||
std::cout<<simd[i]<<" ";
|
||||
}
|
||||
std::cout<<std::endl;
|
||||
|
||||
std::cout<<"Grid ";
|
||||
for(int i=0;i<latt.size();i++){
|
||||
std::cout<<latt[i]<<" ";
|
||||
}
|
||||
std::cout<<std::endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Grid_finalize(void)
|
||||
{
|
||||
#ifdef GRID_COMMS_MPI
|
||||
|
@ -18,7 +18,7 @@ namespace Grid {
|
||||
//
|
||||
class GridTensorBase {};
|
||||
|
||||
template<class vtype> class iScalar :public GridTensorBase
|
||||
template<class vtype> class iScalar
|
||||
{
|
||||
public:
|
||||
vtype _internal;
|
||||
@ -105,7 +105,7 @@ template<class vtype> inline auto TensorRemove(iScalar<vtype> arg) -> decltype(T
|
||||
return TensorRemove(arg._internal);
|
||||
}
|
||||
|
||||
template<class vtype,int N> class iVector :public GridTensorBase
|
||||
template<class vtype,int N> class iVector
|
||||
{
|
||||
public:
|
||||
vtype _internal[N];
|
||||
@ -175,7 +175,7 @@ public:
|
||||
// }
|
||||
};
|
||||
|
||||
template<class vtype,int N> class iMatrix :public GridTensorBase
|
||||
template<class vtype,int N> class iMatrix
|
||||
{
|
||||
public:
|
||||
vtype _internal[N][N];
|
||||
|
Reference in New Issue
Block a user