<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Approximatrix Forums — Coarray Fortran DLL can be possibly called from C++ or C#]]></title>
		<link>https://forums.approximatrix.com/viewtopic.php?id=836</link>
		<atom:link href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=836&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Coarray Fortran DLL can be possibly called from C++ or C#.]]></description>
		<lastBuildDate>Tue, 22 Feb 2022 12:30:52 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Coarray Fortran DLL can be possibly called from C++ or C#]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=3891#p3891</link>
			<description><![CDATA[<p>It would be possible to do if you used an external executable rather than a DLL.&nbsp; Unfortunately, Coarray implementations (and compiler support for Coarray implementations) focus on multiple images of a program running.&nbsp; If there were a Coarray implementation that relied on threads rather than separate processes, you&#039;d be able to do what you&#039;re suggesting. </p><p>The issue is that the compiler we ship, GNU Fortran, assumes that Coarrays, regardless of the implementation, will be using multiple images.&nbsp; This decision isn&#039;t arbitrary, though.&nbsp; Many of the assumptions that the compiler itself makes assumes that the program is running in a self-contained image.&nbsp; For example, when a variable has the <strong>SAVE</strong> attribute, meaning its value will persist across calls to a procedure, Coarray Fortran assumes that the saved value is local to that Coarray worker.&nbsp; Yet the compiler treats it as a special static variable local to that process.&nbsp; If Coarrays relied on threads, every thread, in theory, would see the same value in that variable because it is local to that process, not thread.&nbsp; Those odd, little corners of the language makes implementing Coarrays without multiple processes highly problematic.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Tue, 22 Feb 2022 12:30:52 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=3891#p3891</guid>
		</item>
		<item>
			<title><![CDATA[Re: Coarray Fortran DLL can be possibly called from C++ or C#]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=3886#p3886</link>
			<description><![CDATA[<p>Jeff, Thank for your reply.<br />My program is DLL implementation, to achieve complex parallelism, we selected Coarray. But we find that no compiler supports running Coarray in a DLL now.</p>]]></description>
			<author><![CDATA[null@example.com (Jessen)]]></author>
			<pubDate>Sat, 19 Feb 2022 07:25:45 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=3886#p3886</guid>
		</item>
		<item>
			<title><![CDATA[Re: Coarray Fortran DLL can be possibly called from C++ or C#]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=3851#p3851</link>
			<description><![CDATA[<p>With Simply Fortran on Windows, the use of coarrays is complicated by the need for the executable to launch in a specialized manner.&nbsp; Coarrays (at least our implementation and most others) rely on multiple images of the executable running in parallel.&nbsp; When a Fortran executable using coarrays starts, our library launches the executable a number of times more (the number of CPU cores present by default) with special command line flags notifying the images of how to communicate with one another.&nbsp; The library hooks into the documented Fortran runtime API to handle startup and information passing.</p><p>Launching this coarray program from a DLL would be exceptionally complicated because it needs to actually start additional <em>processes</em> for the Fortran coarray handling.&nbsp; I&#039;m not exactly sure how this situation would be handled from a call originating from a C++ of C# program because it would skip the multiple-image-initialization step.&nbsp; </p><p>I think it might be more useful to look at what you wish to achieve.&nbsp; You could have your C++ or C# program launch a Fortran executable that uses coarrays and read results from a file possibly.&nbsp; If you&#039;re just looking to perform some parallel computations, OpenMP programming might be somewhat more convenient since it relies only on threads, which wouldn&#039;t run into the multiple-image issues I described.</p><p>Can you tell us more about what you&#039;re trying to achieve?&nbsp; Coarrays aren&#039;t necessarily the best answer for parallel computations.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Sat, 22 Jan 2022 06:05:02 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=3851#p3851</guid>
		</item>
		<item>
			<title><![CDATA[Coarray Fortran DLL can be possibly called from C++ or C#]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=3849#p3849</link>
			<description><![CDATA[<p>I am trying to understand how a Coarray Fortran DLL can be possibly called from C++ or C#. Do you have any suggestion or example? </p><p>Thanks in advanced!</p>]]></description>
			<author><![CDATA[null@example.com (Jessen)]]></author>
			<pubDate>Fri, 21 Jan 2022 15:55:08 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=3849#p3849</guid>
		</item>
	</channel>
</rss>
