<?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: Extending checkpoint functionality</title>
		<link>http://www.k-wave.org/forum/topic/extending-checkpoint-functionality</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 23:27:41 +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/extending-checkpoint-functionality" rel="self" type="application/rss+xml" />

		<item>
			<title>Jiri Jaros on "Extending checkpoint functionality"</title>
			<link>http://www.k-wave.org/forum/topic/extending-checkpoint-functionality#post-6146</link>
			<pubDate>Mon, 09 Oct 2017 11:53:38 +0000</pubDate>
			<dc:creator>Jiri Jaros</dc:creator>
			<guid isPermaLink="false">6146@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Sebastian,&#60;/p&#62;
&#60;p&#62;h5dump -d 't_index'  output_data_128_128_128_het_cuboid.h5 &#124; grep '(0,0,0)' &#124; cut  -c13-&#60;br /&#62;
h5dump -d 'Nt'  output_data_128_128_128_het_cuboid.h5 &#124; grep '(0,0,0)' &#124; cut  -c13-&#60;/p&#62;
&#60;p&#62;give you those two numbers. &#60;/p&#62;
&#60;p&#62;This is a better way than checking the timestamps. &#60;/p&#62;
&#60;p&#62;Best,&#60;br /&#62;
Jiri
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bastlwastl on "Extending checkpoint functionality"</title>
			<link>http://www.k-wave.org/forum/topic/extending-checkpoint-functionality#post-6145</link>
			<pubDate>Mon, 09 Oct 2017 11:34:13 +0000</pubDate>
			<dc:creator>bastlwastl</dc:creator>
			<guid isPermaLink="false">6145@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Jiri,&#60;/p&#62;
&#60;p&#62;well, that sounds reasonable, thanks for the advice. Still, a bit of bash scripting would be required, h5dump gives me a lot of information that needs to be cut away. So, the time solution is working fine for me.&#60;/p&#62;
&#60;p&#62;Best regards,&#60;br /&#62;
Sebastian
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Jiri Jaros on "Extending checkpoint functionality"</title>
			<link>http://www.k-wave.org/forum/topic/extending-checkpoint-functionality#post-6144</link>
			<pubDate>Mon, 09 Oct 2017 09:20:25 +0000</pubDate>
			<dc:creator>Jiri Jaros</dc:creator>
			<guid isPermaLink="false">6144@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Sebastian,&#60;br /&#62;
There is an easy way to figure out the simulation has completely ended. When you open the output file, you can read datasets called t_index and Nt, where t_index says the time step the simulation was interrupted and Nt says the total number of time steps in the simulation.&#60;/p&#62;
&#60;p&#62;Thus, if (t_index == Nt) then the simulation has ended&#60;br /&#62;
else you need to run another leg.&#60;/p&#62;
&#60;p&#62;You can parse the HDF5 files from bash scripts using h5dump -d &#34;Nt&#34; ... &#60;/p&#62;
&#60;p&#62;Best wishes,&#60;br /&#62;
Jiri
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bastlwastl on "Extending checkpoint functionality"</title>
			<link>http://www.k-wave.org/forum/topic/extending-checkpoint-functionality#post-6143</link>
			<pubDate>Tue, 03 Oct 2017 16:52:36 +0000</pubDate>
			<dc:creator>bastlwastl</dc:creator>
			<guid isPermaLink="false">6143@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear all,&#60;/p&#62;
&#60;p&#62;I recently (had to) implement a checkpoint version of my K-wave simulation using the C++ binaries. As a small feedback, i would like to say that the manual is a bit weak at this point, at least for me. However, after i figured out the role of the input, output and checkpoint file in this scenario, i do miss some kind of feedback from the binaries telling me that the simulation was ended due to the wall time i defined. This would give the straight forward possibility to rerun from the saved step, if possible. I come up with some Bash magic i'm sharing with you, but i guess it would be nice to have a better solution clearly checking if the simulation is already finished. One clear disadvantage of my solution is that if by coincidence  the simulation is finished but needs more time to save data,and thereby taking more time, my script will then assume that it need to run another loop. I guess not a big problem, but 'imperfect' ;)&#60;br /&#62;
Anyway, find the script below, reduced to the important part. The required files has to be provided by the command line. &#60;/p&#62;
&#60;p&#62;Best Regards from Munich,&#60;br /&#62;
Sebastian&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;#!/bin/bash -le
#Setup files
INPUTFILE=#1
OUTPUTFILE=#2
CHECKPOINT_FILE=#3
CPP_BIN_ADD_PARAM=&#38;#39;--p_raw&#38;#39;
#one day in seconds
CHECKPOINT_TIME=86400
loop_rerun=true

while $loop_rerun; do
#date +%s will give you the current time in seconds starting at the 1.1.1970
start_time=&#38;lt;code&#38;gt;date +%s&#38;lt;/code&#38;gt;
echo Start time in seconds:
echo $start_time

#Running the Simulation with the c++ binaries
kspaceFirstOrder3D-OMP_SSE4 -i $INPUTFILE -o $OUTPUTFILE $CPP_BIN_ADD_PARAM --checkpoint_interval $CHECKPOINT_TIME --checkpoint_file $CHECKPOINT_FILE

echo End time in seconds:
end_time=&#38;lt;code&#38;gt;date +%s&#38;lt;/code&#38;gt;
echo $end_time

#calculate the difference
difference=&#38;lt;code&#38;gt;expr $end_time - $start_time&#38;lt;/code&#38;gt;
echo Assumed Runtime:
echo $difference
if [ &#38;quot;$difference&#38;quot; -lt &#38;quot;$CHECKPOINT_TIME&#38;quot; ]; then
loop_rerun=false
echo &#38;quot;End of Checkpoint simulation, finishing&#38;quot;
fi

done&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
