Loading...
You are not logged-in Login/Register





  • Posts   Search Threads
  • galbimenSeptember 15, 2009 4:04 AM PDT   
    Help! BLAS problem

    Hi, im Jack.

    Im trying to convert to the MKL in my some source.
    The problem is the difference between the output datas.

    The original code is :

    for(ix=0; ix<nx; ++ix)
       for(iz=0; iz<nz; ++iz)
           t[ix][iz] = a1*t1[ix][iz] + a2*t2[ix][iz];
     
    Like this. and converting to MKL(BLAS) is :

    for(ix=0; ix<nx; ++ix)
    {
       cblas_sscal(nz, a1, t1[ix], 1);
       cblas_scopy(nz, t1[ix], 1, t[ix], 1);
       cblas_saxpy(nz, a2, t2[ix], 1, t[ix], 1);
    }
    t, t1, t2 Array are varible of float type. The Output data is a little bit wrong.
    But I need accuracy data because it is related with my work. 
    I don't know where is wrong. Did I miss something to do ?
    Please help me.

    TimP (Intel)September 15, 2009 7:04 AM PDT
    Rate
     
    Re: Help! BLAS problem

    If you require the effect of (double)a1*t1[ix][iz] + (double)a2*t[ix][iz]   (K&R style evaluation, still default 2 decades later, for many C compilers), you are better off with the C code.  If you want good performance, you should get the same numerical result, with much better performance than cblas, by compiling your C code with a vectorizing compiler, without the implicit promotion to double.
    I find your style misleading, particularly without the data definitions.


    galbimenSeptember 15, 2009 7:50 AM PDT
    Rate
     
    Re: Help! BLAS problem

    Quoting - tim18
    If you require the effect of (double)a1*t1[ix][iz] + (double)a2*t[ix][iz]   (K&R style evaluation, still default 2 decades later, for many C compilers), you are better off with the C code.  If you want good performance, you should get the same numerical result, with much better performance than cblas, by compiling your C code with a vectorizing compiler, without the implicit promotion to double.
    I find your style misleading, particularly without the data definitions.

    Thank you abt the advise.
    Your saying is all correct. I want better performance than before.
    But vectorizing or parallelizing things are already being tried by another team member.
    My target is only converting to MKL. that's why i've been trying to do with MKL.

    Now i wonder if cblas_saxpy function is worked by 2 dimentional array  or not.
    like : 

    t[ix][iz] += (float)a1*t1[ix][iz] ;
    =>  cblas_saxpy(nz, a1, t1[ix] ,1 , t[ix] , 1); 

    if i convert like this, i can't get same numerical results. is it impassible?

    Gennady Fedorov (Intel)September 20, 2009 10:09 PM PDT
    Rate
     
    Re: Help! BLAS problem

    Quoting - galbimen
    Hi, im Jack.

    Im trying to convert to the MKL in my some source.
    The problem is the difference between the output datas.

    The original code is :

    for(ix=0; ix<nx; ++ix)
       for(iz=0; iz<nz; ++iz)
           t[ix][iz] = a1*t1[ix][iz] + a2*t2[ix][iz];
     
    Like this. and converting to MKL(BLAS) is :

    for(ix=0; ix<nx; ++ix)
    {
       cblas_sscal(nz, a1, t1[ix], 1);
       cblas_scopy(nz, t1[ix], 1, t[ix], 1);
       cblas_saxpy(nz, a2, t2[ix], 1, t[ix], 1);
    }
    t, t1, t2 Array are varible of float type. The Output data is a little bit wrong.
    But I need accuracy data because it is related with my work. 
    I don't know where is wrong. Did I miss something to do ?
    Please help me.

    Galbimen,
    The Output data is a little bit wrong.
    What is the size of this difference?
    What is the input data?
    Can you get us the test case for the investigating the problem?
    --Gennady



Forum jump:  

Intel Software Network Forums Statistics

17,025 users have contributed to 48,319 threads and 172,758 posts to date.

In the past 24 hours, we have 11 new thread(s) 54 new posts(s), and 47 new user(s).

In the past 3 days, the most popular thread for everyone has been Optimalization of sine function\'s taylor expansion The most posts were made to Most likely, the issue is that The post with the most views is Optimalization of sine function\'s taylor expansion

Please welcome our newest member redfruit83


For more complete information about compiler optimizations, see our Optimization Notice.