Unix/Linux Go Back    


High Performance Computing Message Passing Interface (MPI) programming and tuning, MPI library installation and management, parallel administration tools, cluster monitoring, cluster optimization, and more HPC topics.

Vectorization

High Performance Computing


Tags
c++, performance, sse, vectorize

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 03-28-2014
a3mlord a3mlord is offline
Registered User
 
Join Date: Mar 2014
Last Activity: 29 March 2014, 12:29 PM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Signal Vectorization

Hi,

I have the following vectorized code:

Code:
long valor = 0, i=0;

 __m128i vsum, vecPi, vecCi, vecQCi;

 vsum = _mm_set1_epi32(0);

 int32_t * const pA = A->data;
 int32_t * const pB = B->data;

 int sumDot[1];

 for( ; i<SIZE-3 ;i+=4){

 vecPi = _mm_loadu_si128((__m128i *)&(pA)[i] );
 vecCi = _mm_loadu_si128((__m128i *)&(pB)[i] );
 vecQCi = _mm_mullo_epi32(vecPi,vecCi);
 vsum = _mm_add_epi32(vsum,vecQCi);

 } 
 vsum = _mm_hadd_epi32(vsum, vsum);
 vsum = _mm_hadd_epi32(vsum, vsum);
 _mm_storeu_si128((__m128i *)&(sumDot), vsum);

 for( ; i<SIZE; i++)
 valor += A->data[i] * B->data[i];   valor += sumDot[0];

However, as I get overflows, I need to handle those cases. Could you please help me with that?

Thanks

Last edited by bartus11; 03-28-2014 at 05:06 PM.. Reason: Please use [code][/code] tags.
Sponsored Links
    #2  
Old Unix and Linux 03-28-2014
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 23 June 2017, 6:44 PM EDT
Location: Saskatchewan
Posts: 22,254
Thanks: 1,105
Thanked 4,199 Times in 3,884 Posts
What compiler is this?
Sponsored Links
    #3  
Old Unix and Linux 03-29-2014
a3mlord a3mlord is offline
Registered User
 
Join Date: Mar 2014
Last Activity: 29 March 2014, 12:29 PM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ipcp and g++, I use both.

---------- Post updated 03-29-14 at 11:29 AM ---------- Previous update was 03-28-14 at 04:52 PM ----------

Someone?
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -4. The time now is 11:45 PM.