Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Lukas Weber
load_leveller
Commits
ade03b37
Commit
ade03b37
authored
Jun 07, 2019
by
Lukas Weber
Browse files
handle reading from zero size datasets properly
parent
c0ee1918
Changes
3
Hide whitespace changes
Inline
Side-by-side
python/loadleveller/clusterutils.py
View file @
ade03b37
...
...
@@ -4,12 +4,11 @@ import sys
batchscript_claix18
=
'''#!/usr/bin/env zsh
# Autogenerated
by loadleveller
targeting the claix18 cluster.
Do not edit.
# Autogenerated
jobscript
targeting the claix18 cluster.
#SBATCH --job-name={jobname}
#SBATCH --time={walltime}
#SBATCH --mem-per-cpu={mem_per_cpu}
##SBATCH --account={project} #TODO
#SBATCH --ntasks={num_cores}
#SBATCH --export=NONE
#SBATCH --output=output.%x
...
...
@@ -19,32 +18,38 @@ batchscript_claix18 = '''#!/usr/bin/env zsh
{mpirun} $FLAGS_MPI_BATCH {mc_cmd}
'''
batchscript_templates
=
{
'claix18'
:
batchscript_claix18
}
batch_commands
=
{
'claix18'
:
'sbatch {batchscript}'
}
valid_systems
=
[
'local'
,
'claix18'
]
def
generate_batchscript
(
template
,
cmd
,
jobname
,
jobconfig
):
def
generate_batchscript_claix18
(
cmd
,
jobname
,
jobconfig
):
template
=
batchscript_claix18
custom_cmds
=
''
if
'project'
in
jobconfig
:
custom_cmds
+=
'#SBATCH --account={}
\n
'
.
format
(
jobconfig
[
'project'
])
custom_cmds
+=
jobconfig
.
get
(
'custom_cmds'
,
''
)
try
:
return
template
.
format
(
jobname
=
jobname
,
mpirun
=
jobconfig
.
get
(
'mpirun'
,
'mpirun'
),
mem_per_cpu
=
jobconfig
.
get
(
'mem_per_cpu'
,
'2G'
),
walltime
=
jobconfig
[
'mc_walltime'
],
project
=
jobconfig
.
get
(
'project'
,
''
),
num_cores
=
jobconfig
[
'num_cores'
],
custom_cmds
=
jobconfig
.
get
(
'
custom_cmds
'
,
''
)
,
custom_cmds
=
custom_cmds
,
mc_cmd
=
' '
.
join
(
cmd
)
)
except
KeyError
as
e
:
print
(
'Error: required key "{}" missing in jobconfig'
.
format
(
e
.
args
[
0
]))
sys
.
exit
(
1
)
raise
Exception
(
'Error: required key "{}" missing in jobconfig'
.
format
(
e
.
args
[
0
]))
def
generate_batchscript
(
sysinfo
,
*
args
):
if
sysinfo
==
'claix18'
:
return
generate_batchscript_claix18
(
*
args
)
else
:
raise
Exception
(
'unknown system type {}'
.
format
(
sysinfo
))
def
determine_system
():
sysinfo
=
os
.
environ
.
get
(
'MCLL_SYSTEM_INFO'
)
...
...
@@ -71,7 +76,7 @@ def run(jobname, jobconfig, cmd):
os
.
system
(
mpicmd
)
else
:
with
tempfile
.
NamedTemporaryFile
(
mode
=
'w'
,
delete
=
False
)
as
f
:
batchscript
=
generate_batchscript
(
batchscript_templates
[
sysinfo
]
,
cmd
,
jobname
,
jobconfig
)
batchscript
=
generate_batchscript
(
sysinfo
,
cmd
,
jobname
,
jobconfig
)
print
(
batchscript
)
f
.
write
(
batchscript
)
bscriptname
=
f
.
name
...
...
src/dump.cpp
View file @
ade03b37
...
...
@@ -26,8 +26,8 @@ static herr_t H5Ewalk_cb(unsigned int n, const H5E_error2_t *err_desc, void *cli
char
*
maj_str
=
H5Eget_major
(
err_desc
->
maj_num
);
s
<<
fmt
::
format
(
"#{}: {}:{} in {}(): {}
\n
"
,
n
,
err_desc
->
file_name
,
err_desc
->
line
,
err_desc
->
func_name
,
err_desc
->
desc
);
s
<<
fmt
::
format
(
" {}: {}
\n
"
,
static_cast
<
int
>
(
err_desc
->
maj_num
),
maj_str
);
s
<<
fmt
::
format
(
" {}: {}
\n\n
"
,
static_cast
<
int
>
(
err_desc
->
min_num
),
min_str
);
s
<<
fmt
::
format
(
" {}: {}
\n
"
,
static_cast
<
int
32_t
>
(
err_desc
->
maj_num
),
maj_str
);
s
<<
fmt
::
format
(
" {}: {}
\n\n
"
,
static_cast
<
int
32_t
>
(
err_desc
->
min_num
),
min_str
);
free
(
min_str
);
free
(
maj_str
);
...
...
src/dump.h
View file @
ade03b37
...
...
@@ -240,6 +240,10 @@ void iodump::group::read(const std::string &name, std::vector<T> &data) const {
throw
iodump_exception
{
"H5Sget_simple_extent_npoints"
};
data
.
resize
(
size
);
if
(
size
==
0
)
{
// handle empty dataset correctly
return
;
}
herr_t
status
=
H5Dread
(
*
dataset
,
h5_datatype
<
T
>
(),
H5S_ALL
,
H5P_DEFAULT
,
H5P_DEFAULT
,
data
.
data
());
if
(
status
<
0
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment