Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
8 years ago

findPlatform() Call Changes Directories

I have a Cyclone V Development Kit. I have compiled my host code to a shared library (.so) and I am using this to make opencl calls from python using ctypes.cdll.

Let's say I am running my program from `/home/root` on the board, as soon as I enter the `findPlatform()` call, my program switches directories to `/usr/bin` which is causing quite the headache. I've gone into the function in `opencl.cpp` and the directory is already `/usr/bin` as soon as I am in the function, so it looks like something to do with `findPlatform()` call from my host code.

Any ideas? I have no idea what is going on.

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I'm not sure if this is your issue, but if you're looking at the Altera OpenCL examples in their host code. Within the init_opencl() there is

    if(!setCwdToExeDir()) {

    return false;

    }

    statement which changes your working directory during runtime.

    I'm not entirely sure of its purpose but if you comment that out, it should work fine I'd imagine.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    That does seem to work, not sure how I missed that one! Thank you.

    I don't quite understand the purpose of this either, hopefully there are no repercussions.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Yep, no problem. I've ran into that issue too and so far I haven't had any issues come up after removing it.