<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>k-Wave User Forum &#187; Topic: Help needed for error = &#34;Invalid format of the input file = iostream error&#34;</title>
		<link>http://www.k-wave.org/forum/topic/help-needed-for-error-invalid-format-of-the-input-file-iostream-error</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 06:52:23 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.k-wave.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.k-wave.org/forum/rss/topic/help-needed-for-error-invalid-format-of-the-input-file-iostream-error" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "Help needed for error = &#34;Invalid format of the input file = iostream error&#34;"</title>
			<link>http://www.k-wave.org/forum/topic/help-needed-for-error-invalid-format-of-the-input-file-iostream-error#post-7747</link>
			<pubDate>Wed, 19 Aug 2020 15:03:54 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">7747@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Dogu,&#60;/p&#62;
&#60;p&#62;Before we dive deeper into your script, can I check if you're using MATLAB 2020a? If so, see &#60;a href=&#34;http://www.k-wave.org/forum/topic/error-reading-h5-files-when-using-binaries&#34;&#62;this post&#60;/a&#62; and the work around that is required.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>dzaifoglu on "Help needed for error = &#34;Invalid format of the input file = iostream error&#34;"</title>
			<link>http://www.k-wave.org/forum/topic/help-needed-for-error-invalid-format-of-the-input-file-iostream-error#post-7738</link>
			<pubDate>Tue, 18 Aug 2020 20:46:00 +0000</pubDate>
			<dc:creator>dzaifoglu</dc:creator>
			<guid isPermaLink="false">7738@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hello,&#60;/p&#62;
&#60;p&#62;My name is Dogu and I am a PhD student from the mechanical engineering department of the University of Bath. I have been using k-Wave for a while now to simulate ultrasonic wave propagation into human soft tissue, and I am very thankful for this product that you have put forward. &#60;/p&#62;
&#60;p&#62;I'm at a stage where the simulation I'm running is too large for my machine to handle (6000 by 6000 2D simulation), hence I am getting the task computed on the University's supercomputer system. I have been attempting to run a C++ version of my simulation on the supercomputer, and to do this, I would produce a .h5 file by using the 'SaveToDisk' input of the function kspaceFirstOrder2D, upload it to my allocated space on the uni supercomputer memory and call it in as an input (-i) of the function kspaceFirstOrder-OMP. I am able to successfully generate the .h5 file on my machine with no problems and upload it to the uni server, yet when the uni supercomputer starts running the task, I get the following error message within seconds:&#60;/p&#62;
&#60;p&#62;&#34;K-Wave experienced a fatal error. Error = invalid format of the input file = iostream error&#34;&#60;/p&#62;
&#60;p&#62;I have tried a number of things yet I do not understand where this is going wrong. My best guess if that maybe I have a Matlab code line that is not C++ optimised. Below I have attached the the binbash script I use to remotely submit jobs, and the Matlab script that I use to generate the .h5 files. Any help or advice would be much, much appreciated, as time is ticking on my PhD. Many thanks in advance!&#60;/p&#62;
&#60;p&#62;Best, Dogu&#60;/p&#62;
&#60;p&#62;===========================================================&#60;br /&#62;
Job submission script:&#60;/p&#62;
&#60;p&#62;[11/08 11:40] James Grant&#60;br /&#62;
    Hi Dogu apologies for the delay here especially as it's quite a trivial issue that I should have spotted previously.  Linux file systems are case sensitive so Position2.h5 is different from position2.d5.  The copy command cp ../input.h5 . is only needed if the input file is in the directory above, you have it already in the same directory so your jobscript could be: &#60;/p&#62;
&#60;p&#62;#!/bin/bash&#60;br /&#62;
#SBATCH --nodes=1&#60;br /&#62;
#SBATCH --ntasks-per-node=24&#60;br /&#62;
#SBATCH --mem=60000&#60;br /&#62;
#SBATCH --time=6:00:00&#60;br /&#62;
#SBATCH --job-name=position2&#60;br /&#62;
#SBATCH --account=free&#60;br /&#62;
#SBATCH --partition=batch-sky&#60;br /&#62;
#SBATCH --mail-user=dz322@bath.ac.uk&#60;br /&#62;
#SBATCH --output=StdOut.o.%j&#60;br /&#62;
#SBATCH --error=StdErr.e.%j&#60;br /&#62;
module purge&#60;br /&#62;
module load slurm&#60;br /&#62;
module load matlab&#60;br /&#62;
module load hdf5/intel&#60;br /&#62;
module load intel/compiler/64/18.5.274&#60;br /&#62;
module load intel/mkl/64/18.5.274&#60;br /&#62;
module load fftw3/intel/avx/3.3.4&#60;br /&#62;
module load gcc/9.2.0&#60;br /&#62;
export OMP_NUM_THREADS=24&#60;br /&#62;
export OMP_PLACES=cores&#60;br /&#62;
export OMP_PROC_BIND=true&#60;br /&#62;
../k-Wave/kspaceFirstOrder-OMP/skylake/kspaceFirstOrder-OMP -i position1.h5 -o pos2_out.h5 --checkpoint_file check_pos2 --checkpoint_interval 20000&#60;/p&#62;
&#60;p&#62;===========================================================&#60;br /&#62;
Matlab script:&#60;br /&#62;
%4/6/2020&#60;/p&#62;
&#60;p&#62;%This is the script file to use to run scans at 5MHz into the human limb&#60;br /&#62;
%model.&#60;br /&#62;
%Script originates from the kWave example titled:&#60;br /&#62;
%Monopole Point Source In A Homogeneous Propagation Medium Example&#60;br /&#62;
%%&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% GETTING READY&#60;br /&#62;
% =========================================================================&#60;br /&#62;
clearvars;&#60;br /&#62;
close all;&#60;/p&#62;
&#60;p&#62;%Number of measurements to take.&#60;br /&#62;
m = 1;&#60;/p&#62;
&#60;p&#62;%Create the computational grid&#60;br /&#62;
%Number of grid points in x and y directions.&#60;br /&#62;
Nx = 6000;          Ny = 6000;&#60;br /&#62;
%Grid point spacings and side lengths in x and y directions [m].&#60;br /&#62;
dx = 2.3438e-05/4;      dy = dx;&#60;br /&#62;
X_SideLength = dx*Nx;   Y_SideLength = dy*Ny;&#60;br /&#62;
%Kwave function to create the medium.&#60;br /&#62;
kgrid = kWaveGrid(Nx, dx, Ny, dy);&#60;br /&#62;
% Space between consecutive measurements.&#60;br /&#62;
Gap =  round(0.0005/dx);&#60;br /&#62;
%Set medium dimensions.&#60;br /&#62;
medium.sound_speed = zeros(Ny,Nx);&#60;br /&#62;
medium.density = zeros(Ny,Nx);&#60;br /&#62;
%Set how long the simulation will go for.&#60;br /&#62;
EndTime = 100e-6;&#60;/p&#62;
&#60;p&#62;%%&#60;br /&#62;
%Define position number.&#60;br /&#62;
a = 1;&#60;br /&#62;
%Calculate amount of gap too move by, in gridpoints.&#60;br /&#62;
Shift = (a-1)*Gap;&#60;br /&#62;
%Run Medium Generator Function and shift muscle layer accordingly. Then,&#60;br /&#62;
%assign sound speed and density values.&#60;br /&#62;
Medium5MHz = MediumGeneratorFctn(Shift);&#60;br /&#62;
medium.sound_speed = Medium5MHz.SS;&#60;br /&#62;
medium.density = Medium5MHz.Den;&#60;br /&#62;
DM_OG = Medium5MHz.DM;&#60;br /&#62;
%Create the time array (kgrid.makeTime function).&#60;br /&#62;
kgrid.makeTime(medium.sound_speed);&#60;br /&#62;
%Set number of timesteps to measure.&#60;br /&#62;
kgrid.Nt = round(EndTime/kgrid.dt);&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% SOURCE &#38;amp; SENSOR&#60;/p&#62;
&#60;p&#62;% Define points needed for source size. For 13 mm,&#60;br /&#62;
half_of_probe = round((0.013/2)/dx);&#60;br /&#62;
source_freq = 5e6;   % [Hz]&#60;br /&#62;
source_mag = 2/(1500*1000)/65;         % [Pa]&#60;/p&#62;
&#60;p&#62;[display_mask,sensor,source] = SourcenSensor60mm5MHz(a,Nx,Ny,dx,Gap,half_of_probe,source_mag,source_freq,kgrid,DM_OG,medium);&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% EXECUTION OF 2D SIMULATION&#60;/p&#62;
&#60;p&#62;%Define the acoustic parameters to record&#60;br /&#62;
sensor.record = {'p', 'p_final'};&#60;br /&#62;
%Display Mask as input argument (PML Input can be adjusted here)&#60;br /&#62;
input_args = {'DisplayMask',display_mask};&#60;br /&#62;
% run the simulation&#60;br /&#62;
filename = 'position1';&#60;br /&#62;
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:},'SaveToDisk',filename);    %,input_args{:}&#60;br /&#62;
%Summing SensorData&#60;br /&#62;
sensor_data_sum = sum(sensor_data.p);&#60;br /&#62;
ScanData(a,:,:) = sensor_data.p;
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
