<?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: Specify number of threads</title>
		<link>http://www.k-wave.org/forum/topic/specify-number-of-threads</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 22:34:17 +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/specify-number-of-threads" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "Specify number of threads"</title>
			<link>http://www.k-wave.org/forum/topic/specify-number-of-threads#post-8199</link>
			<pubDate>Wed, 09 Jun 2021 08:55:26 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">8199@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Zeng,&#60;/p&#62;
&#60;p&#62;I think you misunderstood my comments. Your code works as expected, and the C++ version of the axisymmetric code uses 6 threads as you specified. However, in the same script you call &#60;code&#62;kspaceFirstOrder2D&#60;/code&#62; which is a MATLAB code (look at the last line of the error message - the call is at line 73 of the axisymmetric_lineSensor script). For the MATLAB codes, you can't specify the number of threads.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>zengqw2021 on "Specify number of threads"</title>
			<link>http://www.k-wave.org/forum/topic/specify-number-of-threads#post-8198</link>
			<pubDate>Wed, 09 Jun 2021 08:38:51 +0000</pubDate>
			<dc:creator>zengqw2021</dc:creator>
			<guid isPermaLink="false">8198@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;br /&#62;
   So how can I specify the number of threads when using the function kspaceFirstOrder2DC and kspaceFirstOrderASC. Does the 'NumThreads' option can only be passed in kspaceFirstOrder3DC.&#60;br /&#62;
I notice in the describtion of kspaceFirstOrder2DC, it says &#34;For small simulations, running the simulation on a  smaller number of cores can improve performance as the matrices are often small enough to fit within cache.  It is recommended to adjust the value of 'NumThreads' to optimise performance for a given simulation size and computer hardware.  By default, simulations smaller than 128^2 are set to  run using a single thread (this behaviour can be over-ridden using the 'NumThreads' option).&#34;&#60;/p&#62;
&#60;p&#62;   Zeng
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Specify number of threads"</title>
			<link>http://www.k-wave.org/forum/topic/specify-number-of-threads#post-8195</link>
			<pubDate>Tue, 08 Jun 2021 17:36:50 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">8195@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;It looks like it works correctly. See:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;Number of CPU threads: 6&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Note, you can't pass the &#60;code&#62;&#38;#39;NumThreads&#38;#39;&#60;/code&#62; option to the MATLAB code &#60;code&#62;kspaceFirstOrder2D&#60;/code&#62; which is what it's complaining about.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>zengqw2021 on "Specify number of threads"</title>
			<link>http://www.k-wave.org/forum/topic/specify-number-of-threads#post-8193</link>
			<pubDate>Tue, 08 Jun 2021 17:28:45 +0000</pubDate>
			<dc:creator>zengqw2021</dc:creator>
			<guid isPermaLink="false">8193@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;br /&#62;
  Here's what Matlab shows：&#60;br /&#62;
  Running k-Wave simulation...&#60;br /&#62;
  start time: 09-Jun-2021 00:24:23&#60;br /&#62;
  WARNING: the axisymmetric code and stokes absorption assume alpha_power = 2, user value ignored.&#60;br /&#62;
  reference sound speed: 1500m/s&#60;br /&#62;
  WARNING: visualisation plot scale may not be optimal for given source.&#60;br /&#62;
  dt: 18.5185ns, t_end: 18.8519us, time steps: 1019&#60;br /&#62;
  input grid size: 216 by 216 grid points (20 by 20mm)&#60;br /&#62;
  maximum supported frequency: 8.1MHz&#60;br /&#62;
  expanding computational grid...&#60;br /&#62;
  computational grid size: 256 by 236 grid points&#60;br /&#62;
  WARNING: Highest prime factors in each dimension are 2  59&#60;br /&#62;
           Use dimension sizes with lower prime factors to improve speed&#60;br /&#62;
  precomputation completed in 0.085399s&#60;br /&#62;
  saving input files to disk...&#60;br /&#62;
  completed in 0.77975s&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
&#124;                   kspaceFirstOrder-OMP v1.3                   &#124;&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
&#124; Reading simulation configuration:                        Done &#124;&#60;br /&#62;
&#124; Number of CPU threads:                                      6 &#124;&#60;br /&#62;
&#124; Processor name:      Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz &#124;&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
&#124;                      Simulation details                       &#124;&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
&#124; Domain dimensions:                                  256 x 236 &#124;&#60;br /&#62;
&#124; Medium type:                                               AS &#124;&#60;br /&#62;
&#124; Simulation time steps:                                   1019 &#124;&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
&#124;                        Initialization                         &#124;&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
&#124; Memory allocation:                                       Done &#124;&#60;br /&#62;
&#124; Data loading:                                            Done &#124;&#60;br /&#62;
&#124; Elapsed time:                                           0.01s &#124;&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
&#124; FFT plans creation:                                      Done &#124;&#60;br /&#62;
&#124; Pre-processing phase:                                    Done &#124;&#60;br /&#62;
&#124; Elapsed time:                                           0.00s &#124;&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
&#124;                    Computational resources                    &#124;&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
&#124; Current host memory in use:                              15MB &#124;&#60;br /&#62;
&#124; Expected output file size:                                0MB &#124;&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
&#124;                          Simulation                           &#124;&#60;br /&#62;
+----------+----------------+--------------+--------------------+&#60;br /&#62;
&#124; Progress &#124;  Elapsed time  &#124;  Time to go  &#124;  Est. finish time  &#124;&#60;br /&#62;
+----------+----------------+--------------+--------------------+&#60;br /&#62;
&#124;     0%   &#124;        0.111s  &#124;     56.353s  &#124;  09/06/21 00:25:20 &#124;&#60;br /&#62;
&#124;     5%   &#124;        2.427s  &#124;     45.125s  &#124;  09/06/21 00:25:12 &#124;&#60;br /&#62;
&#124;    10%   &#124;        4.736s  &#124;     42.120s  &#124;  09/06/21 00:25:11 &#124;&#60;br /&#62;
&#124;    15%   &#124;        7.047s  &#124;     39.581s  &#124;  09/06/21 00:25:10 &#124;&#60;br /&#62;
&#124;    20%   &#124;        9.397s  &#124;     37.315s  &#124;  09/06/21 00:25:11 &#124;&#60;br /&#62;
&#124;    25%   &#124;       11.723s  &#124;     34.941s  &#124;  09/06/21 00:25:10 &#124;&#60;br /&#62;
&#124;    30%   &#124;       14.037s  &#124;     32.555s  &#124;  09/06/21 00:25:10 &#124;&#60;br /&#62;
&#124;    35%   &#124;       16.346s  &#124;     30.181s  &#124;  09/06/21 00:25:11 &#124;&#60;br /&#62;
&#124;    40%   &#124;       18.673s  &#124;     27.849s  &#124;  09/06/21 00:25:10 &#124;&#60;br /&#62;
&#124;    45%   &#124;       21.013s  &#124;     25.535s  &#124;  09/06/21 00:25:10 &#124;&#60;br /&#62;
&#124;    50%   &#124;       23.332s  &#124;     23.195s  &#124;  09/06/21 00:25:11 &#124;&#60;br /&#62;
&#124;    55%   &#124;       25.646s  &#124;     20.855s  &#124;  09/06/21 00:25:10 &#124;&#60;br /&#62;
&#124;    60%   &#124;       27.992s  &#124;     18.540s  &#124;  09/06/21 00:25:10 &#124;&#60;br /&#62;
&#124;    65%   &#124;       30.346s  &#124;     16.224s  &#124;  09/06/21 00:25:11 &#124;&#60;br /&#62;
&#124;    70%   &#124;       32.665s  &#124;     13.888s  &#124;  09/06/21 00:25:10 &#124;&#60;br /&#62;
&#124;    75%   &#124;       34.979s  &#124;     11.553s  &#124;  09/06/21 00:25:10 &#124;&#60;br /&#62;
&#124;    80%   &#124;       37.293s  &#124;      9.220s  &#124;  09/06/21 00:25:11 &#124;&#60;br /&#62;
&#124;    85%   &#124;       39.620s  &#124;      6.892s  &#124;  09/06/21 00:25:10 &#124;&#60;br /&#62;
&#124;    90%   &#124;       41.935s  &#124;      4.563s  &#124;  09/06/21 00:25:10 &#124;&#60;br /&#62;
&#124;    95%   &#124;       44.253s  &#124;      2.235s  &#124;  09/06/21 00:25:11 &#124;&#60;br /&#62;
+----------+----------------+--------------+--------------------+&#60;br /&#62;
&#124; Elapsed time:                                          46.47s &#124;&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
&#124; Sampled data post-processing:                            Done &#124;&#60;br /&#62;
&#124; Elapsed time:                                           0.00s &#124;&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
&#124;                            Summary                            &#124;&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
&#124; Peak memory in use:                                      17MB &#124;&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
&#124; Total execution time:                                  46.53s &#124;&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
&#124;                       End of computation                      &#124;&#60;br /&#62;
+---------------------------------------------------------------+&#60;br /&#62;
Running k-Wave simulation...&#60;br /&#62;
  start time: 09-Jun-2021 00:25:11&#60;br /&#62;
Error using kspaceFirstOrder_checkOptionalInputs (line 477)&#60;br /&#62;
Unknown optional input NumThreads.&#60;/p&#62;
&#60;p&#62;Error in kspaceFirstOrder_inputChecking (line 110)&#60;br /&#62;
kspaceFirstOrder_checkOptionalInputs;&#60;/p&#62;
&#60;p&#62;Error in kspaceFirstOrder2D (line 537)&#60;br /&#62;
kspaceFirstOrder_inputChecking;&#60;/p&#62;
&#60;p&#62;Error in axisymmetric_lineSensor (line 73)&#60;br /&#62;
p0_recon = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:});
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Specify number of threads"</title>
			<link>http://www.k-wave.org/forum/topic/specify-number-of-threads#post-8185</link>
			<pubDate>Tue, 08 Jun 2021 15:53:05 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">8185@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;That looks like the correct syntax, and it should work. Do you get an error, or just the wrong number of threads? How many are used?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>zengqw2021 on "Specify number of threads"</title>
			<link>http://www.k-wave.org/forum/topic/specify-number-of-threads#post-8183</link>
			<pubDate>Tue, 08 Jun 2021 15:40:44 +0000</pubDate>
			<dc:creator>zengqw2021</dc:creator>
			<guid isPermaLink="false">8183@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear all,&#60;br /&#62;
     is there a way for me to specify number of threads in function kspaceFirstOrderASC.&#60;br /&#62;
I tried to implement it with the following code：&#60;br /&#62;
input_args1 = {'PMLInside', false, 'PMLSize', PML_size, 'Smooth', false, 'PlotPML', false};&#60;br /&#62;
input_args2= {'NumThreads',6};&#60;br /&#62;
input_args = [input_args1 input_args2];&#60;br /&#62;
% run the simulation&#60;br /&#62;
sensor_data = kspaceFirstOrderASC(kgrid, medium, source, sensor, input_args{:});&#60;/p&#62;
&#60;p&#62; however, it doesn't work.Can it be done?&#60;br /&#62;
   Thank you&#60;br /&#62;
      Zeng
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
