编译方法与结果
[luckydog@localhost cell_code]$ spu-gcc hello_spu.c -o hello_spu
[luckydog@localhost cell_code]$ embedspu hello_spu_handle hello_spu hello_spu_csf.o
[luckydog@localhost cell_code]$ gcc hello_ppu.c hello_spu_csf.o -lspe -o hello
[luckydog@localhost cell_code]$ ./hello
0x1001a038: Hello World!
0x1001a3d8: Hello World!
0x1001a778: Hello World!
0x1001a208: Hello World!
0x1001a5a8: Hello World!
0x1001a948: Hello World!
number of spe available: 6
由于spu和ppu使用的指令集不同,需要分别编译。
第一步,编译spu程序。第二步将spu程序嵌入到一个elf文件中,并以hello_spu_handle名字发布,以让链接程序能将spu程序和ppe程序一同链接成可执行文件hello。
输出结果的number of spe available: 6 是目前能使用的spe数目。
