diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-06-09 10:14:42 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-06-09 10:14:42 +0200 |
commit | 17f52a1c725948befcc3dd3c90d1abad77b6f6fe (patch) | |
tree | 4b63c1bca261493511c7e806b60f289edfd738c2 /libgomp/config/linux | |
parent | 269edf4e5e6ab489730038f7e3495550623179fe (diff) | |
download | gcc-17f52a1c725948befcc3dd3c90d1abad77b6f6fe.zip gcc-17f52a1c725948befcc3dd3c90d1abad77b6f6fe.tar.gz gcc-17f52a1c725948befcc3dd3c90d1abad77b6f6fe.tar.bz2 |
openmp: Add support for HBW or large capacity or interleaved memory through the libmemkind.so library
This patch adds support for dlopening libmemkind.so on Linux and uses it
for some kinds of allocations (but not yet e.g. pinned memory).
2022-06-09 Jakub Jelinek <jakub@redhat.com>
* allocator.c: Include dlfcn.h if LIBGOMP_USE_MEMKIND is defined.
(enum gomp_memkind_kind): New type.
(struct omp_allocator_data): Add memkind field if LIBGOMP_USE_MEMKIND
is defined.
(struct gomp_memkind_data): New type.
(memkind_data, memkind_data_once): New variables.
(gomp_init_memkind, gomp_get_memkind): New functions.
(omp_init_allocator): Initialize data.memkind, don't fail for
omp_high_bw_mem_space if libmemkind supports it.
(omp_aligned_alloc, omp_free, omp_aligned_calloc, omp_realloc): Add
memkind support of LIBGOMP_USE_MEMKIND is defined.
* config/linux/allocator.c: New file.
Diffstat (limited to 'libgomp/config/linux')
-rw-r--r-- | libgomp/config/linux/allocator.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libgomp/config/linux/allocator.c b/libgomp/config/linux/allocator.c new file mode 100644 index 0000000..bef4e48 --- /dev/null +++ b/libgomp/config/linux/allocator.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + Contributed by Jakub Jelinek <jakub@redhat.com>. + + This file is part of the GNU Offloading and Multi Processing Library + (libgomp). + + Libgomp is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + +/* This file contains wrappers for the system allocation routines. Most + places in the OpenMP API do not make any provision for failure, so in + general we cannot allow memory allocation to fail. */ + +#define _GNU_SOURCE +#include "libgomp.h" +#if defined(PLUGIN_SUPPORT) && defined(LIBGOMP_USE_PTHREADS) +#define LIBGOMP_USE_MEMKIND +#endif + +#include "../../../allocator.c" |