From: Daniel Leroux <leroux@IRO.UMontreal.CA>
Date: Mon, 20 Feb 1995 23:29:45 -0500
Subject: OPEN QUESTION
Message-Id: <199502210429.XAA25354@olga.IRO.UMontreal.CA>
Hi I sent this mail to the SUIF-TALK "mail-group" last tuesday
and did not get any response, so I trying this "mail-group" :)
--
Hello
I am trying to use SUIF on a Sun station at University of Montreal.
Because this machine is not "MIPS based", i then use the s2c converter.
and the C file produced by that converter seems OK.
The problem is the following, when i try to compile the generated C code,
the gcc ( version 2.5.8) compiler returns that kind of error messages ::
code-c-pour-DSP.out.c:230: parse error before `)'
Here is how i compiled :
~~~~~~~~~~~~~~~~~~~~~~~
scc -parallel -s2c -.out.c code-c-pour-DSP.c
This creates the following C file :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
code-c-pour-DSP.out.c
Then i try to compile it with gcc like this :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -o executable code-c-pour-DSP.out.c \
$SUIFHOME/$MACHINE/lib/libruntime_seq.a -lm
It would be verry appreciated if someone could tell me
where i made the mistake ?
MORE INFORMATION::
~~~~~~~~~~~~~~~~~
HERE IS THE ORIGINAL C CODE::
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <stdio.h>
#define BLOCKSIZE 8
#define MAX_TEST 100
/**********************************************************************
* Name: convol (const BlockType& operand)
* Title: 3*3 convolution
* Author: Michel Langevin - SYDIS <langevin@novaya
* Created: Dec 13 15:32 1994
* Parameters:
* In: operand: blocks
* Out: returned block = 3*3 convolution of operand
* Modification History:
*********************************************************************/
#define MULT_SHIFT(v,w) (v << w)
#define NOT_MULT_SHIFT(v,w) -(v << w)
convolution (int out[BLOCKSIZE][BLOCKSIZE],
int operand[BLOCKSIZE][BLOCKSIZE])
{
static int w[] = {1, 2, 1, 2, 2, 2, 1, 2, 1};
int w00, w01, w02, w10, w11, w12, w20, w21, w22;
int p00, p01, p02, p10, p11, p12, p20, p21, p22;
int t00, t01, t02, t10, t11, t12, t20, t21, t22;
int v0, v1, v2, v3, v4, v5, v6, v7;
int i, j;
w00 = w[0];
w01 = w[1];
w02 = w[2];
w10 = w[3];
w11 = w[4];
w12 = w[5];
w20 = w[6];
w21 = w[7];
w22 = w[8];
for(i=1; i<BLOCKSIZE-1; i++) {
p00 = operand[i-1][0];
p10 = operand[i][0];
p20 = operand[i+1][0];
p01 = operand[i-1][1];
p11 = operand[i][1];
p21 = operand[i+1][1];
for(j=1; j<BLOCKSIZE-2; j++) {
p02 = operand[i-1][j+1];
p12 = operand[i][j+1];
p22 = operand[i+1][j+1];
t00 = MULT_SHIFT(p00,w00);
t01 = MULT_SHIFT(p01,w01);
t02 = MULT_SHIFT(p02,w02);
t10 = MULT_SHIFT(p10,w10);
t11 = MULT_SHIFT(p11,w11);
t12 = MULT_SHIFT(p12,w12);
t20 = MULT_SHIFT(p20,w20);
t21 = MULT_SHIFT(p21,w21);
t22 = MULT_SHIFT(p22,w22);
v0 = t00 + t01;
v1 = t02 + t10;
v2 = t12 + t20;
v3 = t21 + t22;
v4 = v0 + v1;
v5 = v2 + v3;
v6 = v4 + v5;
v7 = v6 + t11;
out[i][j] = v7;
p00 = p01;
p10 = p11;
p20 = p21;
p01 = p02;
p11 = p12;
p21 = p22;
}
p02 = operand[i-1][j+1];
p12 = operand[i][j+1];
p22 = operand[i+1][j+1];
t00 = MULT_SHIFT(p00,w00);
t01 = MULT_SHIFT(p01,w01);
t02 = MULT_SHIFT(p02,w02);
t10 = MULT_SHIFT(p10,w10);
t11 = MULT_SHIFT(p11,w11);
t12 = MULT_SHIFT(p12,w12);
t20 = MULT_SHIFT(p20,w20);
t21 = MULT_SHIFT(p21,w21);
t22 = MULT_SHIFT(p22,w22);
v0 = t00 + t01;
v1 = t02 + t10;
v2 = t12 + t20;
v3 = t21 + t22;
v4 = v0 + v1;
v5 = v2 + v3;
v6 = v4 + v5;
v7 = v6 + t11;
out[i][j] = v7;
}
}
write_block (int operand[BLOCKSIZE][BLOCKSIZE])
{
int i, j;
for(i=0; i<BLOCKSIZE; i++){
for(j=0; j<BLOCKSIZE; j++){
printf("%d ", operand[i][j]);
}
printf("%s", "\n");
}
}
main ()
{
int out[BLOCKSIZE][BLOCKSIZE];
int operand[BLOCKSIZE][BLOCKSIZE];
int i, j, t;
for(i=0; i<BLOCKSIZE; i++)
for(j=0; j<BLOCKSIZE; j++)
operand[i][j] = j;
for(t=0; t<MAX_TEST; t++)
convolution(out, operand);
write_block(out);
return(0);
}
HERE IS THE C CODE GENERATED (BY S2C)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/*
* This file was created automatically from SUIF
* on Mon Feb 20 23:18:50 1995.
*
* Created by:
* s2c 5.50 compiled Thu Jan 26 17:53:29 EST 1995 by labvlsi on rond.IRO.UMontreal.CA
* Based on SUIF distribution 1.0.1
* Linked with:
* libsuif 5.50.1 compiled Thu Jan 26 17:14:26 EST 1995 by labvlsi on rond.IRO.UMontreal.CA
* libuseful 1.37 compiled Thu Jan 26 17:15:29 EST 1995 by labvlsi on rond.IRO.UMontreal.CA
*/
#define min(x,y) ((x)<(y)?(x):(y))
#define max(x,y) ((x)>(y)?(x):(y))
#define divceil(x,y) (((x)<0)^((y)<0) ? (x)/(y) : ((x) < 0 ? ((x)+(y)+1)/(y) : ((x)+(y)-1)/(y)))
struct _iobuf { int _cnt;
unsigned char *_ptr;
unsigned char *_base;
int _bufsiz;
short _flag;
char _file;int : 8;
};
extern struct _iobuf _iob[];
extern struct _iobuf *fopen();
extern struct _iobuf *fdopen();
extern struct _iobuf *freopen();
extern struct _iobuf *popen();
extern struct _iobuf *tmpfile();
extern int ftell();
extern char *fgets();
extern char *gets();
extern char *sprintf();
extern char *ctermid();
extern char *cuserid();
extern char *tempnam();
extern char *tmpnam();
extern int convolution(int (*)[8], int (*)[8]);
extern int write_block(int (*)[8]);
extern int printf();
extern int _suif_start();
extern void p4_doall(void (*)(int, void *), void *);
extern int p4_num_total_ids(void);
extern int p4_doall_level(void);
extern void p4_global_barrier(int);
extern void p4_lock(int);
extern void p4_unlock(int);
extern void p4_assign_ids(int, int *, int *);
extern void p4_counter_wait(int, int, int);
extern void p4_counter_set(int, int, int);
extern void p4_counter_incr(int, int);
extern void p4_counter_init_range(int);
extern int _suif_nproc;
extern int _my_nprocs;
struct _BLDR_struct_000 { int _field_0;
int (*_field_1)[8];
int (*_field_2)[8]; };
struct _BLDR_struct_001 { int _field_0;
int ((*_field_1)[8])[8]; };
static void _convolution_0_func(int, void *);
static void _main_1_func(int, void *);
int _suif_nproc;
static struct _BLDR_struct_000 _convolution_0_struct;
static struct _BLDR_struct_001 _main_1_struct;
static void _convolution_0_func(int _my_id, void *_my_struct_param)
{
int i;
int (*out)[8];
int j;
int v7;
int v6;
int t11;
int v4;
int v5;
int v2;
int v3;
int v0;
int v1;
int t21;
int t22;
int t12;
int t20;
int t02;
int t10;
int t00;
int t01;
int p22;
int p21;
int p20;
int p12;
int p11;
int p10;
int p02;
int p01;
int p00;
int (*operand)[8];
struct _BLDR_struct_000 *_my_struct_ptr;
struct _BLDR_struct_000 _my_struct;
int _my_id_1;
int _my_id_2;
p4_assign_ids(_my_id, &_my_id_1, &_my_id_2);
_my_struct_ptr = (struct _BLDR_struct_000 *)_my_struct_param;
_my_struct = *_my_struct_ptr;
i = _my_struct._field_0;
out = _my_struct._field_1;
operand = _my_struct._field_2;
{
int _lb0;
int _ub1;
int _step2;
int _range3;
_lb0 = 1;
_ub1 = 6 + 1;
_step2 = 1;
_range3 = divceil(_ub1 - _lb0,_step2);
for (i = max(_range3 * _my_id / _my_nprocs * _step2 + _lb0,_lb0); i < min(_range3 * (_my_id + 1) / _my_nprocs * _step2 + _lb0,_ub1); i += _step2)
{
p00 = operand[i - 1][0];
p10 = operand[i][0];
p20 = operand[i + 1][0];
p01 = operand[i - 1][1];
p11 = operand[i][1];
p21 = operand[i + 1][1];
for (j = 1; j <= 5; j++)
{
p02 = operand[i - 1][j + 1];
p12 = operand[i][j + 1];
p22 = operand[i + 1][j + 1];
t00 = p00 << 1u;
t01 = p01 << 2u;
t02 = p02 << 1u;
t10 = p10 << 2u;
t11 = p11 << 2u;
t12 = p12 << 2u;
t20 = p20 << 1u;
t21 = p21 << 2u;
t22 = p22 << 1u;
v0 = t01 + t00;
v1 = t10 + t02;
v2 = t20 + t12;
v3 = t22 + t21;
v4 = v1 + v0;
v5 = v3 + v2;
v6 = v5 + v4;
v7 = t11 + v6;
out[i][j] = v7;
p00 = p01;
p10 = p11;
p20 = p21;
p01 = p02;
p11 = p12;
p21 = p22;
}
p02 = operand[i - 1][j + 1];
p12 = operand[i][j + 1];
p22 = operand[i + 1][j + 1];
t00 = p00 << 1u;
t01 = p01 << 2u;
t02 = p02 << 1u;
t10 = p10 << 2u;
t11 = p11 << 2u;
t12 = p12 << 2u;
t20 = p20 << 1u;
t21 = p21 << 2u;
t22 = p22 << 1u;
v0 = t00 + t01;
v1 = t02 + t10;
v2 = t12 + t20;
v3 = t21 + t22;
v4 = v0 + v1;
v5 = v2 + v3;
v6 = v4 + v5;
v7 = v6 + t11;
out[i][j] = v7;
}
}
return;
}
static void _main_1_func(int _my_id, void *_my_struct_param)
{
int i;
int j;
int ((*operand)[8])[8];
struct _BLDR_struct_001 *_my_struct_ptr;
struct _BLDR_struct_001 _my_struct;
int _my_id_1;
int _my_id_2;
p4_assign_ids(_my_id, &_my_id_1, &_my_id_2);
_my_struct_ptr = (struct _BLDR_struct_001 *)_my_struct_param;
_my_struct = *_my_struct_ptr;
i = _my_struct._field_0;
operand = _my_struct._field_1;
{
int _lb0;
int _ub1;
int _step2;
int _range3;
_lb0 = 0;
_ub1 = 7 + 1;
_step2 = 1;
_range3 = divceil(_ub1 - _lb0,_step2);
for (i = max(_range3 * _my_id / _my_nprocs * _step2 + _lb0,_lb0); i < min(_range3 * (_my_id + 1) / _my_nprocs * _step2 + _lb0,_ub1); i += _step2)
{
for (j = 0; j <= 7; j++)
{
((int (*)[8])operand)[i][j] = j;
}
}
}
return;
}
extern int convolution(int (*out)[8], int (*operand)[8]))[8]
{
int w00;
int w01;
int w02;
int w10;
int w11;
int w12;
int w20;
int w21;
int w22;
int p00;
int p01;
int p02;
int p10;
int p11;
int p12;
int p20;
int p21;
int p22;
int t00;
int t01;
int t02;
int t10;
int t11;
int t12;
int t20;
int t21;
int t22;
int v0;
int v1;
int v2;
int v3;
int v4;
int v5;
int v6;
int v7;
int i;
int j;
int _doall_level_result;
static int w[9] =
{
1, 2, 1, 2, 2, 2, 1, 2, 1
};
static int w_0 = 1;
static int w_1 = 2;
static int w_2 = 1;
static int w_3 = 2;
static int w_4 = 2;
static int w_5 = 2;
static int w_6 = 1;
static int w_7 = 2;
static int w_8 = 1;
w00 = 1;
w01 = 2;
w02 = 1;
w10 = 2;
w11 = 2;
w12 = 2;
w20 = 1;
w21 = 2;
w22 = 1;
_doall_level_result = p4_doall_level();
if (0 < _doall_level_result)
{
for (i = 1; i <= 6; i++)
{
p00 = operand[i - 1][0];
p10 = operand[i][0];
p20 = operand[i + 1][0];
p01 = operand[i - 1][1];
p11 = operand[i][1];
p21 = operand[i + 1][1];
for (j = 1; j <= 5; j++)
{
p02 = operand[i - 1][j + 1];
p12 = operand[i][j + 1];
p22 = operand[i + 1][j + 1];
t00 = p00 << 1u;
t01 = p01 << 2u;
t02 = p02 << 1u;
t10 = p10 << 2u;
t11 = p11 << 2u;
t12 = p12 << 2u;
t20 = p20 << 1u;
t21 = p21 << 2u;
t22 = p22 << 1u;
v0 = t01 + t00;
v1 = t10 + t02;
v2 = t20 + t12;
v3 = t22 + t21;
v4 = v1 + v0;
v5 = v3 + v2;
v6 = v5 + v4;
v7 = t11 + v6;
out[i][j] = v7;
p00 = p01;
p10 = p11;
p20 = p21;
p01 = p02;
p11 = p12;
p21 = p22;
}
p02 = operand[i - 1][j + 1];
p12 = operand[i][j + 1];
p22 = operand[i + 1][j + 1];
t00 = p00 << 1u;
t01 = p01 << 2u;
t02 = p02 << 1u;
t10 = p10 << 2u;
t11 = p11 << 2u;
t12 = p12 << 2u;
t20 = p20 << 1u;
t21 = p21 << 2u;
t22 = p22 << 1u;
v0 = t00 + t01;
v1 = t02 + t10;
v2 = t12 + t20;
v3 = t21 + t22;
v4 = v0 + v1;
v5 = v2 + v3;
v6 = v4 + v5;
v7 = v6 + t11;
out[i][j] = v7;
}
}
else
{
_convolution_0_struct._field_0 = i;
_convolution_0_struct._field_1 = out;
_convolution_0_struct._field_2 = operand;
p4_doall(_convolution_0_func, &_convolution_0_struct);
}
return 0;
}
extern int write_block(int (*operand)[8]))[8]
{
int i;
int j;
for (i = 0; i <= 7; i++)
{
for (j = 0; j <= 7; j++)
{
printf("%d ", operand[i][j]);
}
printf("%s", "\n");
}
return 0;
}
extern int _suif_start()
{
int (out[8])[8];
int (operand[8])[8];
int i;
int j;
int t;
int _doall_level_result;
_suif_nproc = 0;
_doall_level_result = p4_doall_level();
if (0 < _doall_level_result)
{
for (i = 0; i <= 7; i++)
{
for (j = 0; j <= 7; j++)
{
operand[i][j] = j;
}
}
}
else
{
_main_1_struct._field_0 = i;
_main_1_struct._field_1 = (int ((*)[8])[8])operand;
p4_doall(_main_1_func, &_main_1_struct);
}
for (t = 0; t <= 99; t++)
{
convolution(out[0], operand[0]);
}
write_block(out[0]);
return 0;
}