PrincetonUniversity / cpf

Collaborative Parallelization Framework (CPF)
MIT License
31 stars 4 forks source link

Add a step-by-step guide on how to use CPF as a tool #34

Open andreybokhanko opened 3 years ago

andreybokhanko commented 3 years ago

A step-by-step guide on how to use CPF as a tool (to auto-parallelize user's own applications), rather than a research artifact, would be useful.

It's OK if CPF is not really ready for production use; a sequence of steps like:

clang -c -emit-llvm test.c
opt -some_options test.bc
...

would be enough for evaluation.

Right now one needs to go through all the makefiles, which is frustrating.

(unless I'm missing something...)

Yours, Andrey \=== Advanced Software Technology Lab Huawei

vgene commented 3 years ago

Step 1: Build the master CPF with the Dockerfile Step 2: Create a benchmark under /tests/regression/{bmark}, put the source code under {bmark}/src and create an execInfo file under {bmark}, the structure follows https://github.com/PrincetonUniversity/cpf/blob/master/tests/regression/dijkstra-dynsize/execInfo Step 3: Source the environment variables by source ~/cpf-workspace/cpf-env-debug.rc (debug LLVM and debug CPF) or source ~/cpf-workspace/cpf-env-release.rc (release LLVM and release CPF) Step 4: Run make benchmark.compare.out under {bmark}/src, which will run all the necessary profilings and create a benchmark.collaborative.exe (parallelized binary), then run both the sequential binary (benchmark.plain.o3.exe) and the parallel with the provided TESTARGS

There are currently several limitations (profilers and the code generation part). For example, the profiler does not handle some C++ corner cases correctly and might crash while running. I'll recommend using some simple C program to test first. We are actively developing to handle C++ programs right now. If you have a benchmark that is open-source or can be shared directly, we are more than happy to take a closer look!

andreybokhanko commented 3 years ago

Hi @vgene

Thanks for the instructions, but that's not exactly what I meant. Your guide relies on a pre-created makefile, that hides individual commands.

What I'm asking for (and do believe would be very useful for people like me) is a list of individual commands to compile, profile, optimize and run a single application -- outside of the context of your testing framework.

Andrey

vgene commented 3 years ago

@andreybokhanko Thank you for the feedback. We will work on a detailed explanation of each step and put it in the Wiki (https://github.com/PrincetonUniversity/cpf/wiki) by the end of this week.

andreybokhanko commented 3 years ago

@vgene Thanks for the quick response! (here and elsewhere)

It's great to see a [relatively] young project with such high level of response and support already.