Merge origin/release-4-6 into master
[alexxy/gromacs.git] / src / gromacs / legacyheaders / types / hw_info.h
1 /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
2  *
3  * 
4  * This file is part of GROMACS.
5  * Copyright (c) 2012-  
6  *
7  * Written by the Gromacs development team under coordination of
8  * David van der Spoel, Berk Hess, and Erik Lindahl.
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * To help us fund GROMACS development, we humbly ask that you cite
16  * the research papers on the package. Check out http://www.gromacs.org
17  * 
18  * And Hey:
19  * Gromacs Runs On Most of All Computer Systems
20  */
21
22 #ifndef HWINFO_H
23 #define HWINFO_H
24
25 #include "simple.h"
26 #include "nbnxn_cuda_types_ext.h"
27 #include "../gmx_cpuid.h"
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 #if 0
33 } /* fixes auto-indentation problems */
34 #endif
35
36 /* Possible results of the GPU detection/check.
37  *
38  * The egpuInsane value means that during the sanity checks an error
39  * occurred that indicates malfunctioning of the device, driver, or
40  * incompatible driver/runtime. */
41 typedef enum
42 {
43     egpuCompatible = 0,  egpuNonexistent,  egpuIncompatible, egpuInsane
44 } e_gpu_detect_res_t;
45
46 /* Textual names of the GPU detection/check results (see e_gpu_detect_res_t). */
47 static const char * const gpu_detect_res_str[] =
48 {
49     "compatible", "inexistent", "incompatible", "insane"
50 };
51
52 /* GPU device information -- for now with only CUDA devices.
53  * The gmx_hardware_detect module initializes it. */
54 typedef struct 
55 {
56     gmx_bool            bUserSet;       /* true if the GPUs in cuda_dev_use are manually provided by the user */
57
58     int                 ncuda_dev_use;  /* number of devices selected to be used */
59     int                 *cuda_dev_use;  /* index of the devices selected to be used */
60     int                 ncuda_dev;      /* total number of devices detected */
61     cuda_dev_info_ptr_t cuda_dev;       /* devices detected in the system (per node) */
62 } gmx_gpu_info_t;
63
64 /* Hardware information structure with CPU and GPU information.
65  * It is initialized by gmx_detect_hardware(). */
66 typedef struct
67 {
68     gmx_bool        bCanUseGPU; /* True if compatible GPUs are detected during hardware detection */
69     gmx_gpu_info_t  gpu_info;   /* Information about GPUs detected in the system */
70
71     gmx_cpuid_t     cpuid_info; /* CPUID information about CPU detected;
72                                    NOTE: this will only detect the CPU thread 0 of the
73                                    current process runs on. */
74     int             nthreads_hw_avail; /* Number of hardware threads available; this number
75                                          is based on the number of CPUs reported as available
76                                          by the OS at the time of detection. */
77 } gmx_hw_info_t;
78
79 #ifdef __cplusplus
80 }
81 #endif
82
83 #endif /* HWINFO_H */