ports/181243: New port: devel/opencl-icd Khronos OpenCL Installable Client Driver

O. Hartmann ohartman at zedat.fu-berlin.de
Mon Aug 12 20:40:01 UTC 2013


>Number:         181243
>Category:       ports
>Synopsis:       New port: devel/opencl-icd Khronos OpenCL Installable Client Driver
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 12 20:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     O. Hartmann
>Release:        
>Organization:
FU Berlin
>Environment:
>Description:
This port provides the Khronos OpenCL Installable Client Driver, which acts as a proxy for different OpenCL platforms.

This software has been extracted from the POCL project and can be choosen as the ICD for devel/pocl.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	./opencl-icd
#	./opencl-icd/files
#	./opencl-icd/files/patch-test-loader_test-icd_test_match.c
#	./opencl-icd/files/patch-CMakeLists.txt
#	./opencl-icd/files/patch-icd_linux.c
#	./opencl-icd/pkg-plist
#	./opencl-icd/Makefile
#	./opencl-icd/distinfo
#	./opencl-icd/pkg-descr
#	./opencl-icd/pkg-message
#
echo c - ./opencl-icd
mkdir -p ./opencl-icd > /dev/null 2>&1
echo c - ./opencl-icd/files
mkdir -p ./opencl-icd/files > /dev/null 2>&1
echo x - ./opencl-icd/files/patch-test-loader_test-icd_test_match.c
sed 's/^X//' >./opencl-icd/files/patch-test-loader_test-icd_test_match.c << '352a0fcd228fea1bcd4e5b0d7d7658d3'
X--- test/loader_test/icd_test_match.c.orig	2013-05-26 11:03:02.000000000 +0200
X+++ test/loader_test/icd_test_match.c	2013-05-26 11:03:44.000000000 +0200
X@@ -1,6 +1,10 @@
X #include <stdio.h>
X #include <string.h>
X+#ifdef	__FreeBSD__
X+#include <stdlib.h>
X+#else
X #include <malloc.h>
X+#endif
X #include <platform/icd_test_log.h>
X 
X int test_icd_match()
352a0fcd228fea1bcd4e5b0d7d7658d3
echo x - ./opencl-icd/files/patch-CMakeLists.txt
sed 's/^X//' >./opencl-icd/files/patch-CMakeLists.txt << 'f7e660cc75d5fc09c5036c8c1c577569'
X--- CMakeLists.txt.orig	2012-08-27 16:44:45.000000000 +0200
X+++ CMakeLists.txt	2013-05-26 11:01:21.000000000 +0200
X@@ -9,6 +9,8 @@
X 
X if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
X     list (APPEND OPENCL_ICD_LOADER_SOURCES icd_linux.c icd_exports.map)
X+elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
X+	list (APPEND OPENCL_ICD_LOADER_SOURCES icd_linux.c icd_exports.map)
X else ()
X     list (APPEND OPENCL_ICD_LOADER_SOURCES icd_windows.c OpenCL.def)
X     include_directories ($ENV{DXSDK_DIR}/Include)
X@@ -23,6 +25,8 @@
X 
X if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
X     set_target_properties (OpenCL PROPERTIES LINK_FLAGS "-Wl,--version-script -Wl,../icd_exports.map")
X+elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
X+	set_target_properties (OpenCL PROPERTIES LINK_FLAGS "-Wl,--version-script -Wl,./icd_exports.map")
X endif ()
X 
X target_link_libraries (OpenCL ${CMAKE_DL_LIBS})
f7e660cc75d5fc09c5036c8c1c577569
echo x - ./opencl-icd/files/patch-icd_linux.c
sed 's/^X//' >./opencl-icd/files/patch-icd_linux.c << 'dcdf3f2fc208cba8674164215ba45f59'
X--- icd_linux.c.orig	2012-08-06 08:53:39.000000000 +0200
X+++ icd_linux.c	2013-05-28 23:15:43.116526383 +0200
X@@ -52,12 +52,22 @@
X  *
X  */
X 
X+#ifdef	__FreeBSD__
X+#define	ETC_ICD_VENDORS		"%%PREFIX%%/etc/OpenCL/vendors"
X+#else
X+#define	ETC_ICD_VENDORS		"/etc/OpenCL/vendors"
X+#endif
X+
X // go through the list of vendors in the two configuration files
X void khrIcdOsVendorsEnumerate(void)
X {
X     DIR *dir = NULL;
X     struct dirent *dirEntry = NULL;
X-    char *vendorPath = "/etc/OpenCL/vendors/";
X+    char *vendorPath = getenv("OCL_ICD_VENDORS");
X+    if (vendorPath == NULL || strncmp(vendorPath, "", 1) == 0)
X+    {
X+        vendorPath = ETC_ICD_VENDORS;
X+    }
X 
X     // open the directory
X     dir = opendir(vendorPath);
X@@ -85,21 +95,21 @@
X                 // make sure the file name ends in .icd
X                 if (strlen(extension) > strlen(dirEntry->d_name) )
X                 {
X-                    break;
X+                    continue;
X                 }
X                 if (strcmp(dirEntry->d_name + strlen(dirEntry->d_name) - strlen(extension), extension) ) 
X                 {
X-                    break;
X+                    continue;
X                 }
X 
X                 // allocate space for the full path of the vendor library name
X-                fileName = malloc(strlen(dirEntry->d_name) + strlen(vendorPath) + 1);
X+                fileName = malloc(strlen(dirEntry->d_name) + strlen(vendorPath) + 2);
X                 if (!fileName) 
X                 {
X                     KHR_ICD_TRACE("Failed allocate space for ICD file path\n");
X                     break;
X                 }
X-                sprintf(fileName, "%s%s", vendorPath, dirEntry->d_name);
X+                sprintf(fileName, "%s/%s", vendorPath, dirEntry->d_name);
X 
X                 // open the file and read its contents
X                 fin = fopen(fileName, "r");
dcdf3f2fc208cba8674164215ba45f59
echo x - ./opencl-icd/pkg-plist
sed 's/^X//' >./opencl-icd/pkg-plist << 'f03fb7fc7ab667c57943586b50f969e4'
Xlib/libIcdLog.so
Xlib/libOpenCL.so
Xlib/libOpenCL.so.1
Xlib/libOpenCLDriverStub.so
f03fb7fc7ab667c57943586b50f969e4
echo x - ./opencl-icd/Makefile
sed 's/^X//' >./opencl-icd/Makefile << '5286b374cbf28348a9e2de6403dfd3f6'
XPORTNAME=		opencl-icd
XPORTVERSION=		1.2.11.0
XCATEGORIES=             devel
X
XSUFFIX=			so
X
XMAINTAINER=             ohartman at zedat.fu-berlin.de
XCOMMENT=		Khronos OpenCL Installable Client Driver
X
XMASTER_SITES=		http://www.khronos.org/registry/cl/specs/
XEXTRACT_SUFX=  		.tgz
X
XWRKSRC=      		${WRKDIR}/icd
X
XCONFLICTS=		freeocl* ocl-icd*
X
XCFLAGS+=		-I${LOCALBASE}/include
XLDFLAGS+=		-L${LOCALBASE}/lib
X
XBUILD_DEPENDS+=		${LOCALBASE}/include/CL/cl.h:${PORTSDIR}/devel/opencl
X
XUSES=			cmake
XUSE_LDCONFIG=		yes
XCMAKE_BUILD_TYPE=	Release
X
XLIBFILES=		libIcdLog.so libOpenCLDriverStub.so libOpenCL.so.1 libOpenCL.so
X
Xpost-configure:
X	${REINPLACE_CMD} -e 's:%%PREFIX%%:${PREFIX}:g' ${WRKSRC}/icd_linux.c
X
Xdo-install:
X.for f in ${LIBFILES}
X	${INSTALL_LIB} ${WRKSRC}/bin/$f ${PREFIX}/lib/$f
X.endfor
X
X.include <bsd.port.mk>
5286b374cbf28348a9e2de6403dfd3f6
echo x - ./opencl-icd/distinfo
sed 's/^X//' >./opencl-icd/distinfo << '1cf4e8e5b066e7c454bccc55aa53d2cd'
XSHA256 (opencl-icd-1.2.11.0.tgz) = bb82a4bfec8d2fe3839c1f079554990af2229bbd52f31acec31d0c4e11e99048
XSIZE (opencl-icd-1.2.11.0.tgz) = 51373
1cf4e8e5b066e7c454bccc55aa53d2cd
echo x - ./opencl-icd/pkg-descr
sed 's/^X//' >./opencl-icd/pkg-descr << '11118c6d8165a7e309dd26718d5712d9'
XOpenCL 1.2 Installable Client Driver (ICD) Loader. 
X
XThe related cl_khr_icd extension allows multiple 
Ximplementations of OpenCL to co-exist on the same 
Xsystem. The ICD Loader allows applications to 
Xchoose a platform from the list of installed 
Xplatforms and dispatches OpenCL API calls to the 
Xunderlying implementation. Consult LICENSE.txt in 
Xthe tarball for full terms and conditions. 
X
XSee
X
Xhttp://www.khronos.org/registry/cl/
11118c6d8165a7e309dd26718d5712d9
echo x - ./opencl-icd/pkg-message
sed 's/^X//' >./opencl-icd/pkg-message << '78308e6168a395897395246408c0cdad'
XYou have to set the global variable
X
XOCL_ICD_VENDORS
X
Xto point to the directory where the multiple 
Xplatform ICD config files are stored, for FreeBSD
Xby default
X
Xcsh/tcsh:
X
Xsetenv OCL_ICD_VENDORS /usr/local/etc/OpenCL/vendors
X
Xsh/ksh/bash:
X
Xexport OCL_ICD_VENDORS=/usr/local/etc/OpenCL/vendors
78308e6168a395897395246408c0cdad
exit



>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-ports-bugs mailing list