Fixing copyright issues and code contributors
[alexxy/gromacs.git] / include / types / hw_info.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2012,2013, by the GROMACS development team, led by
5  * David van der Spoel, Berk Hess, Erik Lindahl, and including many
6  * others, as listed in the AUTHORS file in the top-level source
7  * directory and at http://www.gromacs.org.
8  *
9  * GROMACS is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * GROMACS is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with GROMACS; if not, see
21  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23  *
24  * If you want to redistribute modifications to GROMACS, please
25  * consider that scientific software is very special. Version
26  * control is crucial - bugs must be traceable. We will be happy to
27  * consider code for inclusion in the official distribution, but
28  * derived work must not be called official GROMACS. Details are found
29  * in the README & COPYING files - if they are missing, get the
30  * official version at http://www.gromacs.org.
31  *
32  * To help us fund GROMACS development, we humbly ask that you cite
33  * the research papers on the package. Check out http://www.gromacs.org.
34  */
35
36 #ifndef HWINFO_H
37 #define HWINFO_H
38
39 #include "simple.h"
40 #include "nbnxn_cuda_types_ext.h"
41 #include "../gmx_cpuid.h"
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 #if 0
47 } /* fixes auto-indentation problems */
48 #endif
49
50 /* Possible results of the GPU detection/check.
51  *
52  * The egpuInsane value means that during the sanity checks an error
53  * occurred that indicates malfunctioning of the device, driver, or
54  * incompatible driver/runtime. */
55 typedef enum
56 {
57     egpuCompatible = 0,  egpuNonexistent,  egpuIncompatible, egpuInsane
58 } e_gpu_detect_res_t;
59
60 /* Textual names of the GPU detection/check results (see e_gpu_detect_res_t). */
61 static const char * const gpu_detect_res_str[] =
62 {
63     "compatible", "inexistent", "incompatible", "insane"
64 };
65
66 /* GPU device information -- for now with only CUDA devices.
67  * The gmx_hardware_detect module initializes it. */
68 typedef struct 
69 {
70     gmx_bool            bUserSet;       /* true if the GPUs in cuda_dev_use are manually provided by the user */
71     gmx_bool            bDevShare;      /* true if any of the devices is shared by
72                                            (t)MPI ranks, with auto-detection always FALSE */
73
74     int                 ncuda_dev_use;  /* number of devices selected to be used */
75     int                 *cuda_dev_use;  /* index of the devices selected to be used */
76     int                 ncuda_dev;      /* total number of devices detected */
77     cuda_dev_info_ptr_t cuda_dev;       /* devices detected in the system (per node) */
78 } gmx_gpu_info_t;
79
80 /* Hardware information structure with CPU and GPU information.
81  * It is initialized by gmx_detect_hardware(). */
82 typedef struct
83 {
84     gmx_bool        bCanUseGPU; /* True if compatible GPUs are detected during hardware detection */
85     gmx_gpu_info_t  gpu_info;   /* Information about GPUs detected in the system */
86
87     gmx_cpuid_t     cpuid_info; /* CPUID information about CPU detected;
88                                    NOTE: this will only detect the CPU thread 0 of the
89                                    current process runs on. */
90     int             nthreads_hw_avail; /* Number of hardware threads available; this number
91                                          is based on the number of CPUs reported as available
92                                          by the OS at the time of detection. */
93 } gmx_hw_info_t;
94
95 #ifdef __cplusplus
96 }
97 #endif
98
99 #endif /* HWINFO_H */