Last modified 12 years ago
Last modified on 05/17/11 03:49:35
IBM Compilers
We are currently developing a bocca project specifically for Surveyor that will test the ccaTool chain. This project is also the starting point for developing a swappable component.
Building a Simple Bocca Project
- Create the project and components, then configure, then build it. The first step is to check if anything works on the BG/P backend.
>>bocca create project boccaSurveyor --language=cxx >>cd boccaSurveyor >>bocca create port matMulPort >>bocca create component matMul --provides=matMulPort:matMulPort --language=cxx >>bocca create component matMulDriver --go=run [email protected] --language=cxx
- Here are two configure lines, one for surveyor and one for the dijkstra. As a test I also build this on dijkstra, so include it if anyone wants to try this out locally.
- Surveyor
>>./configure --with-ccafe-config=/gpfs/home/projects/ccatools/install/IBM/ccatools/bin/ccafe-config \ --with-bocca=/gpfs/home/projects/ccatools/install/IBM/ccatools/bin/bocca \ --with-babel=/gpfs/home/projects/ccatools/install/IBM/babel/bin/powerpc64-ibm-bgp-babel \ --with-babel-config=/gpfs/home/projects/ccatools/install/IBM/babel/bin/powerpc64-ibm-bgp-babel-config \ --with-languages="c cxx python"
- Dijkstra
>>./configure --with-ccafe-config=/usr/local/contrib/cca-toolOFF/bin/ccafe-config \ --with-bocca=/usr/local/contrib/bocca/bin/bocca \ --with-babel=/usr/local/contrib/babel-1.5.0_r6802/bin/babel \ --with-babel-config=/usr/local/contrib/babel-1.5.0_r6802/bin/babel-config
- Surveyor
- Kick off an initial build to make sure that the infrastructure is correct.
>>bocca config --update >>make ; make check
- Modify the port to include a method.
>>bocca edit -s matMulPort
- What I added in the SIDL:
12 interface matMulPort extends gov.cca.Port 13 { 14 // DO-NOT-DELETE bocca.splicer.begin(boccaSurveyor.matMulPort.methods) 15 double doSomeCalc(in double x); 16 // DO-NOT-DELETE bocca.splicer.end(boccaSurveyor.matMulPort.methods) 17 }
- What I added in the SIDL:
- Edit the component that provides matMulPort:
>>bocca edit -i matMul
- What I added in the component implentation (Find the splicer blocks that state DO-DELETE-WHEN-IMPLEMENTING):
345 { 346 // DO-NOT-DELETE splicer.begin(boccaSurveyor.matMul.doSomeCalc) 347 // Insert-Code-Here {boccaSurveyor.matMul.doSomeCalc} (doSomeCalc method) 348 return x*x; 349 // DO-NOT-DELETE splicer.end(boccaSurveyor.matMul.doSomeCalc) 350 }
- What I added in the component implentation (Find the splicer blocks that state DO-DELETE-WHEN-IMPLEMENTING):
- Edit matMulDriver that uses matMulPort:
>>bocca edit -i matMulDriver
- What I added in the driver implentation (Find the splicer blocks that state REMOVE ME):
439 try { 440 // All port instances should be rechecked for ._not_nil before calling in 441 // user code. Not all ports need be connected in arbitrary use. 442 // The uses ports appear as local variables here named exactly as on the 443 // bocca commandline. 444 445 // Insert-UserCode-Here {boccaSurveyor.matMulDriver.go} 446 std::cout << "doSomeCalc(5.0) " << matMulPort.doSomeCalc(5.0) << std::endl; 447 }
- What I added in the driver implentation (Find the splicer blocks that state REMOVE ME):
- Build the entire project:
>> make ; make install
- Make check will fail since this code is not meant to run on the front-end nodes. Nevertheless I added the following in my .bashrc
export LD_LIBRARY_PATH=/gpfs/home/projects/ccatools/install/IBM/ccatools/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=/gpfs/home/projects/ccatools/install/IBM/ccatools/lib/ccafe-0.8.8:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=/gpfs/home/projects/ccatools/install/IBM/libtool-2.4/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=/gpfs/home/projects/ccatools/install/IBM/babel/lib:$LD_LIBRARY_PATH
- Create a run script called test.rc and place it in components/tests. This is very similar to the file components/tests/instantiation.gen.rc. I've also created a python driver component (not documented) that I will also use for testing.
\#!ccaffeine bootstrap file. # ------- don't change anything ABOVE this line.------------- path set /gpfs/home/muszala/ecloudBuild/IBM/testCCA/boccaSurveyor/install/share/cca #boccaSurveyor.matMul# repository get-global boccaSurveyor.matMul instantiate boccaSurveyor.matMul boccaSurveyor_matMul #boccaSurveyor.matMulDriver# repository get-global boccaSurveyor.matMulDriver instantiate boccaSurveyor.matMulDriver boccaSurveyor_matMulDriver connect boccaSurveyor_matMulDriver matMulPort boccaSurveyor_matMul matMulPort go matMulDriver run quit
- Create a wrapper shell script that calls cobalt-mpirun (needed when you execute scripts on surveyor):
#!/bin/sh cobalt-mpirun -np 1 -env "LD_LIBRARY_PATH=/gpfs/home/projects/ccatools/install/IBM/ccatools/lib:\ /gpfs/home/projects/ccatools/install/IBM/ccatools/lib/ccafe-0.8.8:\ /gpfs/home/projects/ccatools/install/IBM/babel/lib:\ /gpfs/home/projects/ccatools/install/IBM/libtool-2.4/lib:\ /bgsys/drivers/ppcfloor/gnu-linux/lib:\ /bgsys/drivers/ppcfloor/gnu-linux/bin/python \ PYTHONPATH=/gpfs/home/projects/ccatools/install/IBM/babel/lib/python2.6/site-packages:\ /soft/apps/python/python-2.6-cnk-gcc/numpy-1.3.0/lib/python2.6/site-packages:\ /gpfs/home/projects/ccatools/install/IBM/ccatools/lib/python2.6/site-packages:\ /home/muszala/ecloudBuild/IBM/testCCA/boccaSurveyor:\ /gpfs/home/muszala/ecloudBuild/IBM/testCCA/boccaSurveyor/install/lib/python2.6/site-packages \ SIDL_DEBUG_OPEN=1 \ CCAFE_USE_MPI=1" \ /gpfs/home/projects/ccatools/install/IBM/ccatools/bin/ccafe-batch \ --ccafe-mpi yes --ccafe-rc /home/muszala/ecloudBuild/IBM/testCCA/boccaSurveyor/components/tests/test.rc #~#/gpfs/home/projects/ccatools/install/IBM/ccatools/bin/ccafe-single \ #~#--ccafe-rc /home/muszala/ecloudBuild/IBM/testCCA/boccaSurveyor/components/tests/test.rc #~#--ccafe-mpi yes --ccafe-rc /home/muszala/ecloudBuild/IBM/testCCA/boccaSurveyor/components/tests/test.rc
- Running a simulation (C++ driver calling C++ implementation).
>>qsub --mode script -A cca-tools -t 5 -n 1 -O boccaTest ./run.sh
- Checking the output...look at the file boccaTest.output and you should see:
>>more boccaTest.output doSomeCalc(5.0) 25 process group 112 has completed
- Running a simulation (Python driver calling C++ implementation)...Not test during rebuilds of May 2011.
- First I slightly modified driver.rc :
\#!ccaffeine bootstrap file. # ------- don't change anything ABOVE this line.------------- path set /gpfs/home/muszala/ccaToolBuild/boccaSurveyor/install/share/cca #boccaSurveyor.matMul# repository get-global boccaSurveyor.matMul instantiate boccaSurveyor.matMul boccaSurveyor_matMul #boccaSurveyor.matMulDriver# #~#repository get-global boccaSurveyor.matMulDriver #~#instantiate boccaSurveyor.matMulDriver boccaSurveyor_matMulDriver #boccaSurveyor.matMulDriverPython# repository get-global boccaSurveyor.matMulDriverPython instantiate boccaSurveyor.matMulDriverPython boccaSurveyor_matMulDriverPython connect boccaSurveyor_matMulDriverPython matMulPort boccaSurveyor_matMul matMulPort #~#connect boccaSurveyor_matMulDriver matMulPort boccaSurveyor_matMul matMulPort #~#go matMulDriver run go matMulDriverPython run quit
- Kick off the job itself:
>>qsub --mode script -A cca-tools -t 5 -n 1 -O boccaTest ./run.sh
- With output like this:
>>more boccaTest.output in Python driver matMulPort.doSomeCalc(5.0) 25.0 process group 5185 has completed