<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: forall construct in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Re-forall-construct/m-p/965009#M22635</link>
    <description>&lt;PRE&gt;&lt;FONT size="+0"&gt; 
! Since you choose to read only my Fortran, not my prose... 
program forall_test 
   implicit none 
   real, allocatable :: array1(:), array2(:), array3(:), array4(:) 
   integer N 
   integer k 
   integer i 
 
   write(*,'(a)',advance='no') 'Enter the problem size:&amp;gt; ' 
   read(*,*) N 
   allocate(array1(max(N-1,1)),array2(N**2),array3(max(N-1,1))) 
   allocate(array4(N)) 
   call random_seed() 
   call random_number(array2) 
   call random_number(array3) 
   k = N*(N-1) 
   do i = 1, N 
      array1 = array2(i:k+i:N)*array3 ! Generates WARNING! 
      array4(i) = dot_product(array1, array1) 
   end do 
   write(*,'(a)') 'Results for DO loop:' 
   write(*,'(a,i0,a,f0.6)') ('array4(',i,') = ',array4(i),i=1,N) 
   forall( i = 1:N) 
      array1 = array2(i:k+i:N)*array3 
      array4(i) = dot_product(array1, array1) 
!   end do 
   end forall ! Suppress Christo for end do as above 
   write(*,'(a)') 'Results for FORALL construct:' 
   write(*,'(a,i0,a,f0.6)') ('array4(',i,') = ',array4(i),i=1,N) 
end program forall_test 
&lt;/FONT&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 30 Aug 2001 10:20:24 GMT</pubDate>
    <dc:creator>Intel_C_Intel</dc:creator>
    <dc:date>2001-08-30T10:20:24Z</dc:date>
    <item>
      <title>Re: forall construct</title>
      <link>https://community.intel.com/t5/Software-Archive/Re-forall-construct/m-p/965007#M22633</link>
      <description>One thing you should try when experimenting with new syntax is to run it through the compiler with F95 standard checking enabled.  Your FORALL construct should give you at least two errors because you forgot to change the end do to end forall and because the first statement in your FORALL construct is a multiple assignment.  The tricky thing about FORALL and WHERE is that they are not really looping constructs.  The first statement says to assign array1 N times in any order and the second says to take the last assigned value of array1 and use it to determine all N values of array4.  Thus all entries of array4 will have the same indeterminate value.  You could replace both statements by &lt;BR /&gt; &lt;BR /&gt;array4(i) = sum(abs(array2(i:k+i:N)*array3)**2) &lt;BR /&gt; &lt;BR /&gt;and then the FORALL should work, given that you changed the end do to end forall as well.</description>
      <pubDate>Thu, 30 Aug 2001 08:34:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Re-forall-construct/m-p/965007#M22633</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-08-30T08:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: forall construct</title>
      <link>https://community.intel.com/t5/Software-Archive/Re-forall-construct/m-p/965008#M22634</link>
      <description>To answer your last question, yes, FORALL body constructs (the statements within the FORALL) are executed in sequence, but there is no implied ordering among the operations on the various active indexes.&lt;BR /&gt;&lt;BR /&gt;For assignment statements, the standard says, "Execution of a &lt;I&gt;forall-assignment-stmt&lt;/I&gt; that is an &lt;I&gt;assignment-stmt&lt;/I&gt; causes the evaluation of &lt;I&gt;expr&lt;/I&gt; and all expressions within &lt;I&gt;variable&lt;/I&gt; for all active combinations of &lt;I&gt;index-name&lt;/I&gt; vakues.  These evaluations may be done in any order.  After all these evaluations have been performed, each &lt;I&gt;expr&lt;/I&gt; value is assigned to the corresponding &lt;I&gt;variable&lt;/I&gt;.  The assignments may occur in any order." &lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Thu, 30 Aug 2001 08:46:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Re-forall-construct/m-p/965008#M22634</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2001-08-30T08:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: forall construct</title>
      <link>https://community.intel.com/t5/Software-Archive/Re-forall-construct/m-p/965009#M22635</link>
      <description>&lt;PRE&gt;&lt;FONT size="+0"&gt; 
! Since you choose to read only my Fortran, not my prose... 
program forall_test 
   implicit none 
   real, allocatable :: array1(:), array2(:), array3(:), array4(:) 
   integer N 
   integer k 
   integer i 
 
   write(*,'(a)',advance='no') 'Enter the problem size:&amp;gt; ' 
   read(*,*) N 
   allocate(array1(max(N-1,1)),array2(N**2),array3(max(N-1,1))) 
   allocate(array4(N)) 
   call random_seed() 
   call random_number(array2) 
   call random_number(array3) 
   k = N*(N-1) 
   do i = 1, N 
      array1 = array2(i:k+i:N)*array3 ! Generates WARNING! 
      array4(i) = dot_product(array1, array1) 
   end do 
   write(*,'(a)') 'Results for DO loop:' 
   write(*,'(a,i0,a,f0.6)') ('array4(',i,') = ',array4(i),i=1,N) 
   forall( i = 1:N) 
      array1 = array2(i:k+i:N)*array3 
      array4(i) = dot_product(array1, array1) 
!   end do 
   end forall ! Suppress Christo for end do as above 
   write(*,'(a)') 'Results for FORALL construct:' 
   write(*,'(a,i0,a,f0.6)') ('array4(',i,') = ',array4(i),i=1,N) 
end program forall_test 
&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Aug 2001 10:20:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Re-forall-construct/m-p/965009#M22635</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-08-30T10:20:24Z</dc:date>
    </item>
  </channel>
</rss>

