From 1cdce9233ebf855409e05c1fca90bdbaa926677e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 16 Jan 2021 01:07:44 -0500 Subject: [PATCH] identify offloading to Xeon Phi accelerator coprocessors --- python/lammps/core.py | 7 ++++--- src/info.cpp | 6 ++++-- src/library.cpp | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index 3f39ead4b8..fe23fa587c 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -1442,9 +1442,10 @@ class lammps(object): This is a wrapper around the :cpp:func:`lammps_config_accelerator` function of the library interface which loops over all known packages - and settings and returns enabled features as a nested dictionary. + and categories and returns enabled features as a nested dictionary + with all enabled settings as list of strings. - :return: nested dictionary with all known enabled settings + :return: nested dictionary with all known enabled settings as list of strings :rtype: dictionary """ @@ -1453,7 +1454,7 @@ class lammps(object): result[p] = {} c = 'api' result[p][c] = [] - for s in ['cuda', 'hip', 'pthreads', 'opencl', 'openmp', 'serial']: + for s in ['cuda', 'hip', 'phi', 'pthreads', 'opencl', 'openmp', 'serial']: if self.lib.lammps_config_accelerator(p.encode(),c.encode(),s.encode()): result[p][c].append(s) c = 'precision' diff --git a/src/info.cpp b/src/info.cpp index 6ab4864f33..bf6f14a48a 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -360,7 +360,7 @@ void Info::command(int narg, char **arg) } if (has_package("USER-INTEL")) { mesg = "USER-INTEL package API:"; - if (has_accelerator_feature("USER-INTEL","api","knl")) mesg += " KNL"; + if (has_accelerator_feature("USER-INTEL","api","phi")) mesg += " Phi"; if (has_accelerator_feature("USER-INTEL","api","openmp")) mesg += " OpenMP"; mesg += "\nUSER-INTEL package precision:"; if (has_accelerator_feature("USER-INTEL","precision","single")) mesg += " single"; @@ -1254,7 +1254,9 @@ bool Info::has_accelerator_feature(const std::string &package, else return false; } if (category == "api") { -#if defined(_OPENMP) +#if defined(LMP_INTEL_OFFLOAD) + if (setting == "phi") return true; +#elif defined(_OPENMP) if (setting == "openmp") return true; #else if (setting == "serial") return true; diff --git a/src/library.cpp b/src/library.cpp index a4cfee979a..557d746226 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -4309,8 +4309,8 @@ int lammps_config_package_name(int idx, char *buffer, int buf_size) { This function checks availability of compile time settings of included :doc:`accelerator packages ` in LAMMPS. Supported packages names are "GPU", "KOKKOS", "USER-INTEL", and "USER-OMP". -Supported categories are "api" with possible settings "cuda", "hip", "knl", -"pthreads", "opencl", "openmp", and "none", and "precision" with +Supported categories are "api" with possible settings "cuda", "hip", "phi", +"pthreads", "opencl", "openmp", and "serial", and "precision" with possible settings "double", "mixed", and "single". If the combination of package, category, and setting is available, the function returns 1, otherwise 0.