Skip to content

Commit e20653c

Browse files
author
f-schmitt-zih
committed
Merge pull request #150 from ComputationalRadiationPhysics/release-1.2.4
Release 1.2.4
2 parents 3c88b5c + 13336d0 commit e20653c

File tree

5 files changed

+50
-17
lines changed

5 files changed

+50
-17
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
Change Log for libSplash
22
================================================================
33

4+
Release 1.2.4
5+
-------------
6+
**Date:** 2015-01-25
7+
8+
This release fixes a bug with parallel NULL reads.
9+
10+
**Bug Fixes**
11+
12+
- Fix Null-Access Parallel Read Hang #148
13+
- Fix compile error on Red Hat #147
14+
15+
416
Release 1.2.3
517
-------------
618
**Date:** 2014-10-14

src/DCDataSet.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ namespace splash
453453
// dst buffer is allowed to be NULL
454454
// in this case, only the size of the dataset is returned
455455
// if the dataset is empty, return just its size as there is nothing to read
456-
if ((dst != NULL) && (getNDims() > 0))
456+
if (getNDims() > 0)
457457
{
458458
log_msg(3,
459459
"\n ndims = %llu\n"
@@ -480,18 +480,23 @@ namespace splash
480480
if (dst_dataspace < 0)
481481
throw DCException(getExceptionString("read: Failed to create target dataspace"));
482482

483-
if (H5Sselect_hyperslab(dst_dataspace, H5S_SELECT_SET, dstOffset.getPointer(), NULL,
484-
srcSize.getPointer(), NULL) < 0 ||
485-
H5Sselect_valid(dst_dataspace) <= 0)
486-
throw DCException(getExceptionString("read: Target dataspace hyperslab selection is not valid!"));
487-
488-
if (H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, srcOffset.getPointer(), NULL,
489-
srcSize.getPointer(), NULL) < 0 ||
490-
H5Sselect_valid(dataspace) <= 0)
491-
throw DCException(getExceptionString("read: Source dataspace hyperslab selection is not valid!"));
483+
if (!dst) {
484+
H5Sselect_none(dst_dataspace);
485+
} else {
486+
if (H5Sselect_hyperslab(dst_dataspace, H5S_SELECT_SET, dstOffset.getPointer(), NULL,
487+
srcSize.getPointer(), NULL) < 0 ||
488+
H5Sselect_valid(dst_dataspace) <= 0)
489+
throw DCException(getExceptionString("read: Target dataspace hyperslab selection is not valid!"));
490+
}
492491

493-
if (srcSize.getScalarSize() == 0)
492+
if (!dst || srcSize.getScalarSize() == 0) {
494493
H5Sselect_none(dataspace);
494+
} else {
495+
if (H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, srcOffset.getPointer(), NULL,
496+
srcSize.getPointer(), NULL) < 0 ||
497+
H5Sselect_valid(dataspace) <= 0)
498+
throw DCException(getExceptionString("read: Source dataspace hyperslab selection is not valid!"));
499+
}
495500

496501
if (H5Dread(dataset, this->datatype, dst_dataspace, dataspace, dsetReadProperties, dst) < 0)
497502
throw DCException(getExceptionString("read: Failed to read dataset"));

src/include/splash/core/DCHelper.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include <map>
2828
#include <cmath>
29+
#include <cstdlib>
2930
#include <sstream>
3031
#include <iostream>
3132
#include <hdf5.h>
@@ -147,7 +148,7 @@ namespace splash
147148
while (current_chunk_size < target_chunk_size)
148149
{
149150
// test if increasing chunk size optimizes towards target chunk size
150-
size_t chunk_diff = std::abs(target_chunk_size - (current_chunk_size * 2));
151+
size_t chunk_diff = abs(target_chunk_size - (current_chunk_size * 2));
151152
if (chunk_diff >= last_chunk_diff)
152153
break;
153154

src/include/splash/version.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2013-2014 Felix Schmitt, Axel Huebl
2+
* Copyright 2013-2015 Felix Schmitt, Axel Huebl
33
*
44
* This file is part of libSplash.
55
*
@@ -26,7 +26,7 @@
2626
/** the splash version reflects the changes in API */
2727
#define SPLASH_VERSION_MAJOR 1
2828
#define SPLASH_VERSION_MINOR 2
29-
#define SPLASH_VERSION_PATCH 3
29+
#define SPLASH_VERSION_PATCH 4
3030

3131
/** we can always handle files from the same major release
3232
* changes in the minor number have to be backwards compatible

tests/Parallel_ZeroAccessTest.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,19 @@ void Parallel_ZeroAccessTest::testZeroAccess()
8484
/* test loops */
8585
for (size_t loop = 0; loop < NUM_TEST_LOOPS; ++loop)
8686
{
87+
int64_t *nullData = NULL;
88+
8789
/* clear data buffer */
8890
for (size_t i = 0; i < dataSize; ++i)
8991
data[i] = -1;
9092

9193
/* set and write number of data elements for this round */
9294
size_t elements = 0;
9395
size_t zeroAccess = rand() % 2;
94-
if (!zeroAccess)
95-
elements = (rand() % dataSize) + 1;
96+
if (!zeroAccess) {
97+
elements = (rand() % dataSize) + 1;
98+
nullData = new int64_t[elements];
99+
}
96100

97101
size_t readElements = 100000;
98102
for (size_t i = 0; i < elements; ++i)
@@ -149,8 +153,19 @@ void Parallel_ZeroAccessTest::testZeroAccess()
149153
/* read data for comparison */
150154
pdc->read(10, Dimensions(readElements, 1, 1), Dimensions(myOffset, 0, 0),
151155
"data", sizeRead, data);
152-
156+
153157
CPPUNIT_ASSERT(sizeRead == Dimensions(elements, 1, 1));
158+
159+
/* read data, use NULL ptr if none elements to read */
160+
pdc->read(10, Dimensions(readElements, 1, 1), Dimensions(myOffset, 0, 0),
161+
"data", sizeRead, nullData);
162+
163+
CPPUNIT_ASSERT(sizeRead == Dimensions(elements, 1, 1));
164+
165+
if (nullData)
166+
{
167+
delete[] nullData;
168+
}
154169

155170
for (size_t i = 0; i < dataSize; ++i)
156171
{

0 commit comments

Comments
 (0)