Python Forum
Fastest way to subtract elements of datasets of HDF5 file?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fastest way to subtract elements of datasets of HDF5 file?
#2
You want to subtract two vectors of size N; What is the order of N? N = 10000, 100000? or 10^9. what is the type of data to be subtracted? integer, double, how many bytes per each value?

Lets imagine likely the most efficient way to make subtraction of these large arrays. We store the first array (suppose 8 bytes per element) into binary file. The second array is stored in another file. We assume that these files are large and we cannot load any of them into memory.

Theoretically, we can write a program, e.g. in C, that reads these both files by chunks (since each element 8 bytes, we can read , e.g. 8*10^6 bytes at a time), do computation with these chunks, and put the result into another binary file. That would be very efficient approach; No Python, no any additional heavy libraries (like pandas, numpy etc), no overkills related with hdf-format! The bottleneck would be i/o operations, how fast is your hdd; is it ssd?! Finally, you can convert output binary file into hdf-file, if needed...

So, is this way appropriate for you? What about your hardware?
Reply


Messages In This Thread
RE: Fastest way to subtract elements of datasets of HDF5 file? - by scidam - Jul-31-2020, 04:10 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Printing file path of lift elements dyerlee91 1 1,540 Sep-27-2021, 01:22 PM
Last Post: snippsat
  [solved] Save a matplotlib figure into hdf5 file paul18fr 1 2,551 Jun-08-2021, 05:58 PM
Last Post: paul18fr
  How to subtract columns with dates? jpy 3 2,279 Dec-29-2020, 12:11 AM
Last Post: jpy
  Accessing details of chunks in HDF5 file Robotguy 0 1,589 Aug-29-2020, 06:51 AM
Last Post: Robotguy
  How to sort a HDF5 file Robotguy 1 3,114 Jul-23-2020, 05:34 PM
Last Post: DeaD_EyE
  Datasets lErn1324 1 1,540 Jul-17-2020, 06:29 PM
Last Post: Larz60+
  Formula with elements of list - If-condition regarding the lists elements lewielewis 2 2,779 May-08-2020, 01:41 PM
Last Post: nnk
  Datasets of grammatically uncommon sentences? regstuff 3 2,226 Nov-03-2019, 07:02 PM
Last Post: Larz60+
  Groupby in pandas with conditional - add and subtract rregorr 2 7,001 Jul-12-2019, 05:17 PM
Last Post: rregorr
  Subtract rows (like r[1]-r[2] and r[3]-r[3]) and no pandas pradeepkumarbe 1 2,627 Dec-18-2018, 01:16 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020