Hi Michael,
We were planning on parallelizing the compilation, e.g., gcc -c. I am not
a compiler expert, or for that matter an expert at anything.
Just keep
plugging along with what God gave me. Doing the best I can.
If you're not both a compiler expert and a parallelism expert, I'd say
this is aiming way, way too high. I personally know a guy who did a PhD
in parallelization of parsers (which is just the first step of the
compiler) and this took him 5 years.
The compiler-proper has several stages: first parsing (building an
abstract syntax tree), and then a couple of stages that perform
transformations on the AST, then emitting code. Even the parallelization
of one stage would be a tremendous task.
Unless, of course, you consider flocking out the multiple C files over a
farm of compiling machines, then collecting the results for linking.
However, this would probably be too trivial.
It is for a project in a parallel program class.
I would seriously urge you to reconsider doing this. You'll get nowhere
if you're not willing to spend a couple of years on this.
> Now that I have a better
understanding of HPC, I think I would have chosen a different thing to
parallel. But then on the other hand, it seems very practical if
complication/linking could be sped up on large projects. Not sure about
that assumption because I have never worked on any.
Farming out compilations over many machines is practical, and has been
done, at the file level. Anything else, I'd say, is 'only' of
theoretical interest for the time being.
Would you mind sharing the chess program? The issue in our class is whether
or not we can realize any speedup, not whether or not we have developed the
code ourselves or not.
Sure, look at
http://libchess.sourceforge.net. However it is not nearly
finished and not in a usable state at the moment. If you want I can send
you a small tarball with a version that is complete enough to solve
chess problems. A suggestion: this may be a better thing to parallelize
than a full compiler, at least it's a well-understood and limited problem.
I am not sure about inlining, I'll have to play around with that a bit.
in gcc, you'll have to use -finline-limit=<some number>. This worked
nicely on the chess example since it will also inline recursive function
invocations
Like I said, we are only interested in speedup. How do you generate source
code? A flag?
With a program, which may be programmed in C.
e.g.
#include <stdio.h>
int main(int argc, char *argv[])
{
int howmany=0;
if (argc>1) sscanf(argv[1],"%d", &howmany);
puts("#include <stdio.h>");
puts("int main(void)\n{");
for(;howmany>=0;howmany--)
printf(" puts(\"%d bottles of beer on the wall.\");\n", howmany);
puts(" return 0;\n}");
return 0;
}
With difficulty. It would be rather perverse.
Best regards, Sidney