Forum Discussion

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

Ver. 14.0 aoc -march=emulator Option not working (Windows 7 with Bittware Board)

I have been able to get the -march=emulator option to work in the sense that the compilation process completes without an explicit error and produces the corresponding .aocx file. However, when I attempt to load and create an OpenCL program from the .aocx file (calling a method from the AOCL_Utils.cpp) I get an OpenCL run-time error = -42 which is CL_INVALID_BINARY.

Here is the line that fails in the Vector Addition Example:program = createprogramfrombinary(context, binary_file.c_str(), device, num_devices);

Below is the kernel code:

__attribute ((task))

__kernel void vectorAdd(__global const float * restrict x, __global const float *restrict y, __global float *restrict z)

{

// get index of the work item

int index = get_global_id(0);

// add the vector elements

z[index] = x[index] + y[index];

}

And here is the aoc command I am using along with the output:>aoc -v -march=emulator vectoradd.cl

aoc: environment checks are completed successfully.

you are now compiling the full flow!!

aoc: selected target board s5phq_d5

aoc: running opencl parser....

aoc: opencl parser completed successfully.

aoc: compiling for emulation ....

aoc: emulator compilation completed successfully.

emulator flow is successful.

I'll also add that the board diagnostics are working fine; I'm running Windows Visual Studio 2013 Professional, my environment is setup using

> vcvars64.bat

And I am running the console with Admin rights.

To help troubleshoot further, I have re-installed Windows Visual Studio 2013, the Altera Quartus software, and the updated BSP from Bittware, etc., along with numerous restarts, all of the diagnostics work and I am able to produce a correctly functioning .aocx file when performing a full hardware build.

Any ideas / suggestions?

Thanks!

4 Replies

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

    Bruce,

    What command are you using to run your host program? It should be:

    env CL_CONTEXT_EMULATOR_DEVICE_ALTERA=<board_name> <your_host_program_name>

    Also remember to check aocl linkflags. There should be an additional emulation library. I have gotten this to run on Linux but haven't tried windows. There are some prerequisites for running in Windows listed in the Altera Programming guide as well.

    Hope that helps.

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

    Also, I think you need to specify a board name when you do the emulation compile. Not 100% sure on that but it is what I did.

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

    --- Quote Start ---

    Bruce,

    What command are you using to run your host program? It should be:

    env CL_CONTEXT_EMULATOR_DEVICE_ALTERA=<board_name> <your_host_program_name>

    Also remember to check aocl linkflags. There should be an additional emulation library. I have gotten this to run on Linux but haven't tried windows. There are some prerequisites for running in Windows listed in the Altera Programming guide as well.

    Hope that helps.

    Rudy

    --- Quote End ---

    Hi Rudy, this is great feedback. I missed those instructions in the programming manual, I'll dig deeper now that I have a new direction to try, thanks very much for the feedback on this!

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

    Hi Rudy,

    I am running the emulation of hello_world under windows 64. While I can't find "env". Is that a binary executable file of Altera opencl sdk or a generated file from previous steps?

    In details: I managed successfully to execute the command "aoc -v -march=emulator hello_world.cl", After that, I compiled, without any issue, the hello_world host program.

    But, when I try to run the command "env CL_CONTEXT_EMULATOR_DEVICE_ALTERA=s5_ref hello_world", I get the following error message:

    'env' is not recognized as an internal or external command, operable program or batch file.

    Could you help me to find a solution to this problem?

    Thanks and Regards,

    Michael

    --- Quote Start ---

    Bruce,

    What command are you using to run your host program? It should be:

    env CL_CONTEXT_EMULATOR_DEVICE_ALTERA=<board_name> <your_host_program_name>

    Also remember to check aocl linkflags. There should be an additional emulation library. I have gotten this to run on Linux but haven't tried windows. There are some prerequisites for running in Windows listed in the Altera Programming guide as well.

    Hope that helps.

    Rudy

    --- Quote End ---