<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — coarrays]]></title>
	<link rel="self" href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=559&amp;type=atom" />
	<updated>2020-01-17T20:19:53Z</updated>
	<generator>PunBB</generator>
	<id>https://forums.approximatrix.com/viewtopic.php?id=559</id>
		<entry>
			<title type="html"><![CDATA[Re: coarrays]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3407#p3407" />
			<content type="html"><![CDATA[<p>It&#039;s another bug concerning allocated coarrays.&nbsp; I&#039;ve sent you a detailed response via email.&nbsp; We&#039;ll start fixing this bug.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2020-01-17T20:19:53Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3407#p3407</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: coarrays]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3406#p3406" />
			<content type="html"><![CDATA[<p>It gets a bit longer, is it possible to send it to you by email?<br />&nbsp; Petr</p>]]></content>
			<author>
				<name><![CDATA[pm1a]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3597</uri>
			</author>
			<updated>2020-01-17T18:05:39Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3406#p3406</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: coarrays]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3404#p3404" />
			<content type="html"><![CDATA[<p>Can you post another problematic example and the output?&nbsp; Running your example code on 3.8, I get:</p><div class="codebox"><pre><code> Approximatrix Windows Coarray Library
 Copyright 2016-2019 Approximatrix, LLC
 =======================================

 Library Build: Jan 13 2020
 Images:        4

 =======================================

 n=
100
           1   1.00000000000000000000      
           2   0.00000000000000000000      
           3   0.00000000000000000000      
           4   0.00000000000000000000      
 koncim            1  z            4
 koncim            4  z            4
 koncim            3  z            4
 koncim            2  z            4</code></pre></div><p>There&#039;s a good chance that problems may exist with allocated coarrays (or plenty of other features) that we&#039;ve overlooked.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2020-01-17T12:17:36Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3404#p3404</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: coarrays]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3403#p3403" />
			<content type="html"><![CDATA[<p>I upgraded to 3.8. I am sorry, I still have some problems with coarrays.</p>]]></content>
			<author>
				<name><![CDATA[pm1a]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3597</uri>
			</author>
			<updated>2020-01-17T07:58:32Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3403#p3403</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: coarrays]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3396#p3396" />
			<content type="html"><![CDATA[<p>I wanted to provide a quick update.&nbsp; This bug actually revealed some problems with our implementation and dealing with allocatable coarrays.&nbsp; </p><p>The first problem encountered was an inconsistency in the data describing the size of arrays.&nbsp; Our implementation was not properly requesting remote array sizes from other images prior to requesting the data.&nbsp; With static coarrays, there is no problem since all images know the sizes of all coarrays.&nbsp; However, with allocatable coarrays, the images need to request sizes from each other, which they were not doing. This oversight led to requests that had incorrect memory addresses when making the request.&nbsp; It should be fixed now, and the test program you&#039;ve provided no longer errors out or crashes.&nbsp; The test program still doesn&#039;t execute properly, however.</p><p>The second problem that is still present appears to be how we&#039;re handling memory allocation for allocated coarrays.&nbsp; I believe right now that we might be leaking memory quite significantly, and there&#039;s a chance that we&#039;re destroying data in the process of registering coarrays.&nbsp; We&#039;re trying to sort out this bug right now.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2020-01-06T20:07:44Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3396#p3396</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: coarrays]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3395#p3395" />
			<content type="html"><![CDATA[<p>Thanks.</p>]]></content>
			<author>
				<name><![CDATA[pm1a]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3597</uri>
			</author>
			<updated>2019-12-30T20:31:20Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3395#p3395</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: coarrays]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3394#p3394" />
			<content type="html"><![CDATA[<p>Looking into the issue, it appears that the compiler documentation for the ABI for the internal &quot;byref&quot; functions for coarrays is incorrect in multiple places.&nbsp; Ours was designed based on the incorrect documentation.&nbsp; We&#039;re fixing our library now.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2019-12-30T15:42:29Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3394#p3394</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: coarrays]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3393#p3393" />
			<content type="html"><![CDATA[<p>It looks like some support for derived types may have broken.&nbsp; I&#039;ll see what&#039;s wrong this week.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2019-12-29T14:58:26Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3393#p3393</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: coarrays]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3392#p3392" />
			<content type="html"><![CDATA[<p>I have some other problem with coarrays. The folloving code produce error message, but with OpenCoarrays works OK.</p><p>Program:</p><p>module typy<br />&nbsp; &nbsp; integer, parameter :: rkind = selected_real_kind(16,99)</p><p>&nbsp; &nbsp; type, public :: LocProblem<br />&nbsp; &nbsp; end type LocProblem</p><br /><p>&nbsp; &nbsp; type, public :: GlobProblem<br />&nbsp; &nbsp; &nbsp; &nbsp; real(rkind),dimension(:), allocatable :: u<br />&nbsp; &nbsp; &nbsp; &nbsp; real(rkind) :: h = 0<br />&nbsp; &nbsp; end type GlobProblem</p><br /><br /><br /><p>end module typy</p><br /><br /><br /><br /><p>program ddc<br />&nbsp; &nbsp; use typy<br />&nbsp; &nbsp; implicit none<br />&nbsp; &nbsp; type(GlobProblem), codimension[ * ] :: GP</p><p>&nbsp; &nbsp; integer :: my_id<br />&nbsp; &nbsp; integer :: n_images<br />&nbsp; &nbsp; integer :: n</p><p>&nbsp; &nbsp; n_images = num_images()<br />&nbsp; &nbsp; my_id = this_image()<br />&nbsp; &nbsp; if (my_id == 1) then<br />&nbsp; &nbsp; &nbsp; &nbsp; print *,&quot;n=&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; read *, n<br />&nbsp; &nbsp; &nbsp; &nbsp; allocate(GP%u(0:n))<br />&nbsp; &nbsp; &nbsp; &nbsp; GP%h = 1.0_rkind/n<br />&nbsp; &nbsp; &nbsp; &nbsp; GP%u = 0<br />&nbsp; &nbsp; &nbsp; &nbsp; GP%u(0) = 1<br />&nbsp; &nbsp; &nbsp; &nbsp; GP%u(n) = exp(1.0_rkind)<br />&nbsp; &nbsp; end if<br />&nbsp; &nbsp; sync all<br />&nbsp; &nbsp; print *, my_id, GP[1]%u(my_id-1)</p><p>&nbsp; &nbsp; sync all<br />print *,&quot;koncim &quot;, this_image() ,&quot; z &quot;,num_images()<br />end program&nbsp; ddc</p><br /><p>Win output:</p><p> Approximatrix Windows Coarray Library<br /> Copyright 2016-2019 Approximatrix, LLC<br /> =======================================</p><p> Library Build: Dec 10 2019<br /> Images:&nbsp; &nbsp; &nbsp; &nbsp; 4</p><p> =======================================</p><p> n=<br />346<br />Windows Coarray ERROR ==&gt; Unknown type in caf_get_by_ref: O<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image=1<br />Windows Coarray ERROR ==&gt; Unknown type in caf_get_by_ref: O<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image=4<br />Windows Coarray ERROR ==&gt; Unknown type in caf_get_by_ref: O<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image=2<br />Windows Coarray ERROR ==&gt; Unknown type in caf_get_by_ref: O<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image=3</p><p>Open Coarrays output:</p><p> n=<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1&nbsp; &nbsp;1.00000000000000000000&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2&nbsp; &nbsp;0.00000000000000000000&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3&nbsp; &nbsp;0.00000000000000000000&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4&nbsp; &nbsp;0.00000000000000000000&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5&nbsp; &nbsp;0.00000000000000000000&nbsp; &nbsp; &nbsp; <br /> koncim&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4&nbsp; z&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5<br /> koncim&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; z&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5<br /> koncim&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; z&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5<br /> koncim&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; z&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5<br /> koncim&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5&nbsp; z&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5</p>]]></content>
			<author>
				<name><![CDATA[pm1a]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3597</uri>
			</author>
			<updated>2019-12-28T22:26:18Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3392#p3392</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: coarrays]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3378#p3378" />
			<content type="html"><![CDATA[<p>Petr,</p><p>The internal image status indicators were experiencing an off-by-one error internally, causing some images to be reported as failed.&nbsp; We&#039;ve fixed that issue, and we&#039;re currently hunting down a sync bug that is still present.</p><p>The previous library was working because every thread always reported a status of OK rather than waiting or failed. Trying to improve it apparently broke some things.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2019-12-10T18:15:13Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3378#p3378</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: coarrays]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3376#p3376" />
			<content type="html"><![CDATA[<p>Petr,</p><p>The forum software sees the text [ i ] as markup indicating italics, and it is complaining there is no closing italics tag.</p><p>Regardless, does this not work with version 3.7?&nbsp; I&#039;m not sure I quite understand.&nbsp; You can also email the full code to support@approximatrix.com, and I&#039;ll be happy to see what&#039;s going wrong if the library is not working as expected.&nbsp; There may be a chance that the status messages, recently added, are returning incorrect values to internal calls.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2019-12-10T00:58:55Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3376#p3376</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: coarrays]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3375#p3375" />
			<content type="html"><![CDATA[<p>It works OK with older version and with OpenCoarrays too.</p>]]></content>
			<author>
				<name><![CDATA[pm1a]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3597</uri>
			</author>
			<updated>2019-12-09T23:00:27Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3375#p3375</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: coarrays]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3374#p3374" />
			<content type="html"><![CDATA[<p>finally I succeed, interesting is only main program.</p>]]></content>
			<author>
				<name><![CDATA[pm1a]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3597</uri>
			</author>
			<updated>2019-12-09T22:59:27Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3374#p3374</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: coarrays]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3373#p3373" />
			<content type="html"><![CDATA[<p>module typy<br />&nbsp; integer, parameter, public :: ikind = selected_int_kind(16)<br />&nbsp; integer, parameter, public :: rkind = selected_real_kind(25,99)<br />end module typy</p><p>module pocty<br />&nbsp; use typy<br />&nbsp; implicit none</p><p>&nbsp; !&gt; typ pro stabilizovane scitani<br />&nbsp; type, public :: sumator<br />&nbsp; &nbsp; integer(kind=ikind), private :: depth = 0<br />&nbsp; &nbsp; real(kind=rkind), dimension(:), allocatable, private :: s<br />&nbsp; contains<br />&nbsp; &nbsp; procedure clear<br />&nbsp; &nbsp; procedure add<br />&nbsp; &nbsp; procedure sum<br />&nbsp; &nbsp; procedure setdepth<br />&nbsp; end type sumator</p><p>&nbsp; public :: work<br />&nbsp; public :: f<br />&nbsp; public :: integral<br />contains<br />&nbsp; subroutine clear(s)<br />&nbsp; &nbsp; implicit none<br />&nbsp; &nbsp; class(sumator), intent(in out) :: s<br />&nbsp; &nbsp; integer(kind=ikind) :: i<br />&nbsp; &nbsp; do i=1, s%depth<br />&nbsp; &nbsp; &nbsp; s%s(i) = 0<br />&nbsp; &nbsp; end do<br />&nbsp; end subroutine clear</p><p>&nbsp; subroutine setdepth(s,d)<br />&nbsp; &nbsp; implicit none<br />&nbsp; &nbsp; class(sumator), intent(in out) :: s<br />&nbsp; &nbsp; integer(kind=ikind), intent(in) :: d<br />&nbsp; &nbsp; integer(kind=ikind) :: i<br />&nbsp; &nbsp; !print *,&quot;setdepth1&quot;<br />&nbsp; &nbsp; if&nbsp; (allocated(s%s)) deallocate(s%s)<br />&nbsp; &nbsp; !print *,&quot;setdepth2&quot;<br />&nbsp; &nbsp; s%depth = d<br />&nbsp; &nbsp; allocate(s%s(1:d))<br />&nbsp; &nbsp; !print *,&quot;setdepth3&quot;<br />&nbsp; &nbsp; do i=1, s%depth<br />&nbsp; &nbsp; &nbsp; &nbsp; !print *,i<br />&nbsp; &nbsp; &nbsp; s%s(i) = 0<br />&nbsp; &nbsp; &nbsp; !print *,&quot; po&quot;,i<br />&nbsp; &nbsp; end do<br />&nbsp; &nbsp; !print *,&quot;setdepth4&quot;<br />&nbsp; end subroutine setdepth</p><p>&nbsp; function sum(s) result(y)<br />&nbsp; &nbsp; implicit none<br />&nbsp; &nbsp; class(sumator), intent(in) :: s<br />&nbsp; &nbsp; real(kind=rkind) :: y<br />&nbsp; &nbsp; integer(kind=ikind) :: i</p><p>&nbsp; &nbsp; y = 0<br />&nbsp; &nbsp; do i = s%depth, 1, -1<br />&nbsp; &nbsp; &nbsp; y = y + s%s(i)<br />&nbsp; &nbsp; end do<br />&nbsp; end function sum</p><p>&nbsp; subroutine add(s,v)<br />&nbsp; &nbsp; implicit none<br />&nbsp; &nbsp; class(sumator), intent(in out) :: s<br />&nbsp; &nbsp; real(kind=rkind), intent(in)&nbsp; &nbsp;:: v</p><p>&nbsp; &nbsp; integer(kind=ikind) :: i</p><p>&nbsp; &nbsp; s%s(s%depth) = s%s(s%depth) + v<br />&nbsp; &nbsp; do i = s%depth, 2, -1<br />&nbsp; &nbsp; &nbsp; if ( s%s(i) &gt; s%s(i-1)&nbsp; ) then<br />&nbsp; &nbsp; &nbsp; &nbsp; s%s(i-1) = s%s(i-1) + s%s(i)<br />&nbsp; &nbsp; &nbsp; &nbsp; s%s(i) = 0<br />&nbsp; &nbsp; &nbsp; else<br />&nbsp; &nbsp; &nbsp; &nbsp; exit<br />&nbsp; &nbsp; &nbsp; end if<br />&nbsp; &nbsp; end do<br />&nbsp; end subroutine add</p><p>&nbsp; subroutine work(meze,res)<br />&nbsp; &nbsp; use typy<br />&nbsp; &nbsp; implicit none<br />&nbsp; &nbsp; real(kind=rkind), dimension(2), intent(in) :: meze<br />&nbsp; &nbsp; real(kind=rkind), intent(out) :: res<br />&nbsp; &nbsp; !print *, &quot;work zacina&quot;, meze<br />&nbsp; &nbsp; res = integral(f,meze(1), meze(2), 1.0e-30_rkind)<br />&nbsp; &nbsp; !print *, &quot;work konci&quot;<br />&nbsp; end subroutine work</p><p>&nbsp; !&gt; Vypocet pomoci Rombergovy metody<br />&nbsp; recursive function integral(f,a,b,tol) result(y)<br />&nbsp; &nbsp; use typy<br />&nbsp; &nbsp; implicit none<br />&nbsp; &nbsp; interface<br />&nbsp; &nbsp; &nbsp; function f(x) result(y)<br />&nbsp; &nbsp; &nbsp; &nbsp; use typy<br />&nbsp; &nbsp; &nbsp; &nbsp; implicit none<br />&nbsp; &nbsp; &nbsp; &nbsp; real(kind=rkind), intent(in)&nbsp; :: x<br />&nbsp; &nbsp; &nbsp; &nbsp; real(kind=rkind)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :: y<br />&nbsp; &nbsp; &nbsp; end function f<br />&nbsp; &nbsp; end interface<br />&nbsp; &nbsp; integer, parameter :: rsize = 20<br />&nbsp; &nbsp; real(kind=rkind), intent(in) :: a,b,tol<br />&nbsp; &nbsp; real(kind=rkind) :: y, y1, x, wrk<br />&nbsp; &nbsp; real(kind=rkind) :: h<br />&nbsp; &nbsp; integer(kind=ikind) :: n, i, cnt<br />&nbsp; &nbsp; type(sumator) :: sy<br />&nbsp; &nbsp; real(kind=rkind), dimension(1:rsize) :: yy<br />&nbsp; &nbsp; integer :: size</p><p>&nbsp; &nbsp; !print *,&quot;a&quot;<br />&nbsp; &nbsp; h = b-a<br />&nbsp; &nbsp; !print *,&quot;b&quot;<br />&nbsp; &nbsp; y = (f(a)+f(b))/2<br />&nbsp; &nbsp; !print *,&quot;c&quot; nasledujici dela pro 32b problem<br />&nbsp; &nbsp; call sy%setdepth(20_ikind)<br />&nbsp; &nbsp; !print *,&quot;c01&quot;<br />&nbsp; &nbsp; call sy%clear<br />&nbsp; &nbsp; call sy%add(y)<br />&nbsp; &nbsp; !print *,&quot;c1&quot;<br />&nbsp; &nbsp; n = 1<br />&nbsp; &nbsp; size = 1<br />&nbsp; &nbsp; yy(1) = y*h<br />&nbsp; &nbsp; cnt = 1<br />&nbsp; &nbsp; !print *,&quot;d&quot;<br />&nbsp; &nbsp; do<br />&nbsp; &nbsp; &nbsp; n = 2*n<br />&nbsp; &nbsp; &nbsp; h = h/2<br />&nbsp; &nbsp; &nbsp; do i=1,n,2<br />&nbsp; &nbsp; &nbsp; &nbsp; x = a + i*h<br />&nbsp; &nbsp; &nbsp; &nbsp; y =f(x)<br />&nbsp; &nbsp; &nbsp; &nbsp; call sy%add(y)<br />&nbsp; &nbsp; &nbsp; end do<br />&nbsp; &nbsp; &nbsp; y = sy%sum() *h<br />&nbsp; &nbsp; &nbsp; ! ted zaradime<br />&nbsp; &nbsp; &nbsp; wrk = 4<br />&nbsp; &nbsp; &nbsp; y1 = yy(1)<br />&nbsp; &nbsp; &nbsp; if (cnt&nbsp; &lt; rsize) cnt&nbsp; = cnt&nbsp; + 1<br />&nbsp; &nbsp; &nbsp; do i = 1,cnt-1<br />&nbsp; &nbsp; &nbsp; &nbsp; yy(i) = y<br />&nbsp; &nbsp; &nbsp; &nbsp; y = yy(i) + (yy(i)-y1)/(wrk - 1)<br />&nbsp; &nbsp; &nbsp; &nbsp; wrk = 4*wrk<br />&nbsp; &nbsp; &nbsp; &nbsp; y1 = yy(i+1)<br />&nbsp; &nbsp; &nbsp; end do<br />&nbsp; &nbsp; &nbsp; yy(cnt) = y<br />&nbsp; &nbsp; &nbsp; if ( abs(y-y1) &lt; 1.0e-30 )&nbsp; exit<br />&nbsp; &nbsp; end do<br />&nbsp; &nbsp; !print *,&quot;e&quot;<br />&nbsp; &nbsp; y = yy(cnt)<br />&nbsp; end function integral</p><p>&nbsp; function f(x) result(y)<br />&nbsp; &nbsp; use typy<br />&nbsp; &nbsp; implicit none<br />&nbsp; &nbsp; real(kind=rkind), intent(in)&nbsp; :: x<br />&nbsp; &nbsp; real(kind=rkind)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :: y<br />&nbsp; &nbsp; y = 4/(1+x*x)<br />&nbsp; end function f<br />end module pocty</p><br /><p>program copi<br />&nbsp; use typy<br />&nbsp; use pocty<br />&nbsp; implicit none<br />&nbsp; integer :: myid<br />&nbsp; integer :: nimages<br />&nbsp; integer :: pocet_intervalu<br />&nbsp; real(kind=rkind), dimension(1:2), codimension[* ] :: lokmeze<br />&nbsp; real(kind=rkind), codimension[* ]&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:: lokresults<br />&nbsp; logical, codimension[* ]&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :: finished ! vyznamna je jen hodnota v jednicce<br />&nbsp; real(kind=rkind), dimension(:,:), allocatable&nbsp; &nbsp; :: meze<br />&nbsp; real(kind=rkind) :: mz, pi<br />&nbsp; integer(kind=ikind) :: i<br />&nbsp; integer(kind=ikind) :: done<br />&nbsp; integer, dimension(1:8) :: t1, t2<br />&nbsp; real(kind=rkind) :: eltime, wrksec, ll(2),lr</p><br /><p>&nbsp; myid = this_image()<br />&nbsp; nimages = num_images()<br />&nbsp; finished = .false.<br />&nbsp; print *,&quot;jsem &quot;, myid, &quot; z &quot;, nimages<br />&nbsp; sync all<br />&nbsp; if (myid == 1) then<br />&nbsp; &nbsp; pi = 0<br />&nbsp; &nbsp; print *, &quot;zaciname, mam celkem &quot;, nimages, &quot; vlaken&quot;<br />&nbsp; &nbsp; print *, &quot;Zadej pocet intervalu&quot;<br />&nbsp; &nbsp; read *, pocet_intervalu<br />&nbsp; &nbsp; allocate(meze(1:pocet_intervalu,1:2))<br />&nbsp; &nbsp; ! ted je naplnim<br />&nbsp; &nbsp; meze(1,1)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 0<br />&nbsp; &nbsp; meze(pocet_intervalu,2) = 1<br />&nbsp; &nbsp; do i = 1, pocet_intervalu-1<br />&nbsp; &nbsp; &nbsp; mz = real(i,rkind)/pocet_intervalu<br />&nbsp; &nbsp; &nbsp; meze(i,2)&nbsp; &nbsp;= mz<br />&nbsp; &nbsp; &nbsp; meze(i+1,1) = mz<br />&nbsp; &nbsp; end do<br />&nbsp; &nbsp; done = 0<br />&nbsp; &nbsp; finished = .false.<br />&nbsp; &nbsp; ! zacnu merit cas<br />&nbsp; &nbsp; call date_and_time(values=t1)<br />&nbsp; &nbsp; print *, t1<br />&nbsp; end if<br />&nbsp; do<br />&nbsp; sync all<br />&nbsp; ! pridelim praci<br />&nbsp; if (myid == 1) then<br />&nbsp; !&nbsp; print *, 0<br />&nbsp; &nbsp; do i = 1, nimages<br />&nbsp; &nbsp; &nbsp; print *, i<br />&nbsp; &nbsp; &nbsp; done = done + 1<br />&nbsp; &nbsp; &nbsp; if (done &lt;= pocet_intervalu) then<br />&nbsp; &nbsp; &nbsp; &nbsp; lokmeze(1)[i ] = meze(done,1)<br />&nbsp; &nbsp; &nbsp; &nbsp; lokmeze(2)[i ] = meze(done,2)<br />&nbsp; !&nbsp; &nbsp; &nbsp; print *, lokmeze(:)[i ], done<br />&nbsp; &nbsp; &nbsp; else<br />&nbsp; !&nbsp; &nbsp; &nbsp; print *, done<br />&nbsp; &nbsp; &nbsp; &nbsp; lokmeze(1)[i ] = 0.0_rkind<br />&nbsp; &nbsp; &nbsp; &nbsp; lokmeze(2)[i ] = 0.0_rkind<br />&nbsp; &nbsp; &nbsp; &nbsp; finished = .true.<br />&nbsp; &nbsp; &nbsp; end if<br />&nbsp; &nbsp; end do<br />&nbsp; &nbsp;end if<br />&nbsp; &nbsp;!print *, &quot;jeste ano&quot;, myid<br />&nbsp; &nbsp;sync all<br />&nbsp; &nbsp;!print *, lokmeze(1)[myid], lokmeze(2)[myid], lokresults[myid]<br />&nbsp; ! udelam praci<br />&nbsp; ll(1) = lokmeze(1)[myid]<br />&nbsp; ll(2) = lokmeze(2)[myid]<br />&nbsp; !print *,&quot;vlakno &quot;,myid, &quot; zacina&quot;<br />&nbsp; call work(ll, lr)<br />&nbsp; !print *,&quot;vlakno &quot;,myid, &quot; konci&quot;<br />&nbsp; lokresults[myid] = lr<br />&nbsp; lokmeze(:)[myid] = 0.0_rkind<br />&nbsp; !print *, lokmeze(:)[myid], myid<br />&nbsp; ! vezmu si vysledky<br />&nbsp; sync all ! everything should be sybchronized<br />&nbsp; !print *, myid, finished[1], lokresults[myid]<br />&nbsp; if ( myid == 1 ) then<br />&nbsp; &nbsp; do i = 1, nimages<br />&nbsp; &nbsp; &nbsp; pi = pi + lokresults[i ]<br />&nbsp; &nbsp; &nbsp; lokresults[i ]=0.0_rkind<br />&nbsp; &nbsp; end do<br />&nbsp; end if<br />&nbsp; ! zkontroluji konec<br />&nbsp; sync all<br />&nbsp; if ( finished[1] ) exit</p><p>&nbsp; end do<br />&nbsp; sync all<br />&nbsp; if ( myid == 1 ) then<br />&nbsp; &nbsp; print *,&quot;Pi=&quot;, pi<br />&nbsp; &nbsp; call date_and_time(values=t2)<br />&nbsp; &nbsp; print *, t2<br />&nbsp; &nbsp; eltime = (t2(8)-t1(8))/1000.0_rkind +t2(7)-t1(7) + 60.0_rkind*(t2(6)-t1(6)) + 3600.0_rkind*(t2(5)-t1(5))<br />&nbsp; &nbsp; eltime = eltime + 86400.0_rkind*(t2(3)-t1(3))<br />&nbsp; &nbsp; print &quot;(a,f0.7)&quot;, &quot;uplynuly cas=&quot;, eltime<br />&nbsp; end if<br />&nbsp; sync all<br />end program copi</p>]]></content>
			<author>
				<name><![CDATA[pm1a]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3597</uri>
			</author>
			<updated>2019-12-09T22:58:14Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3373#p3373</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: coarrays]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3372#p3372" />
			<content type="html"><![CDATA[<p>Warning! The following errors must be corrected before your message can be posted:<br />[i ]d within itself, this is not allowed</p>]]></content>
			<author>
				<name><![CDATA[pm1a]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3597</uri>
			</author>
			<updated>2019-12-09T22:53:06Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3372#p3372</id>
		</entry>
</feed>
