1 /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
4 * This file is part of GROMACS.
7 * Written by the Gromacs development team under coordination of
8 * David van der Spoel, Berk Hess, and Erik Lindahl.
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.
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
19 * Gromacs Runs On Most of All Computer Systems
26 #include "nbnxn_cuda_types_ext.h"
27 #include "../gmx_cpuid.h"
33 } /* fixes auto-indentation problems */
36 /* Possible results of the GPU detection/check.
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. */
43 egpuCompatible = 0, egpuNonexistent, egpuIncompatible, egpuInsane
46 /* Textual names of the GPU detection/check results (see e_gpu_detect_res_t). */
47 static const char * const gpu_detect_res_str[] =
49 "compatible", "inexistent", "incompatible", "insane"
52 /* GPU device information -- for now with only CUDA devices.
53 * The gmx_hardware_detect module initializes it. */
56 gmx_bool bUserSet; /* true if the GPUs in cuda_dev_use are manually provided by the user */
57 gmx_bool bDevShare; /* true if any of the devices is shared by
58 (t)MPI ranks, with auto-detection always FALSE */
60 int ncuda_dev_use; /* number of devices selected to be used */
61 int *cuda_dev_use; /* index of the devices selected to be used */
62 int ncuda_dev; /* total number of devices detected */
63 cuda_dev_info_ptr_t cuda_dev; /* devices detected in the system (per node) */
66 /* Hardware information structure with CPU and GPU information.
67 * It is initialized by gmx_detect_hardware(). */
70 gmx_bool bCanUseGPU; /* True if compatible GPUs are detected during hardware detection */
71 gmx_gpu_info_t gpu_info; /* Information about GPUs detected in the system */
73 gmx_cpuid_t cpuid_info; /* CPUID information about CPU detected;
74 NOTE: this will only detect the CPU thread 0 of the
75 current process runs on. */
76 int nthreads_hw_avail; /* Number of hardware threads available; this number
77 is based on the number of CPUs reported as available
78 by the OS at the time of detection. */