2015-03-04 03:12:19 +00:00
|
|
|
//
|
2015-04-18 20:44:19 +01:00
|
|
|
// Grid.h
|
2015-03-04 03:12:19 +00:00
|
|
|
// simd
|
|
|
|
//
|
|
|
|
// Created by Peter Boyle on 09/05/2014.
|
|
|
|
// Copyright (c) 2014 University of Edinburgh. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
|
2015-04-18 18:36:48 +01:00
|
|
|
#ifndef GRID_H
|
|
|
|
#define GRID_H
|
2015-03-04 03:12:19 +00:00
|
|
|
|
2015-05-18 07:47:05 +01:00
|
|
|
#include <cassert>
|
2015-04-26 15:51:09 +01:00
|
|
|
|
2015-03-04 03:12:19 +00:00
|
|
|
#include <complex>
|
|
|
|
#include <vector>
|
2015-05-18 07:47:05 +01:00
|
|
|
|
2015-03-04 03:12:19 +00:00
|
|
|
#include <iostream>
|
2015-05-18 07:47:05 +01:00
|
|
|
#include <iomanip>
|
2015-03-04 03:12:19 +00:00
|
|
|
#include <random>
|
|
|
|
#include <functional>
|
2015-05-18 07:47:05 +01:00
|
|
|
|
|
|
|
#include <stdio.h>
|
2015-03-04 03:12:19 +00:00
|
|
|
#include <stdlib.h>
|
2015-03-04 04:13:07 +00:00
|
|
|
#include <sys/time.h>
|
|
|
|
#include <stdio.h>
|
2015-03-04 13:25:23 +00:00
|
|
|
#include <signal.h>
|
2015-03-04 03:12:19 +00:00
|
|
|
|
2015-05-13 00:31:00 +01:00
|
|
|
#ifndef MAX
|
|
|
|
#define MAX(x,y) ((x)>(y)?(x):(y))
|
|
|
|
#define MIN(x,y) ((x)>(y)?(y):(x))
|
|
|
|
#endif
|
|
|
|
|
2015-05-15 11:31:41 +01:00
|
|
|
#define strong_inline __attribute__((always_inline)) inline
|
|
|
|
|
2015-03-04 04:13:07 +00:00
|
|
|
#include <Grid_config.h>
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
// Tunable header includes
|
|
|
|
////////////////////////////////////////////////////////////
|
2015-03-04 13:44:33 +00:00
|
|
|
|
2015-03-04 04:13:07 +00:00
|
|
|
#ifdef HAVE_MALLOC_MALLOC_H
|
2015-03-04 03:12:19 +00:00
|
|
|
#include <malloc/malloc.h>
|
2015-03-04 04:13:07 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_MALLOC_H
|
2015-03-04 03:12:19 +00:00
|
|
|
#include <malloc.h>
|
|
|
|
#endif
|
|
|
|
|
2015-04-06 11:26:24 +01:00
|
|
|
#include <Grid_aligned_allocator.h>
|
2015-05-18 07:47:05 +01:00
|
|
|
|
2015-03-04 05:31:44 +00:00
|
|
|
#include <Grid_simd.h>
|
2015-05-11 18:59:03 +01:00
|
|
|
#include <Grid_threads.h>
|
|
|
|
|
2015-05-18 07:47:05 +01:00
|
|
|
#include <Grid_cartesian.h> // subdir aggregate
|
|
|
|
#include <Grid_math.h> // subdir aggregate
|
|
|
|
#include <Grid_lattice.h> // subdir aggregate
|
2015-04-09 07:06:03 +01:00
|
|
|
#include <Grid_comparison.h>
|
2015-05-18 07:47:05 +01:00
|
|
|
#include <Grid_cshift.h> // subdir aggregate
|
|
|
|
#include <Grid_stencil.h> // subdir aggregate
|
|
|
|
|
|
|
|
#include <Grid_algorithms.h>// subdir aggregate
|
|
|
|
|
2015-04-23 20:42:09 +01:00
|
|
|
#include <qcd/Grid_qcd.h>
|
2015-04-22 22:46:48 +01:00
|
|
|
#include <parallelIO/GridNerscIO.h>
|
2015-03-04 03:12:19 +00:00
|
|
|
|
2015-04-03 05:29:54 +01:00
|
|
|
namespace Grid {
|
2015-03-04 03:12:19 +00:00
|
|
|
|
2015-05-11 12:43:10 +01:00
|
|
|
|
2015-04-03 04:52:53 +01:00
|
|
|
void Grid_init(int *argc,char ***argv);
|
2015-04-10 04:22:36 +01:00
|
|
|
void Grid_finalize(void);
|
2015-05-11 18:59:03 +01:00
|
|
|
// internal, controled with --handle
|
2015-03-04 05:31:44 +00:00
|
|
|
void Grid_sa_signal_handler(int sig,siginfo_t *si,void * ptr);
|
|
|
|
void Grid_debug_handler_init(void);
|
2015-04-23 20:42:09 +01:00
|
|
|
void Grid_quiesce_nodes(void);
|
|
|
|
void Grid_unquiesce_nodes(void);
|
|
|
|
|
|
|
|
// C++11 time facilities better?
|
|
|
|
double usecond(void);
|
|
|
|
|
2015-05-12 20:41:44 +01:00
|
|
|
const std::vector<int> GridDefaultSimd(int dims,int nsimd);
|
2015-05-11 18:59:03 +01:00
|
|
|
const std::vector<int> &GridDefaultLatt(void);
|
|
|
|
const std::vector<int> &GridDefaultMpi(void);
|
|
|
|
const int &GridThreads(void) ;
|
|
|
|
void GridSetThreads(int t) ;
|
2015-03-04 03:12:19 +00:00
|
|
|
|
2015-05-11 12:43:10 +01:00
|
|
|
// Common parsing chores
|
|
|
|
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);
|
2015-05-11 14:36:48 +01:00
|
|
|
|
|
|
|
void GridParseLayout(char **argv,int argc,
|
|
|
|
std::vector<int> &latt,
|
2015-05-11 18:59:03 +01:00
|
|
|
std::vector<int> &simd,
|
2015-05-11 14:36:48 +01:00
|
|
|
std::vector<int> &mpi);
|
2015-05-11 12:43:10 +01:00
|
|
|
|
|
|
|
|
2015-03-04 03:12:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|