MADNESS  version 0.9
hardware.h
Go to the documentation of this file.
1 /*
2  This file is part of MADNESS.
3 
4  Copyright (C) 2013, Argonne National Laboratory
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or
8  without modification, are permitted provided that the
9  following conditions are met:
10 
11  * Redistributions of source code must retain the above copyright notice,
12  this list of conditions and the following disclaimer.
13  * Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27  DAMAGE.
28 
29  Original author:
30 
31  Jeff R. Hammond
32  Argonne National Laboratory
33  9700 S. Cass Ave.
34  Argonne, IL 60439
35 
36  email: jhammond@alcf.anl.gov
37 
38 */
39 
40 #ifndef MADNESS_WOLRD_HARDWARE_H__INCLUDED
41 #ifndef MADNESS_WOLRD_HARDWARE_H__INCLUDED
42 
43 #include <iostream>
44 #include <stdint.h>
45 
46 #if defined(__bgp__) || defined(__bgq__)
47 # include <mpi.h>
48 # if defined(__bgp__)
49 # define HARDWARE_RUNS_BGP
50 # include <dcmf.h>
51 # elif defined(__bgq__)
52 # define HARDWARE_RUNS_BGQ
53 # include <mpix.h>
54 # endif
55 #elif (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
56 # define HARDWARE_USE_SYSCTL
57 # include <sys/time.h>
58 # include <sys/types.h>
59 # include <sys/sysctl.h>
60 #elif defined(__unix__) || defined(__linux__)
61 # define HARDWARE_USE_SYSCONF
62 # include <unistd.h>
63 #else
64 # error U R EFFED
65 #endif
66 
67 #include <madness/world/worldexc.h>
68 
69 namespace madness {
70 
71  private:
72 
73  int hwthreads;
74  double cpufrequency;
75  int64_t memorysize;
76 
77 #if defined(__bgp__)
78  DCMF_Hardware_t bghw;
79 #elif defined(__bgq__)
80  MPIX_Hardware_t bghw;
81 #endif
82 
83  public:
84 
85  void Hardware::Initialize(void);
86  void Hardware::Print(std::ostream & out);
87 
88 }
89 
90 } // namespace madness
91 
92 #endif // MADNESS_WOLRD_HARDWARE_H__INCLUDED
int hwthreads
Definition: hardware.h:73
int64_t memorysize
Definition: hardware.h:75
double cpufrequency
Definition: hardware.h:74
Implements MadnessException.
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45