Here's an example of a filter that pushes less often but it pops:

void->void pipeline EdgeFind {
    add FloatSource();
    add EveryOther();
    add FloatPrinter();
}

float->float filter EveryOther() {
    float time = 0;
    work push [0,1] pop 1 {
        pop();
        time = time + 1;
        if( (int)(time)/2*2 == (int)(time) ) {
           push(time);
        }
    }
}

void->float filter FloatSource() {
    float t = 0;
    work push 1 {
        push(t);
        t++;
    }
}

float->void filter FloatPrinter() {
  work pop 1 {
    println(pop());
  }
}


It runs fine with --library, but compiling to C results in a seg fault:

[EMAIL PROTECTED]:~/source/mine/StreaMitTests/EdgeFind$ strc --library
EdgeFind.str | head -n 10
2.0
4.0
6.0
8.0
10.0
12.0
14.0
16.0
18.0
20.0
[EMAIL PROTECTED]:~/source/mine/StreaMitTests/EdgeFind$ strc EdgeFind.str; 
./a.out
Starting Kopi2SIR... done.
Entry to Cluster Backend (uniprocessor)
Running Constant Prop and Unroll... done.
Running Constant Field Propagation... done.
Estimating Code size of Filters... done.
Estimating Code size of Filters... done.
1

Compiling static sub-graph 0 (TopLevel0_FloatSource__3_4)...
Running Partitioning... target number of threads: 1

Compiling static sub-graph 1 (TopLevel1_FloatPrinter__10_6)...
Running Partitioning... target number of threads: 1
Done Partitioning...
Generating cluster code...
Done generating cluster code.
g++ -O3 -I/home/barford/source/others/streamit-src-2.1.1/library/cluster
-c -o combined_threads.o combined_threads.cpp
g++ -O3 -o a.out combined_threads.o
-L/home/barford/source/others/streamit-src-2.1.1/library/cluster
-lpthread -lcluster -lstdc++
Segmentation fault (core dumped)
[EMAIL PROTECTED]:~/source/mine/StreaMitTests/EdgeFind$ uname -a
Linux ely 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux
[EMAIL PROTECTED]:~/source/mine/StreaMitTests/EdgeFind$ javac -version
javac 1.5.0_13
[EMAIL PROTECTED]:~/source/mine/StreaMitTests/EdgeFind$ gcc --version
gcc (GCC) 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)

Now I've read the stern warning in the "Language Specification" about
getting the peek & pop rate expression correct. But the above filter
does appear to pop once and push between 0 and 1 times.

Any suggestions?

--Lee Barford

_______________________________________________
StreamIt-users mailing list
[email protected]
https://lists.csail.mit.edu/mailman/listinfo/streamit-users

Reply via email to