I got a lot further in the process. I still have some outstanding questions I need answered but I figured I will document where I am at right now for someone else having my same problems.
Here is some sample code that I am compiling.
# include <string>
# include <iostream>
# include <sstream>
# include <CL/cl.hpp>
template<typename QueryType, typename ValueType>
void Log(QueryType& a_openclObject, cl_int a_propertyId, const std::string& a_propertyName, ValueType& a_value)
{
a_openclObject.getInfo(a_propertyId, &a_value);
std::stringstream os;
std::string spaces(40 - a_propertyName.size(), ' ');
os << a_propertyName << ":" << spaces << a_value << std::endl;
std::cout << os.str();
}
# define LOG(openclObject, openclProperty, value) Log(openclObject, openclProperty,# openclProperty, value);
int main(void)
{
// Find all the platforms on this computer...
std::vector<cl::Platform> platforms;
cl::Platform::get(&platforms);
for (size_t i=0; i<platforms.size(); ++i)
{
std::string valueString;
int valueInt;
unsigned int valueUint;
long long valueLongLong;
LOG(platforms, CL_PLATFORM_VENDOR, valueString);
// Now find out all the OpenCL devices supported for this platform...
std::vector<cl::Device> devices;
platforms.getDevices(CL_DEVICE_TYPE_ALL,&devices);
for (size_t j=0; j<devices.size(); ++j)
{
// Dump out the specific information for this device...
LOG(devices, CL_DEVICE_VERSION, valueString);
LOG(devices, CL_DRIVER_VERSION, valueString);
LOG(devices, CL_DEVICE_OPENCL_C_VERSION, valueString);
LOG(devices, CL_DEVICE_MAX_COMPUTE_UNITS, valueInt);
LOG(devices, CL_DEVICE_GLOBAL_MEM_SIZE, valueLongLong);
LOG(devices, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, valueLongLong);
LOG(devices, CL_DEVICE_LOCAL_MEM_SIZE, valueLongLong);
LOG(devices, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, valueLongLong);
LOG(devices, CL_DEVICE_MAX_CONSTANT_ARGS, valueLongLong);
LOG(devices, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, valueUint);
LOG(devices, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, valueUint);
LOG(devices, CL_DEVICE_ENDIAN_LITTLE, valueUint);
}
}
return 0;
}
Here is the makefile that I used.
all: main.exe
main.exe: main.o
arm-linux-gnueabihf-g++ -LC:\altera\14.0\hld\board\c5soc\arm32\lib -LC:/altera/14.0/hld/host/arm32/lib -lalteracl -lalterahalmmd -lalterammdpcie -lelf -lrt -lstdc++ -o main.exe main.o
main.o: main.cpp
arm-linux-gnueabihf-g++ -IC:/altera/14.0/hld/host/include -IC:\altera\14.0\quartus\bin64\cygwin\usr\include\w32api -c main.cpp
clean:
rm main.o main.exe
I was able to get passed the compilation error by including this line in the compilation step.
--- Quote Start ---
-I
C:\altera\14.0\quartus\bin64\cygwin\usr\include\w32api --- Quote End ---
Next step was to download the executable to the development board. However, when I ran the executable, I got this error.
--- Quote Start ---
./main.exe: error while loading shared libraries:
libalteracl.so: cannot open shared object file: No such file or directory
--- Quote End ---
Oops! I ran the initialization script again.
--- Quote Start ---
root@socfpga:~# source ./init_opencl.sh
Error: could not insert module /home/root/opencl_arm32_rte/board/c5soc/driver/aclsoc_drv.ko: File exists
--- Quote End ---
It seems to fail BUT now my executable runs! Yeah!
--- Quote Start ---
root@socfpga:~# ./main.exe
CL_PLATFORM_VENDOR: Altera Corporation
CL_DEVICE_VERSION: OpenCL 1.0 Altera SDK for OpenCL, Version 14.0
CL_DRIVER_VERSION: 14.0
CL_DEVICE_OPENCL_C_VERSION: OpenCL C 1.0
CL_DEVICE_MAX_COMPUTE_UNITS: 1
CL_DEVICE_GLOBAL_MEM_SIZE: 1073741824
CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE: 0
CL_DEVICE_LOCAL_MEM_SIZE: 16384
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 268435456
CL_DEVICE_MAX_CONSTANT_ARGS: 8
CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR: 4
CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR: 4
CL_DEVICE_ENDIAN_LITTLE: 1
--- Quote End ---
So my question before is still outstanding. What directory do I include in my compilation step so it pulls in the correct "gl.h" file?
Also, I could not find any of this information in the documentation. I apologize if it is there but I couldn't find it. If it isn't there, you may want to include it for other developers in the future.