<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — OpenMP and Appgraphics]]></title>
	<link rel="self" href="http://forums.approximatrix.com/extern.php?action=feed&amp;tid=654&amp;type=atom" />
	<updated>2017-10-12T16:29:31Z</updated>
	<generator>PunBB</generator>
	<id>http://forums.approximatrix.com/viewtopic.php?id=654</id>
		<entry>
			<title type="html"><![CDATA[Re: OpenMP and Appgraphics]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=3046#p3046" />
			<content type="html"><![CDATA[<p>There was a bug in our OpenMP implementation that assumed that a pointer to thread information is always initialized.&nbsp; Because AppGraphics uses Windows-native threading (as opposed to OpenMP constructs), the graphical user interface thread did not have this OpenMP-related thread pointer available, causing the program to crash.</p><p>The OpenMP library was updated to initialize a new thread information pointer immediately if OpenMP requests thread information and nothing is available.&nbsp; It should allow our OpenMP implementation to properly co-exist with Windows threads.</p><p>The fix will be included in Simply Fortran 2.40, due out shortly.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2017-10-12T16:29:31Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=3046#p3046</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: OpenMP and Appgraphics]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=3036#p3036" />
			<content type="html"><![CDATA[<p>Thanks Jeff! I will look forward into that.</p><p>This simple piece of code can recreate the problem when compiled with the &quot;enable OpenMP&quot; option enabled</p><div class="codebox"><pre><code>program  test
    use appgraphics
    implicit none
    integer::screen,button
    screen=initwindow(200,200,title=&#039;test&#039;,closeflag=.true.)
    button = createbutton(0,0,200,200,&#039;testbutton&#039;,testsubroutine)

    call loop()
    call closewindow(screen)
    contains
        subroutine testsubroutine()
            implicit none
!$OMP PARALLEL
            write(*,*)&#039;Hello, world!&#039;
!$OMP END PARALLEL
        end subroutine
end program</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Narodth]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=3765</uri>
			</author>
			<updated>2017-10-03T05:31:24Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=3036#p3036</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: OpenMP and Appgraphics]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=3035#p3035" />
			<content type="html"><![CDATA[<p>I&#039;m not exactly sure why your program is locking up, but I do have some suggestions.&nbsp; One important fact to keep in mind is that subroutines called from button clicks are not running in your main program thread, but, rather, the graphical user interface thread.&nbsp; Any long-running calculations should not be handled in that subroutine directly.&nbsp; I normally suggest using the button handler to set a variable and release the main program from idle.&nbsp; Once un-idled, the program will take some action based on the value of that variable.&nbsp; The &quot;Conway&#039;s Game of Life&quot; example that comes with Simply Fortran uses this method.</p><p>Additionally, OpenMP relies on Windows threading routines internally, and it might make some assumptions about the program&#039;s current state in regards to threads. Since AppGraphics programs are already using multiple threads, there may be some sort of deadlock occurring.&nbsp; I&#039;m not positive, though, why that would occur.</p><p>I&#039;ll look into it more on my end, but I would strongly suggest keeping all OpenMP calls within the main program by using the equivalent of a message loop to handle button presses.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2017-10-02T11:41:07Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=3035#p3035</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[OpenMP and Appgraphics]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=3032#p3032" />
			<content type="html"><![CDATA[<p>Hello, when I try to do some parallel programing with OpenMP it works perfectly, until I try to do it anywhere inside a subroutine called from clicking a button from Appgraphics. The program just stops working with the respective windows message, am I doing something wrong?</p><p>I&#039;m running version 2.39.2491 on Windows 7 Ultimate</p>]]></content>
			<author>
				<name><![CDATA[Narodth]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=3765</uri>
			</author>
			<updated>2017-10-01T15:42:20Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=3032#p3032</id>
		</entry>
</feed>
