Updated host info tool

这个提交包含在:
craig-warren
2023-03-11 12:21:42 -07:00
父节点 60d911d83b
当前提交 f182989128
共有 3 个文件被更改,包括 34 次插入19 次删除

查看文件

@@ -4,16 +4,21 @@
Accelerators - OpenMP/CUDA/OpenCL
*********************************
The most computationally intensive parts of gprMax, which are the FDTD solver loops, have been parallelised using:
The most computationally intensive parts of gprMax, which are the FDTD solver loops, have been parallelised using different CPU and GPU accelerators to offer performance and flexibility.
1. `OpenMP <http://openmp.org>`_ which supports multi-platform shared memory multiprocessing.
2. `NVIDIA CUDA <https://developer.nvidia.com/cuda-toolkit>`_ for NVIDIA GPUs.
3. `OpenCL <https://www.khronos.org/api/opencl>`_ for a wider range of CPU and GPU hardware.
Additionally the Message Passing Interface (MPI) has been utilised to implement a simple task farm that can be used to distribute a series of models as independent tasks. This can be useful in many GPR simulations where a B-scan (composed of multiple A-scans) is required. Each A-scan can be task-farmed as a independent model. Within each independent model OpenMP or CUDA accelerators described above can be used for parallelism. Overall this creates what is known as a mixed mode OpenMP/MPI or CUDA/MPI job.
Additionally the Message Passing Interface (MPI) can be utilised to implement a simple task farm that can be used to distribute a series of models as independent tasks. This can be useful in many GPR simulations where a B-scan (composed of multiple A-scans) is required. Each A-scan can be task-farmed as a independent model, and within each model OpenMP or CUDA can still be used for parallelism. This creates mixed mode OpenMP/MPI or CUDA/MPI environments.
Some of these accelerators and frameworks require additional software to be installed. The guidance below explains how to do that and gives examples of usage.
.. note::
You can use the ``get_host_spec.py`` module (in ``toolboxes/Utilities``) to help you understand what hardware (CPU/GPU) you have and how gprMax can use it with the aforementioned accelerators.
OpenMP
======

查看文件

@@ -6,12 +6,6 @@ Software Features
This section highlights some of the key features of gprMax that are useful for GPR modelling as well as more general electromagnetic simulations.
Python API
==========
TODO
The input file has now been made scriptable by permitting blocks of Python code to be specified between ``#python`` and ``#end_python`` commands. The code is executed when the input file is read by gprMax. You don't need any external tools, such as MATLAB, to generate larger, more complex input files for building intricate models. Python scripting means that gprMax now includes :ref:`libraries of more complex objects, such as antennas <antennas>`, that can be easily inserted into a model. You can also access a number of built-in constants from your Python code. For further details see the :ref:`Python section <python-scripting>`.
Dispersive materials
====================
@@ -53,6 +47,14 @@ Perfectly Matched Layer (PML) absorbing boundary conditions
With increased research into quantitative information from GPR, it has become necessary for models to be able to have more efficient and better-performing Perfectly Matched Layer (PML) absorbing boundary conditions. Since 2005 gprMax has featured PML absorbing boundary conditions based on the uniaxial PML (UPML) [GED1998]_ formulation. A PML based on a recursive integration approach to the complex frequency shifted (CFS) PML [GIA2012]_ has been adopted in the new version of gprMax. A general formulation of this RIPML, which can be used to develop any order of PML, has been used to implement first and second order CFS stretching functions. One of the attractions of the RIPML is that it is easily applied as a correction to the field quantities after the complete FDTD grid has been updated using the standard FDTD update equations. gprMax now offers the ability (for advanced users) to customise the parameters of the PML which allows its performance to be better optimised for specific applications. Additionally, since the RIPML is media agnostic it can be used without change to problems involving dispersive and anisotropic materials. For further details see the :ref:`PML commands section <pml-commands>`.
Python API
==========
TODO: UPDATE
************
The input file has now been made scriptable by permitting blocks of Python code to be specified between ``#python`` and ``#end_python`` commands. The code is executed when the input file is read by gprMax. You don't need any external tools, such as MATLAB, to generate larger, more complex input files for building intricate models. Python scripting means that gprMax now includes :ref:`libraries of more complex objects, such as antennas <antennas>`, that can be easily inserted into a model. You can also access a number of built-in constants from your Python code. For further details see the :ref:`Python section <python-scripting>`.
Open source, robust, file formats
=================================

查看文件

@@ -16,35 +16,43 @@
# You should have received a copy of the GNU General Public License
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
import logging
import humanize
from gprMax.utilities.host_info import (detect_cuda_gpus, detect_opencl,
get_host_info, print_cuda_info,
print_opencl_info)
from gprMax.utilities.utilities import get_terminal_width, human_size
from gprMax.utilities.utilities import get_terminal_width
logging.basicConfig(format='%(message)s', level=logging.INFO)
# Host machine info.
hostinfo = get_host_info()
hyperthreadingstr = f", {hostinfo['logicalcores']} cores with Hyper-Threading" if hostinfo['hyperthreading'] else ''
hostname = (f"\n=== {hostinfo['hostname']}")
print(f"{hostname} {'=' * (get_terminal_width() - len(hostname) - 1)}")
print(f"\n{'Mfr/model:':<12} {hostinfo['machineID']}")
print(f"{'CPU:':<12} {hostinfo['sockets']} x {hostinfo['cpuID']} ({hostinfo['physicalcores']} cores{hyperthreadingstr})")
print(f"{'RAM:':<12} {human_size(hostinfo['ram'], a_kilobyte_is_1024_bytes=True)}")
print(f"{'OS/Version:':<12} {hostinfo['osversion']}")
logging.info(f"{hostname} {'=' * (get_terminal_width() - len(hostname) - 1)}")
logging.info(f"\n{'Mfr/model:':<12} {hostinfo['machineID']}")
logging.info(f"{'CPU:':<12} {hostinfo['sockets']} x {hostinfo['cpuID']} " +
f"({hostinfo['physicalcores']} cores{hyperthreadingstr})")
logging.info(f"{'RAM:':<12} {humanize.naturalsize(hostinfo['ram'], True)}")
logging.info(f"{'OS/Version:':<12} {hostinfo['osversion']}")
# OpenMP
print("\n\n=== OpenMP capabilities (gprMax will not use Hyper-Threading with OpenMP as there is no performance advantage)\n")
print(f"{'OpenMP threads: '} {hostinfo['physicalcores']}")
logging.info("\n\n=== OpenMP capabilities (gprMax will not use Hyper-Threading " +
"as there is no performance advantage)\n")
logging.info(f"{'OpenMP threads: '} {hostinfo['physicalcores']}")
# CUDA
print("\n\n=== CUDA capabilities\n")
logging.info("\n\n=== CUDA capabilities\n")
gpus = detect_cuda_gpus()
if gpus:
print_cuda_info(gpus)
# OpenCL
print("\n\n=== OpenCL capabilities\n")
logging.info("\n\n=== OpenCL capabilities\n")
devs = detect_opencl()
if devs:
print_opencl_info(devs)
print(f"\n{'=' * (get_terminal_width() - 1)}\n")
logging.info(f"\n{'=' * (get_terminal_width() - 1)}\n")