<?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; User Favorites: lennartverhagen</title>
		<link><a href='http://www.k-wave.org/forum/profile/lennartverhagen'>lennartverhagen</a></link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 23:02:22 +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/profile/" rel="self" type="application/rss+xml" />

		<item>
			<title>Jiri Jaros on "Successful compilation of CUDA code on MacOS"</title>
			<link>http://www.k-wave.org/forum/topic/successful-compilation-of-cuda-code-on-macos#post-8793</link>
			<pubDate>Tue, 06 Jun 2023 12:56:04 +0000</pubDate>
			<dc:creator>Jiri Jaros</dc:creator>
			<guid isPermaLink="false">8793@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;The CUDA code will never work on M2 processors, it is not CUDA compatible.&#60;/p&#62;
&#60;p&#62;The OpenMP code will work after changing memory allocation from __mm_malloc, which is an x86 instruction, to aligned_alloc.  The -march parameter is only optional and can be removed. However, the code was only tested with Intel and GCC compilers.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>nellens1 on "Successful compilation of CUDA code on MacOS"</title>
			<link>http://www.k-wave.org/forum/topic/successful-compilation-of-cuda-code-on-macos#post-8705</link>
			<pubDate>Mon, 20 Feb 2023 18:50:33 +0000</pubDate>
			<dc:creator>nellens1</dc:creator>
			<guid isPermaLink="false">8705@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Has anyone managed to get the binaries working with Apple's new M2 processor architecture? I've downloaded lennartverhagen's kindly provided github repo and followed the instructions, but I've crashed into some issues with Apple's clang compiler and I haven't found a fix elsewhere.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;clang: error: the clang compiler does not support &#38;#39;-march=native&#38;#39;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;I've tried various alternatives to march=native and followed this thread: &#60;a href=&#34;https://discourse.llvm.org/t/why-does-march-native-not-work-on-apple-m1/2733/7&#34; rel=&#34;nofollow&#34;&#62;https://discourse.llvm.org/t/why-does-march-native-not-work-on-apple-m1/2733/7&#60;/a&#62; but I think I'm exceeding my C skills. Has anyone else mastered this?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>lennartverhagen on "Successful compilation of CUDA code on MacOS"</title>
			<link>http://www.k-wave.org/forum/topic/successful-compilation-of-cuda-code-on-macos#post-7587</link>
			<pubDate>Tue, 09 Jun 2020 15:10:06 +0000</pubDate>
			<dc:creator>lennartverhagen</dc:creator>
			<guid isPermaLink="false">7587@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi both, I have to be honest with you, I can see why it's not on top of your list :) As you can see from the top post, you need to be quite dedicated with an external Nvidia GPU and some hacks to benefit from the CUDA acceleration. I'm using a macOS for dev work and teaching. We're running the sims on our linux HPC cluster. I don't have an eGPU for my Mac, so I also wouldn't be able to test the CUDA binaries...
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Jiri Jaros on "Successful compilation of CUDA code on MacOS"</title>
			<link>http://www.k-wave.org/forum/topic/successful-compilation-of-cuda-code-on-macos#post-7519</link>
			<pubDate>Thu, 21 May 2020 21:51:43 +0000</pubDate>
			<dc:creator>Jiri Jaros</dc:creator>
			<guid isPermaLink="false">7519@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Lennart,&#60;br /&#62;
Actually, the main reason is me not having access to any Mac, so I can't test it properly.&#60;br /&#62;
I'll take a look at the repository and try to incorporate necessary changes.&#60;br /&#62;
Jiri
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Successful compilation of CUDA code on MacOS"</title>
			<link>http://www.k-wave.org/forum/topic/successful-compilation-of-cuda-code-on-macos#post-7511</link>
			<pubDate>Thu, 21 May 2020 11:07:32 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">7511@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Thanks Lennart. Providing an official macOS release has been on our list for a while, it's just never quite made it to the top!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>lennartverhagen on "Successful compilation of CUDA code on MacOS"</title>
			<link>http://www.k-wave.org/forum/topic/successful-compilation-of-cuda-code-on-macos#post-7497</link>
			<pubDate>Wed, 13 May 2020 11:41:03 +0000</pubDate>
			<dc:creator>lennartverhagen</dc:creator>
			<guid isPermaLink="false">7497@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Quick update: I've put my changes on GitHub: &#60;a href=&#34;https://github.com/lennartverhagen/k-Wave-CPUGPU-macOS&#34; rel=&#34;nofollow&#34;&#62;https://github.com/lennartverhagen/k-Wave-CPUGPU-macOS&#60;/a&#62;. The changes only hold for kspaceFirstOrder-OMP. I didn't get acousticFieldPropagator-OMP to compile and seeing how I'm not currently using this, I'll leave that untouched for now.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>lennartverhagen on "Successful compilation of CUDA code on MacOS"</title>
			<link>http://www.k-wave.org/forum/topic/successful-compilation-of-cuda-code-on-macos#post-7495</link>
			<pubDate>Tue, 12 May 2020 22:44:44 +0000</pubDate>
			<dc:creator>lennartverhagen</dc:creator>
			<guid isPermaLink="false">7495@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Sam, thanks for sharing this here! Your diff report above has helped me to successfully compile the CPU OPM on macOS.&#60;/p&#62;
&#60;p&#62;Brad, Jiri, is there a way I can contribute my instructions to the community? Do you prefer a post here? Or should I post my adapted source code and readme somewhere?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Successful compilation of CUDA code on MacOS"</title>
			<link>http://www.k-wave.org/forum/topic/successful-compilation-of-cuda-code-on-macos#post-6315</link>
			<pubDate>Tue, 06 Mar 2018 23:03:12 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">6315@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Great, thanks Sam, that's very helpful!&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>SamPichardo on "Successful compilation of CUDA code on MacOS"</title>
			<link>http://www.k-wave.org/forum/topic/successful-compilation-of-cuda-code-on-macos#post-6283</link>
			<pubDate>Sat, 10 Feb 2018 01:08:22 +0000</pubDate>
			<dc:creator>SamPichardo</dc:creator>
			<guid isPermaLink="false">6283@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;First of all, thanks for the tool, it has been quite useful to teach ultrasound course material. &#60;/p&#62;
&#60;p&#62;Some users have been asking for how to compile in MacOs (there are some old threads). With the advent of support to external GPUs via USB-C 3.1 (including NVIDIA after a minor hack &#60;a href=&#34;https://egpu.io/forums/mac-setup/wip-nvidia-egpu-support-for-high-sierra/paged/1/)&#34; rel=&#34;nofollow&#34;&#62;https://egpu.io/forums/mac-setup/wip-nvidia-egpu-support-for-high-sierra/paged/1/)&#60;/a&#62;, the use of NVIDIA processors is becoming more accessible for Mac users. Below you can see an ensemble of diff outputs of all the changes I had to do. All of them very minor, just involving some macro definitions and add some extra libraries. I can compile and run this under MacOS Sierra (10.13.3), using latest stable XCode (9.2) and CUDA 9.1 (it also works with CUDA 9.0, but you'd need to use an older version of XCode). For zlib, szip and HDF5 libraries, I used brew. Changes in Makefile are just for &#34;laziness&#34; :).&#60;/p&#62;
&#60;p&#62;I hope this can help to other people who are interested in using k-wave GPU binaries in Mac. It should be also easy to include the changes in the distribution code.&#60;/p&#62;
&#60;p&#62;Cheers&#60;/p&#62;
&#60;p&#62;Sam&#60;/p&#62;
&#60;p&#62;*************************************&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;diff -ENwbur orig-k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Hdf5/Hdf5File.h k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Hdf5/Hdf5File.h
--- orig-k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Hdf5/Hdf5File.h	2017-09-04 17:12:12.000000000 -0600
+++ k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Hdf5/Hdf5File.h	2018-02-09 16:34:52.000000000 -0700
@@ -459,6 +459,11 @@
 #ifndef HDF5_FILE_H
 #define HDF5_FILE_H

+#ifdef __APPLE__
+#include &#38;lt;string&#38;gt;
+#include &#38;lt;sstream&#38;gt;
+#include &#38;lt;iostream&#38;gt;
+#endif

 #include &#38;lt;hdf5.h&#38;gt;
 #include &#38;lt;hdf5_hl.h&#38;gt;
diff -ENwbur orig-k-wave-toolbox-version-1.2-cpp-gpu-linux-source/KSpaceSolver/KSpaceFirstOrder3DSolver.cpp k-wave-toolbox-version-1.2-cpp-gpu-linux-source/KSpaceSolver/KSpaceFirstOrder3DSolver.cpp
--- orig-k-wave-toolbox-version-1.2-cpp-gpu-linux-source/KSpaceSolver/KSpaceFirstOrder3DSolver.cpp	2017-09-04 17:12:12.000000000 -0600
+++ k-wave-toolbox-version-1.2-cpp-gpu-linux-source/KSpaceSolver/KSpaceFirstOrder3DSolver.cpp	2018-02-09 16:32:48.000000000 -0700
@@ -31,8 +31,8 @@
  * If not, see [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/).
  */

-// Linux build
-#ifdef __linux__
+// Linux and MacOS build
+#if defined(__linux__) &#124;&#124; defined (__APPLE__)
   #include &#38;lt;sys/resource.h&#38;gt;
   #include &#38;lt;cmath&#38;gt;
 #endif
diff -ENwbur orig-k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Logger/ErrorMessages.h k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Logger/ErrorMessages.h
--- orig-k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Logger/ErrorMessages.h	2017-09-04 17:12:12.000000000 -0600
+++ k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Logger/ErrorMessages.h	2018-02-09 16:32:48.000000000 -0700
@@ -34,8 +34,7 @@

 #ifndef ERROR_MESSAGES_H
 #define ERROR_MESSAGES_H
-
-#ifdef __linux__
+#if defined(__linux__) &#124;&#124; defined (__APPLE__)
   #include &#38;lt;Logger/ErrorMessagesLinux.h&#38;gt;
 #endif

diff -ENwbur orig-k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Logger/OutputMessages.h k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Logger/OutputMessages.h
--- orig-k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Logger/OutputMessages.h	2017-09-04 17:12:12.000000000 -0600
+++ k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Logger/OutputMessages.h	2018-02-09 16:32:48.000000000 -0700
@@ -32,7 +32,7 @@
 #ifndef OUTPUT_MESSAGES_H
 #define OUTPUT_MESSAGES_H

-#ifdef __linux__
+#if defined(__linux__) &#124;&#124; defined (__APPLE__)
   #include &#38;lt;Logger/OutputMessagesLinux.h&#38;gt;
 #endif

@@ -42,4 +42,3 @@
 #endif

 #endif /* OUTPUT_MESSAGES_H */
-
diff -ENwbur orig-k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Makefile k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Makefile
--- orig-k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Makefile	2017-09-04 22:31:34.000000000 -0600
+++ k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Makefile	2018-02-09 16:41:52.000000000 -0700
@@ -79,10 +79,10 @@
 LINKING = SEMI

 #Set up paths to necessary libraries:
-HDF5_DIR=${EBROOTHDF5}
-CUDA_DIR=${CUDA_HOME}
-ZLIB_DIR=${EBROOTZLIB}
-SZIP_DIR=${EBROOTSZIP}
+HDF5_DIR=/usr/local
+CUDA_DIR=/Developer/NVIDIA/CUDA-9.1
+ZLIB_DIR=/usr/local/Cellar/zlib/1.2.11
+SZIP_DIR=/usr/local

 #Get GIT hash (only if you build form Gitlab repository)
 #KWAVE_GIT_HASH=$(shell git rev-parse HEAD)
@@ -96,14 +96,12 @@

 # Set compiler flags and header files directories
-CXXFLAGS = -Xcompiler=&#38;quot;-Wall -O3 -fopenmp -ffast-math -fassociative-math&#38;quot; \
+CXXFLAGS = -Xcompiler=&#38;quot;-Wall -O3  -ffast-math -fassociative-math&#38;quot; \
            -O3 -std=c++11  -I$(HDF5_DIR)/include  -I.  --restrict \
 	   -D__KWAVE_GIT_HASH__=\&#38;quot;$(KWAVE_GIT_HASH)\&#38;quot;   \
    	   --device-c

-CUDA_ARCH = --generate-code arch=compute_20,code=sm_20	\
-	    --generate-code arch=compute_20,code=sm_21	\
-	    --generate-code arch=compute_30,code=sm_30	\
+CUDA_ARCH =  --generate-code arch=compute_30,code=sm_30	\
 	    --generate-code arch=compute_32,code=sm_32	\
 	    --generate-code arch=compute_35,code=sm_35	\
 	    --generate-code arch=compute_37,code=sm_37	\
@@ -115,16 +113,15 @@

-LDFLAGS  =  -Xcompiler=&#38;quot;-fopenmp&#38;quot; \
-	    -Xlinker=&#38;quot;-rpath,$(HDF5_DIR)/lib:$(CUDA_DIR)/lib64:.&#38;quot; -std=c++11  \
-	    -L$(HDF5_DIR)/lib  -L$(CUDA_DIR)/lib64
+LDFLAGS  =  -Xlinker=&#38;quot;-rpath,$(HDF5_DIR)/lib:$(CUDA_DIR)/lib:.&#38;quot; -std=c++11  \
+	    -L$(HDF5_DIR)/lib  -L$(CUDA_DIR)/lib

 ifeq ($(LINKING),STATIC)
 	LIBS  = $(HDF5_DIR)/lib/libhdf5_hl.a 	     \
             	$(HDF5_DIR)/lib/libhdf5.a	     \
-	        $(CUDA_DIR)/lib64/libcufft_static.a  \
-	        $(CUDA_DIR)/lib64/libculibos.a       \
-        	$(CUDA_DIR)/lib64/libcudart_static.a \
+	        $(CUDA_DIR)/lib/libcufft_static.a  \
+	        $(CUDA_DIR)/lib/libculibos.a       \
+        	$(CUDA_DIR)/lib/libcudart_static.a \
 	        $(ZLIB_DIR)/lib/libz.a		     \
 	        $(SZIP_DIR)/lib/libsz.a 	     \
 		-ldl
diff -ENwbur orig-k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Parameters/CommandLineParameters.cpp k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Parameters/CommandLineParameters.cpp
--- orig-k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Parameters/CommandLineParameters.cpp	2017-09-04 17:12:12.000000000 -0600
+++ k-wave-toolbox-version-1.2-cpp-gpu-linux-source/Parameters/CommandLineParameters.cpp	2018-02-09 16:32:48.000000000 -0700
@@ -30,7 +30,7 @@
  */

 //Linux build
-#ifdef __linux__
+#if defined(__linux__) &#124;&#124; defined (__APPLE__)
   #include &#38;lt;getopt.h&#38;gt;
 #endif&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
