<?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 I would suspect that the in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948064#M1949</link>
    <description>&lt;P&gt;I would suspect that the struct layout (size in bytes) on the host compiler is different from the opencl CPU compiler. Can u please try using 'packed' keyword for the struct definition on Host and&amp;nbsp;Kernel as well, see if that helps. (OpenCL 1.2 specification 6.11.1)&lt;/P&gt;</description>
    <pubDate>Sun, 05 Jan 2014 07:13:12 GMT</pubDate>
    <dc:creator>Rami_J_Intel</dc:creator>
    <dc:date>2014-01-05T07:13:12Z</dc:date>
    <item>
      <title>Crash when assigning two structures.</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948059#M1944</link>
      <description>&lt;P&gt;Hi !&lt;/P&gt;

&lt;P&gt;I am having quite a strange problem on the cpu ( I don't have intel gpu to try this, but works on nvidia ).&lt;/P&gt;

&lt;P&gt;I have a kernel which makes everything crash at an assignment depending on my structure.&lt;/P&gt;

&lt;P&gt;If I uncomment the _pad0 variable the crash does not appear. The sizes are the same on the host and device.&lt;/P&gt;

&lt;P&gt;Here is my structure:&lt;/P&gt;

&lt;P&gt;[cpp]&lt;/P&gt;

&lt;P&gt;typedef struct capsule_s&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; vector2d_t&amp;nbsp;p; // center of mass position&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; vector2d_t&amp;nbsp;v; // center of mass velocity&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; scalar_t &amp;nbsp; &amp;nbsp;r; // Radius&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; scalar_t &amp;nbsp; &amp;nbsp;mass_density;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; scalar_t &amp;nbsp; &amp;nbsp;color_field;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; //scalar_t&amp;nbsp;_pad0; // For removing the crash&amp;nbsp;with intel cpu.&lt;BR /&gt;
	} capsule_t;[/cpp]&lt;/P&gt;

&lt;P&gt;vector2d_t is defined as cl_float2 for host and float2 in kernels. scalar_t as cl_float and float.&lt;/P&gt;

&lt;P&gt;In the kernel I have something similar to:&lt;/P&gt;

&lt;P&gt;[cpp]&lt;/P&gt;

&lt;P&gt;capsule_t geom_old = in_capsules[idx];&lt;BR /&gt;
	/*&lt;BR /&gt;
	Code that doesn't crash.&lt;BR /&gt;
	*/&lt;/P&gt;

&lt;P&gt;out_capsules[idx] = geom_new; &amp;nbsp;// Here it crashes&lt;/P&gt;

&lt;P&gt;[/cpp]&lt;/P&gt;

&lt;P&gt;More precisely I found that all of this fail&amp;nbsp;:&lt;/P&gt;

&lt;P&gt;[cpp]&lt;/P&gt;

&lt;P&gt;out_capsules[idx].v = geom_new.v; &amp;nbsp;// fails&lt;/P&gt;

&lt;P&gt;/----------&lt;/P&gt;

&lt;P&gt;float2 tmp =&amp;nbsp;&amp;nbsp;geom_new.v; // no failure here.&lt;/P&gt;

&lt;P&gt;out_capsules[idx].v = tmp; // fails&lt;/P&gt;

&lt;P&gt;/----------&lt;/P&gt;

&lt;P&gt;out_capsules[idx].v.x = geom_new.v.x; &amp;nbsp;// fails&lt;/P&gt;

&lt;P&gt;[/cpp]&lt;/P&gt;

&lt;P&gt;And this only happens for this member. I am not sure if this is related to alignement since other members assignments do&amp;nbsp;not cause problems.&lt;/P&gt;

&lt;P&gt;Any help is welcome :)&lt;/P&gt;

&lt;P&gt;Thanks in advance !&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2014 14:20:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948059#M1944</guid>
      <dc:creator>Romain_c_</dc:creator>
      <dc:date>2014-01-02T14:20:52Z</dc:date>
    </item>
    <item>
      <title>Is it possible to attach the</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948060#M1945</link>
      <description>&lt;P&gt;Is it possible to attach the minimal kernel that results in the crash?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
	Raghu&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2014 20:09:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948060#M1945</guid>
      <dc:creator>Raghupathi_M_Intel</dc:creator>
      <dc:date>2014-01-03T20:09:30Z</dc:date>
    </item>
    <item>
      <title>yes of course !</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948061#M1946</link>
      <description>&lt;P&gt;Of course ! Thx for the reply :)&lt;/P&gt;

&lt;P&gt;Here is the whole kernel if you want the including header and other functions I can send if you want.&lt;/P&gt;

&lt;P&gt;[cpp]&lt;/P&gt;

&lt;P&gt;__kernel void bacteria_step ( __global capsule_t* in_capsules,&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __global capsule_t* out_capsules,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;__global int* box_map,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __global gp_box_t* boxes,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;__global gp_command_t* commands,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; float timestep,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;float boundary_sphere_radius )&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; int idx = get_global_id(0);&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; int box_idx = box_map[idx];&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; gp_box_t box = boxes[box_idx];&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; capsule_t geom_old = in_capsules[idx];&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; vector2d_t pressure_force &amp;nbsp;= (vector2d_t) (.0f, .0f );&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; vector2d_t viscosity_force = (vector2d_t) (.0f, .0f );&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; vector2d_t surface_normal &amp;nbsp;= (vector2d_t) (.0f, .0f );&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; scalar_t &amp;nbsp; lagr_ci &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = .0f;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; for(int ii = 0; ii &amp;lt; GP_BOX_POP_SIZE + GP_BOX_GHOST_SIZE; ii++)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int i = (ii &amp;lt; GP_BOX_POP_SIZE) ? box.gp_box_pop[ii] : box.gp_box_ghost[ii-GP_BOX_POP_SIZE];&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ( (i != GP_UNDEF_ID) )&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; capsule_t geom_alt = in_capsules&lt;I&gt;;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ( i != idx )&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; { &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pressure_force &amp;nbsp;-= pressure_between_two ( geom_old, geom_alt );&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; viscosity_force += viscosity_between_two ( geom_old, geom_alt );&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/I&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; surface_normal += &amp;nbsp;( MASS / geom_alt.mass_density ) * poly6_kernel_nabla ( geom_old.p - geom_alt.p, SMOOTHING_LEN );&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lagr_ci += ( MASS / geom_alt.mass_density ) * poly6_kernel_nabla_2 ( geom_old.p - geom_alt.p, SMOOTHING_LEN );&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; }&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; viscosity_force *= VISCOSITY;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; vector2d_t surface_force = -SURF_TENSION * lagr_ci * ( surface_normal / length ( surface_normal ) );&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; capsule_t geom_new = geom_old;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; /////////////&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; // Leap-frog&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; /////////////&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; vector2d_t tot_force = pressure_force + &amp;nbsp;REST_DENSITY * GRAVITY + viscosity_force;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; tot_force += length ( surface_normal ) &amp;gt;= THRESHOLD ? surface_force : .0f;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; vector2d_t accel &amp;nbsp; &amp;nbsp; = tot_force / geom_new.mass_density;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; vector2d_t old_vel &amp;nbsp; = geom_new.v;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; vector2d_t new_vel &amp;nbsp; = geom_new.v + accel * timestep; // vel_.5dt = vel_-.5dt + dt*accel.&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; geom_new.p += timestep * new_vel;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; geom_new.v = ( old_vel + new_vel ) * .5f;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; handle_sphere_env_collision ( &amp;amp;geom_new,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; boundary_sphere_radius,&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; timestep );&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; out_capsules[idx] = geom_new;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; /////////////&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; // Update map&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; /////////////&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; int2 box_coord = (int2){ floor(geom_new.p.x / GP_BOX_URADIUS),&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;floor(geom_new.p.y / GP_BOX_URADIUS) };&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; if ( (box_coord.x != box.gp_box_coord.x) || (box_coord.y != box.gp_box_coord.y) )&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; commands[idx].gp_command_type = GP_COMMAND_MOVE;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; commands[idx].gp_command_pos = box_coord;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; commands[idx].gp_command_data = idx;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; else&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; commands[idx].gp_command_type = GP_COMMAND_NONE;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	}&lt;/P&gt;

&lt;P&gt;[/cpp]&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2014 20:49:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948061#M1946</guid>
      <dc:creator>Romain_c_</dc:creator>
      <dc:date>2014-01-03T20:49:46Z</dc:date>
    </item>
    <item>
      <title>Quote:Romain c. wrote:</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948062#M1947</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Romain c. wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Here is the whole kernel if you want the including header and other functions I can send if you want.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Yes please.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Jan 2014 00:19:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948062#M1947</guid>
      <dc:creator>Raghupathi_M_Intel</dc:creator>
      <dc:date>2014-01-04T00:19:50Z</dc:date>
    </item>
    <item>
      <title>I have put them in a zip file</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948063#M1948</link>
      <description>&lt;P&gt;I have put them in a&amp;nbsp;zip file.&lt;/P&gt;

&lt;P&gt;Also I forgot to say if I remove the color_field (and padding) member it works too.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Jan 2014 10:06:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948063#M1948</guid>
      <dc:creator>Romain_c_</dc:creator>
      <dc:date>2014-01-04T10:06:28Z</dc:date>
    </item>
    <item>
      <title>I would suspect that the</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948064#M1949</link>
      <description>&lt;P&gt;I would suspect that the struct layout (size in bytes) on the host compiler is different from the opencl CPU compiler. Can u please try using 'packed' keyword for the struct definition on Host and&amp;nbsp;Kernel as well, see if that helps. (OpenCL 1.2 specification 6.11.1)&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jan 2014 07:13:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948064#M1949</guid>
      <dc:creator>Rami_J_Intel</dc:creator>
      <dc:date>2014-01-05T07:13:12Z</dc:date>
    </item>
    <item>
      <title>I tried with packed for</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948065#M1950</link>
      <description>&lt;P&gt;I tried with packed for kernel side, and used the pragmas &amp;nbsp;push,&amp;nbsp;pack and pop ( not sure about this ) on host side, it makes the program not crash but size of the structure is 28 on kernel but still 32 on host. So data is not correct after...&lt;/P&gt;

&lt;P&gt;Thanks for helping :)&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2014 15:44:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948065#M1950</guid>
      <dc:creator>Romain_c_</dc:creator>
      <dc:date>2014-01-06T15:44:07Z</dc:date>
    </item>
    <item>
      <title>Can you post the host side</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948066#M1951</link>
      <description>&lt;P&gt;Can you post the host side structure (with the pragmas you added)?&lt;/P&gt;

&lt;P&gt;Raghu&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2014 18:28:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948066#M1951</guid>
      <dc:creator>Raghupathi_M_Intel</dc:creator>
      <dc:date>2014-01-08T18:28:48Z</dc:date>
    </item>
    <item>
      <title>Here it is. Names are a bit</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948067#M1952</link>
      <description>&lt;P&gt;Here it is. Names are a bit different but everything is as before. Thx.&lt;/P&gt;

&lt;P&gt;[cpp]&lt;/P&gt;

&lt;P&gt;#ifndef __SPH_KERNEL__&lt;BR /&gt;
	#pragma pack(push) &amp;nbsp;/* push current alignment to stack */&lt;BR /&gt;
	#pragma pack(1) &amp;nbsp; &amp;nbsp; /* set alignment to 1 byte boundary */&lt;BR /&gt;
	#endif&lt;BR /&gt;
	typedef struct&amp;nbsp;&lt;BR /&gt;
	#ifdef __SPH_KERNEL__&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; __attribute__ ((packed))&amp;nbsp;&lt;BR /&gt;
	#endif&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; capsule_s&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; vector2d_t p; // center of mass position&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; vector2d_t v; // center of mass velocity&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; scalar_t &amp;nbsp; r; // Radius&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; scalar_t &amp;nbsp; mass_density;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; scalar_t &amp;nbsp; rr;&lt;BR /&gt;
	} capsule_t;&lt;BR /&gt;
	#ifndef __SPH_KERNEL__&lt;BR /&gt;
	#pragma pack(pop)&amp;nbsp;&lt;BR /&gt;
	#endif&lt;/P&gt;

&lt;P&gt;[/cpp]&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2014 18:54:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948067#M1952</guid>
      <dc:creator>Romain_c_</dc:creator>
      <dc:date>2014-01-08T18:54:55Z</dc:date>
    </item>
    <item>
      <title>With or without packing the</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948068#M1953</link>
      <description>&lt;P&gt;With or without packing the size of the above structure will be 28. Are you sure you are not picking up the definition of the structure from some other header?&lt;/P&gt;

&lt;P&gt;Try writing a simple test program, declare capsule_s and try to print the size of the structure. What do you get?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
	Raghu&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2014 20:19:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948068#M1953</guid>
      <dc:creator>Raghupathi_M_Intel</dc:creator>
      <dc:date>2014-01-10T20:19:03Z</dc:date>
    </item>
    <item>
      <title>I tried what you suggested</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948069#M1954</link>
      <description>&lt;P&gt;I tried what you suggested with a c++ and c compiler only using the struct declaration with cl_types. On c++ compiler the size is indeed 28 but on a C99 compiler it is 32 ( both clang and intel one ).&lt;/P&gt;

&lt;P&gt;Moreover in c99 I think that the compiler add padding to be aligned with the largest data in the struct. For instance here, largest size is 8, and 32 is multiple of 8. Am I right?&lt;/P&gt;

&lt;P&gt;Thanks for your patience :)&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2014 22:55:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Crash-when-assigning-two-structures/m-p/948069#M1954</guid>
      <dc:creator>Romain_c_</dc:creator>
      <dc:date>2014-01-10T22:55:50Z</dc:date>
    </item>
  </channel>
</rss>

