<?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 Passing a coarray subarray to a function gives a wrong part of the array in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Passing-a-coarray-subarray-to-a-function-gives-a-wrong-part-of/m-p/1154947#M7873</link>
    <description>&lt;P style="font-size: 13.008px;"&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;I'm attempting to understand how to pass a slice of a multidimensional co-array to a function. I would like to use a function like this:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); word-wrap: normal; color: rgb(36, 39, 41);"&gt;&lt;CODE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; white-space: inherit;"&gt;   function get_int_vec(vec_int_2get, rank) result(ret_val)
      implicit none
      integer,  dimension(:), codimension&lt;/CODE&gt;&lt;LI&gt;&lt;CODE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; white-space: inherit;"&gt;, intent(in) :: vec_int_2get
      integer, intent(in) :: rank
      integer, allocatable, dimension(:) :: ret_val 

      ret_val = vec_int_2get(:)[rank]
    end function ! get_int_vec&lt;/CODE&gt;&lt;/LI&gt;&lt;/PRE&gt;

&lt;P style="font-size: 13.008px;"&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;It works fine to get an entire array. But when passing a slice of a coarray, like:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); word-wrap: normal; color: rgb(36, 39, 41);"&gt;&lt;CODE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; white-space: inherit;"&gt; vec_getA(:) = get_int_vec(matrix_A(n, :), rank)&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P style="font-size: 13.008px;"&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;where&amp;nbsp;&lt;/SPAN&gt;&lt;CODE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin: 0px; padding: 1px 5px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; background-color: rgb(239, 240, 241); white-space: pre-wrap; color: rgb(36, 39, 41);"&gt;matrix_A&lt;/CODE&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;&amp;nbsp;is declared as&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); word-wrap: normal; color: rgb(36, 39, 41);"&gt;&lt;CODE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; white-space: inherit;"&gt;  integer, dimension(:, :), codimension[:],  allocatable :: matrix_A
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;DIV style="font-size: 13.008px;"&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;and properly allocated, I always get the first column of&amp;nbsp;&lt;/SPAN&gt;&lt;CODE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin: 0px; padding: 1px 5px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; background-color: rgb(239, 240, 241); white-space: pre-wrap; color: rgb(36, 39, 41);"&gt;matrix_A&lt;/CODE&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;&amp;nbsp;instead of the n-th.&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV style="font-size: 13.008px;"&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;I am compiling with Intel Parallel Studio XE 2018 cluster edition.&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV style="font-size: 13.008px;"&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;I am attaching a minimal working example of the problem: it should print the same number as the rank of the image that is printing, instead of always 1.&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV style="font-size: 13.008px;"&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;Thank you in andvance for the attention.&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Thu, 12 Jul 2018 08:44:49 GMT</pubDate>
    <dc:creator>sparonuz</dc:creator>
    <dc:date>2018-07-12T08:44:49Z</dc:date>
    <item>
      <title>Passing a coarray subarray to a function gives a wrong part of the array</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Passing-a-coarray-subarray-to-a-function-gives-a-wrong-part-of/m-p/1154947#M7873</link>
      <description>&lt;P style="font-size: 13.008px;"&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;I'm attempting to understand how to pass a slice of a multidimensional co-array to a function. I would like to use a function like this:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); word-wrap: normal; color: rgb(36, 39, 41);"&gt;&lt;CODE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; white-space: inherit;"&gt;   function get_int_vec(vec_int_2get, rank) result(ret_val)
      implicit none
      integer,  dimension(:), codimension&lt;/CODE&gt;&lt;LI&gt;&lt;CODE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; white-space: inherit;"&gt;, intent(in) :: vec_int_2get
      integer, intent(in) :: rank
      integer, allocatable, dimension(:) :: ret_val 

      ret_val = vec_int_2get(:)[rank]
    end function ! get_int_vec&lt;/CODE&gt;&lt;/LI&gt;&lt;/PRE&gt;

&lt;P style="font-size: 13.008px;"&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;It works fine to get an entire array. But when passing a slice of a coarray, like:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); word-wrap: normal; color: rgb(36, 39, 41);"&gt;&lt;CODE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; white-space: inherit;"&gt; vec_getA(:) = get_int_vec(matrix_A(n, :), rank)&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P style="font-size: 13.008px;"&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;where&amp;nbsp;&lt;/SPAN&gt;&lt;CODE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin: 0px; padding: 1px 5px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; background-color: rgb(239, 240, 241); white-space: pre-wrap; color: rgb(36, 39, 41);"&gt;matrix_A&lt;/CODE&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;&amp;nbsp;is declared as&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); word-wrap: normal; color: rgb(36, 39, 41);"&gt;&lt;CODE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; white-space: inherit;"&gt;  integer, dimension(:, :), codimension[:],  allocatable :: matrix_A
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;DIV style="font-size: 13.008px;"&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;and properly allocated, I always get the first column of&amp;nbsp;&lt;/SPAN&gt;&lt;CODE style="font-size: 13px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin: 0px; padding: 1px 5px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; background-color: rgb(239, 240, 241); white-space: pre-wrap; color: rgb(36, 39, 41);"&gt;matrix_A&lt;/CODE&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;&amp;nbsp;instead of the n-th.&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV style="font-size: 13.008px;"&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;I am compiling with Intel Parallel Studio XE 2018 cluster edition.&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV style="font-size: 13.008px;"&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;I am attaching a minimal working example of the problem: it should print the same number as the rank of the image that is printing, instead of always 1.&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV style="font-size: 13.008px;"&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px;"&gt;Thank you in andvance for the attention.&lt;/SPAN&gt;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 12 Jul 2018 08:44:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Passing-a-coarray-subarray-to-a-function-gives-a-wrong-part-of/m-p/1154947#M7873</guid>
      <dc:creator>sparonuz</dc:creator>
      <dc:date>2018-07-12T08:44:49Z</dc:date>
    </item>
  </channel>
</rss>

