PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Loop not vectorized: mixed data types

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
SiliconValley



Joined: 24 May 2011
Posts: 6

PostPosted: Tue Feb 21, 2012 9:03 pm    Post subject: Loop not vectorized: mixed data types Reply with quote

The loop in the following code, when compiled on linux with:

Code:
pgCC -c -fast -O3 -Mipa=fast,inline,libopt,libinline -Mvect -Munroll -Mconcur=allcores --restrict -Mneginfo=loop,vect


is not vectorized due to "mixed data types". Following a suggestion from this forum, I changed size_t to long long (see the typedef) to have all variables 64 bits in the loop but no change. The code is part of a big class, here is reduced to have something compilable, but unfortunately neither Minfo nor Mneginfo show anything.

pgCC 11.10-0 64-bit target on x86-64 Linux -tp istanbul

Ideas?
Thenks a lot!
mario

Code:
#include <cmath>
#include <cstring>
extern size_t getNumSites(void);
extern const double* getSiteMultiplicity(void);
double compute(void)
{
     double mMaxLnL = -10000;
     double mLikelihoods[10000];
     double mProportions[4];

     //typedef long long SIZE_T;
     typedef size_t SIZE_T;

    const SIZE_T num_sites = getNumSites();
    const double* mult = getSiteMultiplicity();
    double lnl = 0;
    for(SIZE_T site=0; site < num_sites; ++site)
    {
        double p = mLikelihoods[0*num_sites+site];
        if(p <0> 0) p += (mProportions[1]+mProportions[3])*x;
        x = mLikelihoods[2*num_sites+site];
        if(x > 0) p += mProportions[2]*x;

        x = (p > 0) ? log(p) : mMaxLnL-100000;
        lnl += x*mult[site];
    }
        return lnl;
}
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6211
Location: The Portland Group Inc.

PostPosted: Wed Feb 22, 2012 9:25 am    Post subject: Reply with quote

Hi Mario,

It's the if statments since vectorization is difficult across multiple-blocks. Also, it doesn't look like there is much computation so vectorization may not be worthwhile.

- Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group