Skip to content

Commit

Permalink
Merge pull request #150 from ComputationalRadiationPhysics/release-1.2.4
Browse files Browse the repository at this point in the history
Release 1.2.4
  • Loading branch information
f-schmitt-zih committed Jan 25, 2015
2 parents 3c88b5c + 13336d0 commit e20653c
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 17 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
Change Log for libSplash
================================================================

Release 1.2.4
-------------
**Date:** 2015-01-25

This release fixes a bug with parallel NULL reads.

**Bug Fixes**

- Fix Null-Access Parallel Read Hang #148
- Fix compile error on Red Hat #147


Release 1.2.3
-------------
**Date:** 2014-10-14
Expand Down
27 changes: 16 additions & 11 deletions src/DCDataSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ namespace splash
// dst buffer is allowed to be NULL
// in this case, only the size of the dataset is returned
// if the dataset is empty, return just its size as there is nothing to read
if ((dst != NULL) && (getNDims() > 0))
if (getNDims() > 0)
{
log_msg(3,
"\n ndims = %llu\n"
Expand All @@ -480,18 +480,23 @@ namespace splash
if (dst_dataspace < 0)
throw DCException(getExceptionString("read: Failed to create target dataspace"));

if (H5Sselect_hyperslab(dst_dataspace, H5S_SELECT_SET, dstOffset.getPointer(), NULL,
srcSize.getPointer(), NULL) < 0 ||
H5Sselect_valid(dst_dataspace) <= 0)
throw DCException(getExceptionString("read: Target dataspace hyperslab selection is not valid!"));

if (H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, srcOffset.getPointer(), NULL,
srcSize.getPointer(), NULL) < 0 ||
H5Sselect_valid(dataspace) <= 0)
throw DCException(getExceptionString("read: Source dataspace hyperslab selection is not valid!"));
if (!dst) {
H5Sselect_none(dst_dataspace);
} else {
if (H5Sselect_hyperslab(dst_dataspace, H5S_SELECT_SET, dstOffset.getPointer(), NULL,
srcSize.getPointer(), NULL) < 0 ||
H5Sselect_valid(dst_dataspace) <= 0)
throw DCException(getExceptionString("read: Target dataspace hyperslab selection is not valid!"));
}

if (srcSize.getScalarSize() == 0)
if (!dst || srcSize.getScalarSize() == 0) {
H5Sselect_none(dataspace);
} else {
if (H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, srcOffset.getPointer(), NULL,
srcSize.getPointer(), NULL) < 0 ||
H5Sselect_valid(dataspace) <= 0)
throw DCException(getExceptionString("read: Source dataspace hyperslab selection is not valid!"));
}

if (H5Dread(dataset, this->datatype, dst_dataspace, dataspace, dsetReadProperties, dst) < 0)
throw DCException(getExceptionString("read: Failed to read dataset"));
Expand Down
3 changes: 2 additions & 1 deletion src/include/splash/core/DCHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <map>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <iostream>
#include <hdf5.h>
Expand Down Expand Up @@ -147,7 +148,7 @@ namespace splash
while (current_chunk_size < target_chunk_size)
{
// test if increasing chunk size optimizes towards target chunk size
size_t chunk_diff = std::abs(target_chunk_size - (current_chunk_size * 2));
size_t chunk_diff = abs(target_chunk_size - (current_chunk_size * 2));
if (chunk_diff >= last_chunk_diff)
break;

Expand Down
4 changes: 2 additions & 2 deletions src/include/splash/version.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2013-2014 Felix Schmitt, Axel Huebl
* Copyright 2013-2015 Felix Schmitt, Axel Huebl
*
* This file is part of libSplash.
*
Expand All @@ -26,7 +26,7 @@
/** the splash version reflects the changes in API */
#define SPLASH_VERSION_MAJOR 1
#define SPLASH_VERSION_MINOR 2
#define SPLASH_VERSION_PATCH 3
#define SPLASH_VERSION_PATCH 4

/** we can always handle files from the same major release
* changes in the minor number have to be backwards compatible
Expand Down
21 changes: 18 additions & 3 deletions tests/Parallel_ZeroAccessTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,19 @@ void Parallel_ZeroAccessTest::testZeroAccess()
/* test loops */
for (size_t loop = 0; loop < NUM_TEST_LOOPS; ++loop)
{
int64_t *nullData = NULL;

/* clear data buffer */
for (size_t i = 0; i < dataSize; ++i)
data[i] = -1;

/* set and write number of data elements for this round */
size_t elements = 0;
size_t zeroAccess = rand() % 2;
if (!zeroAccess)
elements = (rand() % dataSize) + 1;
if (!zeroAccess) {
elements = (rand() % dataSize) + 1;
nullData = new int64_t[elements];
}

size_t readElements = 100000;
for (size_t i = 0; i < elements; ++i)
Expand Down Expand Up @@ -149,8 +153,19 @@ void Parallel_ZeroAccessTest::testZeroAccess()
/* read data for comparison */
pdc->read(10, Dimensions(readElements, 1, 1), Dimensions(myOffset, 0, 0),
"data", sizeRead, data);

CPPUNIT_ASSERT(sizeRead == Dimensions(elements, 1, 1));

/* read data, use NULL ptr if none elements to read */
pdc->read(10, Dimensions(readElements, 1, 1), Dimensions(myOffset, 0, 0),
"data", sizeRead, nullData);

CPPUNIT_ASSERT(sizeRead == Dimensions(elements, 1, 1));

if (nullData)
{
delete[] nullData;
}

for (size_t i = 0; i < dataSize; ++i)
{
Expand Down

0 comments on commit e20653c

Please sign in to comment.