Installation of the Xilinx Runtime on a clear Amazon Linux 2 instance (which is RedHat based) leads to OpenCL runtime errors.
Xilinx Runtime (XRT) 2018.2_XDF.RC5 Installation instructions:
https://github.com/aws/aws-fpga/blob/master/hdk/docs/SDxPatch_AR71715_and_XRT_installation_instructions.md#installing-xilinx-runtime-xrt-20182_xdfrc5
Prerequisites:
Extra Packages for Enterprise Linux (EPEL)
sudo amazon-linux-extras install -y epel
curl -s https://s3.amazonaws.com/aws-fpga-developer-ami/1.5.0/Patches/XRT_2018_2_XDF_RC5/xrt_201802.2.1.0_7.5.1804-xrt.rpm -o xrt_201802.2.1.0_7.5.1804-xrt.rpm
curl -s https://s3.amazonaws.com/aws-fpga-developer-ami/1.5.0/Patches/XRT_2018_2_XDF_RC5/xrt_201802.2.1.0_7.5.1804-aws.rpm -o xrt_201802.2.1.0_7.5.1804-aws.rpm
sudo yum install -y xrt_201802.2.1.0_7.5.1804-xrt.rpm
sudo yum install -y xrt_201802.2.1.0_7.5.1804-aws.rpm
Example application:
#include <stdio.h>
#include <CL/opencl.h>
int main(){
cl_uint num_platforms;
cl_int errcode_ret = clGetPlatformIDs(0, NULL, &num_platforms);
if (errcode_ret != CL_SUCCESS){
fprintf(stderr, "Error: clGetPlatformIDs (%d)\n", errcode_ret);
return EXIT_FAILURE;
}
printf("Info: %d opencl platform(s) found!", num_platforms);
return EXIT_SUCCESS;
}
Makefile:
SRCS = test.cpp
OBJCTS = $(SRCS:.cpp=.o)
EXE=test
CC = g++ -Wall
CFLAGS = -I${XILINX_XRT}/include
LFLAGS = -L${XILINX_XRT}/lib -lxilinxopencl
all: ${OBJCTS}
${CC} ${OBJCTS} ${LFLAGS} -o ${EXE}
${RM} ${OBJCTS}
%.o: %.cpp
${CC} ${CFLAGS} -c ${<} -o ${@}
clean:
${RM} ${OBJCTS} ${EXE}
3 sequential runs:
$ ./test
Segmentation fault
$ ./test
Segmentation fault
$ ./test
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted
The problem must be related to boost library dependency!
(Our JVM application stated libboost.so as the problematic frame.)
Note that on a CentOS machine the same XRT installation works smoothly.