简体   繁体   English

HDF5在线程错误中读取数据集

[英]HDF5 Read Dataset in Thread Error

I write Server Application which will send extracted data from HDF5 files to many clients simultaneously 我编写了服务器应用程序,它将从HDF5文件中提取的数据同时发送到许多客户端

There is a code (run in separate thread): 有一个代码(在单独的线程中运行):

var _fileID = H5F.open("C:\\Temp\\MLS-Aura_L2GP-Temperature_v03-33-c01_2012d347.he5", H5F.OpenMode.ACC_RDONLY);
H5D.open(_fileID, "/HDFEOS/SWATHS/Temperature/Data Fields/Temperature");
var space = H5D.getSpace(dataset);
var size = H5S.getSimpleExtentDims(space);
float[,] SatData = new float[size[0], size[1]];
var wrapArray = new H5Array<float>(SatData);
var dataType = H5D.getType(dataset);
H5D.read(dataset, dataType, wrapArray);

If I try to read HDF5 dataset in separate thread "H5D.read(dataset, dataType, wrapArray);" 如果我尝试在单独的线程“ H5D.read(dataset,dataType,wrapArray);”中读取HDF5数据集, with more than one thread, i have an Error: "Failed to read data to data set 5000001 with status -1" 一个以上的线程,我有一个错误:“无法将数据读取到状态为-1的数据集5000001”

What's the problem? 有什么问题?

HDF5 library should be compiled with threadsafe mode in order to be used in a multi threaded environment. HDF5库应该以线程安全模式进行编译,以便在多线程环境中使用。

./configure --enable-threadsafe ...

Yet, this configuration assure only threadsafety, but not thread parallelism. 但是,此配置仅确保线程安全,而不保证线程并行性。 In fact current HDF5 version 1.10 implements threadsafe mode with a very simple mutex protection, so every HDF5 operation called by multiple thread is actually serialized. 实际上,当前的HDF5版本1.10通过非常简单的互斥保护实现了线程安全模式,因此实际上由多线程调用的每个HDF5操作都被序列化了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM