<?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 Hi, in Intel® oneAPI DPC++/C++ Compiler</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/if-the-array-size-changed-after-function-how-to-do-with-parallel/m-p/1183647#M385</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can you tell us&amp;nbsp;the exact issue that you are facing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rahul&lt;/P&gt;</description>
    <pubDate>Mon, 10 Feb 2020 10:04:00 GMT</pubDate>
    <dc:creator>RahulV_intel</dc:creator>
    <dc:date>2020-02-10T10:04:00Z</dc:date>
    <item>
      <title>if the array size changed after function, how to do with parallel loop ?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/if-the-array-size-changed-after-function-how-to-do-with-parallel/m-p/1183646#M384</link>
      <description>&lt;P&gt;if the array size changed after function, how to do with parallel loop ?&lt;/P&gt;&lt;P&gt;Please give a complete code, Thank You!&lt;/P&gt;&lt;P&gt;This is a c++ code on common PC,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="brush:cpp; class-name:dark;"&gt;#include &amp;lt;iostream&amp;gt;
#include &amp;lt;cstring&amp;gt;
#include &amp;lt;string&amp;gt;
 
using namespace std;

void del_num(string numbers[], int idx, int &amp;amp;size)
{
	int i;
	for(i = idx; i &amp;lt; size - 1; i++)
	{
 
		numbers&lt;I&gt; = numbers[i + 1];
	}
	size--;
 
}

void del_dup(string numbers[], int &amp;amp;size)
{
	int i, j;
	string number;
	for(i = 0; i &amp;lt; size; i++)
	{
		number = numbers&lt;I&gt;;
		for(j = i + 1; j &amp;lt; size; j++)
		{
			if(number == numbers&lt;J&gt;)
			{
 
				del_num(numbers, j, size); j--;	
 
			}
		}
	}
}


  string numbers[] = { "8BCD", "7ED3", "5408", "7684", "804C", 
		"8BCD", "7ED3", "5408", "7684", "80gC", 
		"8BCD", "7ED3", "54e8", "76f4", "804C",
		"8B1D", "7ED3", "5408", "7684", "804C"};
 

int main()
{
 
	
 	int size = sizeof(numbers) / sizeof(numbers[0]); 

 
	
	
		cout &amp;lt;&amp;lt; size &amp;lt;&amp;lt; "=init _ size " &amp;lt;&amp;lt; endl;
		
	del_dup(numbers, size);
	
	for(int i = 0; i &amp;lt; size; i++)
	
	cout &amp;lt;&amp;lt; numbers&lt;I&gt; &amp;lt;&amp;lt; ' '; cout &amp;lt;&amp;lt; endl;
	
	cout &amp;lt;&amp;lt; size &amp;lt;&amp;lt; "=size " &amp;lt;&amp;lt; endl;
	
 
    return 0;
}
&lt;/I&gt;&lt;/J&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the result :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:; class-name:dark;"&gt;$ ./d4
20=init _ size 
8BCD 7ED3 5408 7684 804C 80gC 54e8 76f4 8B1D 
9=size 
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 16:48:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/if-the-array-size-changed-after-function-how-to-do-with-parallel/m-p/1183646#M384</guid>
      <dc:creator>bo__john</dc:creator>
      <dc:date>2020-02-07T16:48:54Z</dc:date>
    </item>
    <item>
      <title>Hi,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/if-the-array-size-changed-after-function-how-to-do-with-parallel/m-p/1183647#M385</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can you tell us&amp;nbsp;the exact issue that you are facing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rahul&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 10:04:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/if-the-array-size-changed-after-function-how-to-do-with-parallel/m-p/1183647#M385</guid>
      <dc:creator>RahulV_intel</dc:creator>
      <dc:date>2020-02-10T10:04:00Z</dc:date>
    </item>
    <item>
      <title>how to write the those code</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/if-the-array-size-changed-after-function-how-to-do-with-parallel/m-p/1183648#M386</link>
      <description>&lt;P&gt;How to write the those code with parallel loop on (oneapi )dpc++ devcloud platform?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the normal parallel loop with a integer value for the size of loop,&amp;nbsp; if i write array after fuction size of max of loop was changed, how to do it? please give a sample.like code i give on pc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i needs help please translate my code with parralel loop for the string array &amp;nbsp;on devcloud linux system use bash with instruction "ssh " to login,&amp;nbsp; dpc++ compiler.&lt;/P&gt;&lt;P&gt;&amp;nbsp;full code example like i give at first. please!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please make the parallel loop as a function outside of main() function, code style maybe like that like that :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="brush:cpp; class-name:dark;"&gt;#include &amp;lt;CL/sycl.hpp&amp;gt;
#include &amp;lt;iostream&amp;gt;

using namespace std;
using namespace cl::sycl;


 struct myStruct
    {
        int id=1234;
        char a[50];
    };

struct myStruct dt_v1[10];
struct myStruct dt_v2[10];


void abc1(){
    strcpy(dt_v1[0].a, "102755703");
    strcpy(dt_v1[1].a, "ab10");
    strcpy(dt_v1[2].a, "cd10");
    strcpy(dt_v1[3].a, "EF13");
    strcpy(dt_v1[4].a, "5");
    strcpy(dt_v1[5].a, "##184");
    strcpy(dt_v1[6].a, "@@1");
    strcpy(dt_v1[7].a, "&amp;amp;&amp;amp;13");
    strcpy(dt_v1[8].a, "%%14");
    strcpy(dt_v1[9].a, "!!1");

}


void abc2(){
    strcpy(dt_v2[0].a, "102755703");
    strcpy(dt_v2[1].a, "ab10");
    strcpy(dt_v2[2].a, "cd10");
    strcpy(dt_v2[3].a, "EF13");
    strcpy(dt_v2[4].a, "5");
    strcpy(dt_v2[5].a, "##184");
    strcpy(dt_v2[6].a, "@@1");
    strcpy(dt_v2[7].a, "&amp;amp;&amp;amp;13");
    strcpy(dt_v2[8].a, "%%14");
    strcpy(dt_v2[9].a, "!!1");

}


void dpcpp_parallel(){ 
    // ---------SYCL SCOPE STARTS------------
    {
        default_selector device_selector; 
        queue device_queue(device_selector);
        cout&amp;lt;&amp;lt;device_queue.get_device().get_info&amp;lt;info::device::name&amp;gt;()&amp;lt;&amp;lt;std::endl;  //print name of the device it is running on.
        buffer&amp;lt;struct myStruct,1&amp;gt; buff_dt_v1(dt_v1,range&amp;lt;1&amp;gt;{10});
        buffer&amp;lt;struct myStruct,1&amp;gt; buff_dt_v2(dt_v2,range&amp;lt;1&amp;gt;{10});
        device_queue.submit([&amp;amp;](handler &amp;amp;cgh){        
            auto acc_dt_v1 =buff_dt_v1.get_access&amp;lt;access::mode::write&amp;gt;(cgh);        
            auto acc_dt_v2 =buff_dt_v2.get_access&amp;lt;access::mode::write&amp;gt;(cgh); 
            cgh.parallel_for&amp;lt;class StructClass&amp;gt;(range&amp;lt;1&amp;gt;{10},[=](id&amp;lt;1&amp;gt; index){
             struct myStruct* myAcc1=(struct myStruct*)(&amp;amp;acc_dt_v1[index]);
             struct myStruct* myAcc2=(struct myStruct*)(&amp;amp;acc_dt_v2[index]);
            //**************your code logic starts from here**************************
                // to access array "a" use this    
                     char* myArray1=myAcc1-&amp;gt;a;
                     char* myArray2=myAcc2-&amp;gt;a;
                // To access int "id" use this
                    int myId=myAcc-&amp;gt;id;
            });
        });
    }
}

int main(){

    int test1=atoi(dt_v1[4].a);
    std::cout&amp;lt;&amp;lt;"Converting char[] to int "&amp;lt;&amp;lt;test1&amp;lt;&amp;lt;std::endl;
    abc1(); // Initialisation for dt_v1[]
    abc2(); // Initialisation for dt_v2[]
    dpcpp_parallel();    
    return 0;
}
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 09:36:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/if-the-array-size-changed-after-function-how-to-do-with-parallel/m-p/1183648#M386</guid>
      <dc:creator>bo__john</dc:creator>
      <dc:date>2020-02-11T09:36:00Z</dc:date>
    </item>
    <item>
      <title>Hi,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/if-the-array-size-changed-after-function-how-to-do-with-parallel/m-p/1183649#M387</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;This support is out of our scope. However, we are marking this as a community case so that other users can help you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 06:19:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/if-the-array-size-changed-after-function-how-to-do-with-parallel/m-p/1183649#M387</guid>
      <dc:creator>RahulV_intel</dc:creator>
      <dc:date>2020-02-12T06:19:23Z</dc:date>
    </item>
  </channel>
</rss>

