Hey /prog, research student here, working on a language to describe a timer for functions. I'm creating an example of what the timer language will look like for a given specification. It's got some pseudo-C, pseudo-scripting ideas, since the timer will be processed into C from this input. This is far from complete, but suggestions and discussion are welcome.
typedecl TYPE (int *);
define VECTOR(n) ((int *) calloc (n * sizeof(int))); //makes a vector of n-elements
ROUTINE = void ATL_UDOT(const int N, const TYPE *X, const int incX, const TYPE *Y, const int incY, TYPE *dotc);
ARGS = {
N = 100..999;
X = VECTOR(N), //init. starts at N=100, updates upon each iteration
for 0..N-1 do X[_]=rand();
flushcache(1024*1024); //flushes 1024*1024 bytes (1MB) from the cache
incX = 10;
Y = VECTOR(N),
for 0..N-1 do Y[_]=rand();
flushcache(1024*1024);
incY = 10;
dotc = VECTOR(2);
};
Name:
Anonymous2008-02-14 20:43
Needs more FORCED INDENATION.
Name:
Anonymous2008-02-14 20:44
INDENTATION, too.
Name:
Anonymous2008-02-14 20:50
are you insane?
Name:
Anonymous2008-02-14 22:46
OP here
>>2>>3
It's indented for readability. You could just as easily write the entire script on one line, but that should only be done in the most simple cases.
>>4
A serious inquiry? I might be. While my classmates are busy jacking off to security and software engineering, I'm the only white guy interested in compilers/code optimization. Anyway, no I'm not insane regarding this little code. I'll post updates on it as I continue work. I have until tuesday to have a fully-fleshed example script, and I need to have started implementing the language using my professor's own custom language.
Name:
Anonymous2008-02-15 0:45
>>5
I've always wondered why compilers are a "black thing".
Name:
Anonymous2008-02-15 4:14
wats a timar lang????/////////
Also, write a functional language instead of this forced indentation crap.
Name:
Anonymous2008-02-15 5:14
>>5-6
I'm confused - what does race have to do with compilers? I never noticed this before.
>>8
My cs dept. is divided between some whites, some hispanics, lots of asians, lots of indians, and like 2-3 black dudes. I checked out the grad-level compiler course here and its like all asian
Name:
Anonymous2008-02-18 17:36
OP back, I've made stuff a bit clearer and added some stuff
typedecl TYPE (int *);
//defines a C-style #define statement
define VECTOR(n) ((int *) calloc (n * sizeof(int))); //makes a vector of n-elements
/* ROUTINE is a global code object, representing the C routine that will
be used in the timing */
ROUTINE = void ATL_UDOT(const int N, const TYPE *X, const int incX, const TYPE *Y, const int incY, TYPE *dotc);
/* ARGS is a function to be passed to the timer to initialize various
arguments for ROUTINE */
ARGS = {
/* A variable can be defined with a range.
The beginning and ending indices are kept track of, as well as the
current position within the range the variable actually represents
(so, if you execute ATL_UDOT(N, ...) forty times, N would contain
140 as its current position. */
N = 100..999;
/* X can be initialized many different ways, but this is specific for
ATL_UDOT, since it is vector dot product, it makes sense to treat X
and Y as vector-like */
X = VECTOR(N); //init. starts at N=100, updates upon each iteration
for 0..N-1 do X[_]=rand(int);
/* flushcache(X) :
defined elsewhere, will flush X bytes from the cache */
flushcache(1024*1024);
incX = 10;
Y = VECTOR(N),
for 0..N-1 do Y[_]=N; //you can put any ints you want into the vector
flushcache(1024*1024);
incY = 10;
//you can hardcode simple data values in as well
dotc = VECTOR(2);
dotc[0]=0;
dotc[1]=0;
};
nrep = 10;
/* execTimer(argument set, repetitions per function call, custom flag string):
executes the timer as described by the ROUTINE global definition and
the ARGS globally defined set. Each call to ROUTINE uses variables
defined in ARGS (which are updated upon each iteration if they have a
range). If nrep is greater than 1, each call is repeated with the
same ARGS and based on if the "w" or "c" flags are set, will take
the average over the iterations or the lowest time among them.
Various flags may be set. In this case, I am using wall-time and
outputting verbose information on the timings. Additional flags
may be defined as needed. */
execTimer(ROUTINE, ARGS, nrep, "wv");
Anyway, looks like my write-up was good enough for a starting point. We'll be implementing the base version in another language, however. Once we get that going, we'll write the parser for it.
Name:
Anonymous2008-02-19 19:05
>>24 Stop dicking up my thread, fags.
Welcome to /prog/.
Name:
Anonymous2008-02-20 6:29
>>24
Explain what a timer language is for, please.
Okay, basically, if you have a function, and you wish to optimize it, you'll need to time the unoptimized function and the optimized function to be able to check if there is a performance increase. such a timer requires user specification, and to generalize that purpose for portability to all platforms, i'm writing a language which will represent the timer. coupled with that, i'm writing a parser in POET which will accept a file written in Timer language and generate the equivalent, pre-optimized C code, thus creating an optimized timer that will give you accurate results.
Name:
Anonymous2009-02-25 6:32
Write about and how So first I asked myself what topic should it be about I realized I had another turn I decided to pass the time writing a filksong This meant I was beautiful So come dance this silence down through the barrio Yeah we stare at the New Amsterdam staring.
Name:
Anonymous2009-03-06 7:45
definition also be good might not If you funroll loops!