FILE* issue PPU side code
Posted
by Cristina
on Stack Overflow
See other posts from Stack Overflow
or by Cristina
Published on 2010-04-30T08:48:48Z
Indexed on
2010/04/30
9:37 UTC
Read the original article
Hit count: 321
We are working on a homework on CELL programming for college and their feedback response to our questions is kinda slow, thought i can get some faster answers here.
I have a PPU side code which tries to open a file passed down through char* argv[]
, however this doesn't work it cannot make the assignment of the pointer, i get a NULL.
Now my first idea was that the file isn't in the correct directory and i copied in every possible and logical place, my second idea is that maybe the PPU wants this pointer in its LS area, but i can't deduce if that's the bug or not. So...
My question is what am i doing wrong?
I am working with a Fedora 7 SDK Cell, with Eclipse as an IDE. Maybe my argument setup is wrong tho he gets the name of the file correctly.
Code on request:
images_t *read_bin_data(char *name)
{
FILE *file;
images_t *img;
uint32_t *buffer;
uint8_t buf;
unsigned long fileLen;
unsigned long i;
//Open file
file = (FILE*)malloc(sizeof(FILE));
file = fopen(name, "rb");
printf("[Debug]Opening file %s\n",name);
if (!file)
{
fprintf(stderr, "Unable to open file %s", name);
return NULL;
}
//.......
}
Main launch:
int main(int argc,char* argv[]) {
int i,img_width;
int modif_this[4] __attribute__ ((aligned(16))) = {1,2,3,4};
images_t *faces, *nonfaces;
spe_context_ptr_t ctxs[SPU_THREADS];
pthread_t threads[SPU_THREADS];
thread_arg_t arg[SPU_THREADS];
//intializare img_width
img_width = atoi(argv[1]);
printf("[Debug]Img size is %i\n",img_width);
faces = read_bin_data(argv[3]);
//.......
}
Thanks for the help.
© Stack Overflow or respective owner