Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 395
    • Issues 395
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 17
    • Merge requests 17
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #1432
Closed
Open
Created Oct 18, 2006 by Daoen Pan@dpaGuest

sac2c don't know #pragma

Bugzilla Link 309
Created on Oct 18, 2006 10:44
Resolution FIXED
Resolved on Oct 18, 2006 16:36
Version 1.00beta
OS Linux
Architecture PC

Extended Description

The program matmul.sac can not be compiled!
/*****************************************************************************
 *
 * file:   matmul.sac
 *
 * description:
 *
 *   SAC demo program.
 *
 *   This SAC demo program implements matrix multiplication for two matrices
 *   A and B of double precision floating point numbers.
 *
 *   The sizes of A and B are preset as follows:
 *     A is of size SIZE1 x SIZE2, and
 *     B is of size SIZE2 x SIZE3.
 *   These parameters may be set at compile time.
 *
 *   The pragma given in the matmul function forces the compiler to introduce
 *   a blocking of squares containing 32 by 32 elements. Though these numbers
 *   seem to work well on many architectures, it might be worthwhile to vary
 *   them for getting better execution times.
 *
 *   On SUN-SOLARIS systems cc should be used instead of gcc for achieving
 *   much better runtime performance. To do so, specify "-target suncc" as
 *   compiler option!
 *
 *****************************************************************************/
#ifndef SIZE1
#define SIZE1 1024
#endif
#ifndef SIZE2
#define SIZE2 1024
#endif
#ifndef SIZE3
#define SIZE3 1024
#endif
use Array:all;
use SimplePrint:all;
inline
double[.,.] transpose( double[.,.] A)
{
  res = with( . <= [i,j] <= .) {
       } genarray( [shape(A)[[1]], shape(A)[[0]]], A[[j,i]], 0d);
  return( res);
}
double[.,.] matmul( double[.,.] A, double[.,.] B)
{
  sa = shape(A);
  sb = shape(B);
  B = reshape( [sa[[1]], sb[[1]]], B);
  BT = transpose( B);
  C = #pragma wlcomp BvL0( [16,16], Default) 
      with ( . <= [i,j] <= .)
      genarray( [ sa[[0]], sb[[1]] ], sum( A[[i]] * BT[[j]]));
  return( C);
}
int main()
{
  A = genarray( [SIZE1,SIZE2], 1.0);
  B = genarray( [SIZE2,SIZE3], 1.0);
  C = matmul( A, B);
#if 0
  printf( "C[0,0] = %f\n", C[0,0]);
  return(0);
#else
  a = print( C[0,0]);
  return( a);
#endif
}
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking