[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master d35c2dee: Library (pointer.h): solution for HP
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master d35c2dee: Library (pointer.h): solution for HPCs added to error message |
Date: |
Fri, 9 Feb 2024 08:35:59 -0500 (EST) |
branch: master
commit d35c2dee40badafbf8d884eb323fe6f414714b99
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Library (pointer.h): solution for HPCs added to error message
Until now, the error message that was printed when enough memory was
available (but none could be allocated) only described the problem, without
any potential solutions.
With this commit, after finding the cause and solution of the problem with
the help of Juan Castillo Ramírez, the description has been modified to
propose solutions for a user that confronts it.
---
THANKS | 1 +
doc/announce-acknowledge.txt | 1 +
lib/pointer.c | 41 ++++++++++++++++++++++++++++-------------
3 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/THANKS b/THANKS
index a75aef10..847b8b42 100644
--- a/THANKS
+++ b/THANKS
@@ -80,6 +80,7 @@ support in Gnuastro. The list is ordered alphabetically (by
family name).
Joseph Mazzarella mazz@ipac.caltech.edu
Joseph Putko josephputko@gmail.com
Juan Antonio Fernández Ontiveros jafernandez@cefca.es
+ Juan Castillo Ramírez jcastillo@cefca.es
Juan C. Tello jtello@iaa.es
Juan Miro miro.juan@gmail.com
Juan Molina Tobar juan.a.molina.t@gmail.com
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index ac22daa0..8742c476 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -1,6 +1,7 @@
Alphabetically ordered list to acknowledge in the next release.
Jesús Vega
+Juan Castillo Ramírez
Phil Wyett
Rahna Payyasseri Thanduparackal
diff --git a/lib/pointer.c b/lib/pointer.c
index 76a32897..b7d5bb3c 100644
--- a/lib/pointer.c
+++ b/lib/pointer.c
@@ -179,20 +179,35 @@ gal_pointer_mmap_allocate(uint8_t type, size_t size, int
clear,
if(out==MAP_FAILED)
{
if(allocfailed)
- fprintf(stderr, "\n%s: WARNING: 'malloc' or 'calloc' could not "
- "allocate %zu bytes in RAM, while there is space "
- "available (the problem is with the kernel/OS, not "
- "Gnuastro)! A subsequent attempt to use memory-mapping "
- "also failed (see message below).\n\n", __func__, bsize);
+ error(EXIT_FAILURE, 0, "%s: memory could not be allocated for "
+ "%zu bytes (with 'malloc' or 'calloc') while there is "
+ "space available in the RAM! A subsequent attempt to use "
+ "memory-mapping also failed ('%s' was created). If this "
+ "error is reported within a queue of submitted jobs on a "
+ "High Performance Computing (HPC) facility, it is most "
+ "probably due to resource restrictions imposed by the "
+ "job scheduler. For example if you use the Slurm Workload "
+ "Manager you should add '--mem=<float>G' (per node, where "
+ "'<float>' should be replaced by a the amount of memory "
+ "your require in Gigabytes) or '–mem-per-cpu=<float>G' to "
+ "your job submitting command ('sbatch'). If you use the "
+ "Sun Grid System (SGE) you should add "
+ "'-l h_vmem=<float>G' to your 'qsub' command", __func__,
+ bsize, *filename);
else
- fprintf(stderr, "\n%s: WARNING: the following error may be "
- "due to many mmap allocations. Recall that the kernel "
- "only allows finite number of mmap allocations. It is "
- "recommended to use ordinary RAM allocation for smaller "
- "arrays and keep mmap'd allocation only for the large "
- "volumes.\n\n", __func__);
- error(EXIT_FAILURE, errno, "couldn't map %zu bytes into the "
- "file '%s'", bsize, *filename);
+ {
+ /* This is using 'fprintf' first to avoid confusing the long
+ description of the potential solution with the actual error
+ message (that is printed with 'error'). */
+ fprintf(stderr, "\n%s: WARNING: the following error may be "
+ "due to many mmap allocations. Recall that the kernel "
+ "only allows finite number of mmap allocations. It is "
+ "recommended to use ordinary RAM allocation for smaller "
+ "arrays and keep mmap'd allocation only for the large "
+ "volumes.\n\n", __func__);
+ error(EXIT_FAILURE, errno, "couldn't map %zu bytes into the "
+ "file '%s'", bsize, *filename);
+ }
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master d35c2dee: Library (pointer.h): solution for HPCs added to error message,
Mohammad Akhlaghi <=