diff options
author | kwm <kwm@FreeBSD.org> | 2016-11-21 22:36:51 +0800 |
---|---|---|
committer | kwm <kwm@FreeBSD.org> | 2016-11-21 22:36:51 +0800 |
commit | 8a4be2f73e729350625da27cd5d42556b7229b19 (patch) | |
tree | b423060dc1ce6c1dfe76e3c71f6a5e82c3aab007 /lang | |
parent | f9a4124ef69d3301bd2d270a88c96271bd76d96b (diff) | |
download | freebsd-ports-gnome-8a4be2f73e729350625da27cd5d42556b7229b19.tar.gz freebsd-ports-gnome-8a4be2f73e729350625da27cd5d42556b7229b19.tar.zst freebsd-ports-gnome-8a4be2f73e729350625da27cd5d42556b7229b19.zip |
Add pocl.
Portable OpenCL aims to be an efficient open source (MIT-licensed)
implementation of the OpenCL 1.2 standard. pocl uses Clang as an
OpenCL C frontend and LLVM for the kernel compiler implementation,
and as a portability layer. Thus, if your desired target has an LLVM
backend, it should be able to get OpenCL support easily by using pocl.
PR: 171914
Submitted by: O.Hartmann <ohartmann@walstatt.org> (based on)
Diffstat (limited to 'lang')
-rw-r--r-- | lang/Makefile | 1 | ||||
-rw-r--r-- | lang/pocl/Makefile | 67 | ||||
-rw-r--r-- | lang/pocl/distinfo | 3 | ||||
-rw-r--r-- | lang/pocl/files/patch-Makefile.in | 25 | ||||
-rw-r--r-- | lang/pocl/files/patch-lib_CL_devices_cpuinfo.c | 90 | ||||
-rw-r--r-- | lang/pocl/files/patch-scripts_Makefile.in | 21 | ||||
-rw-r--r-- | lang/pocl/pkg-descr | 22 | ||||
-rw-r--r-- | lang/pocl/pkg-message | 12 | ||||
-rw-r--r-- | lang/pocl/pkg-plist | 27 |
9 files changed, 268 insertions, 0 deletions
diff --git a/lang/Makefile b/lang/Makefile index dae04807dead..7b5cecea5bc9 100644 --- a/lang/Makefile +++ b/lang/Makefile @@ -256,6 +256,7 @@ SUBDIR += php_doc SUBDIR += picoc SUBDIR += pike78 + SUBDIR += pocl SUBDIR += polyml SUBDIR += ptoc SUBDIR += pure diff --git a/lang/pocl/Makefile b/lang/pocl/Makefile new file mode 100644 index 000000000000..d405867b65ed --- /dev/null +++ b/lang/pocl/Makefile @@ -0,0 +1,67 @@ +# $FreeBSD$ + +PORTNAME= pocl +PORTVERSION= 0.13 +CATEGORIES= lang +MASTER_SITES= SF/pocl \ + http://portablecl.org/downloads/ + +MAINTAINER= ohartman@zedat.fu-berlin.de +COMMENT= POrtable Computing Language (POCL) + +LICENSE= GPLv3 +LICENSE_FILE= ${WRKSRC}/LICENSE + +BUILD_DEPENDS= llvm${LLVM_VERSION}>=0:devel/llvm${LLVM_VERSION} \ + opencl>=2.1:devel/opencl +LIB_DEPENDS= libhwloc.so:devel/hwloc \ + libOpenCL.so:devel/ocl-icd \ + libltdl.so:devel/libltdl +RUN_DEPENDS= llvm${LLVM_VERSION}>=0:devel/llvm${LLVM_VERSION} + +CONFLICTS= freeocl[0-9]* + +BROKEN_FreeBSD_9= pocl is not supported on 9.x +BROKEN_FreeBSD_10= pocl is not supported on 10.x +ONLY_FOR_ARCHS= amd64 +ONLY_FOR_ARCHS_REASON_amd64= only tested on amd64 + +LLVM_VERSION= 37 + +GNU_CONFIGURE= yes +USE_LDCONFIG= yes +USE_GL= yes +#USES= autoreconf gmake localbase pathfix pkgconfig libtool +USES= gmake localbase ncurses pathfix pkgconfig libtool:keepla + +INSTALL_TARGET= install-strip + +MAKE_ARGS+= PKGCONFIGDIR=${PREFIX}/libdata/pkgconfig + +CONFIGURE_ENV= LLVM_CONFIG="${LOCALBASE}/llvm${LLVM_VERSION}/bin/llvm-config" \ + CLANGXX_FLAGS=-std=gnu++11 +#CONFIGURE_ARGS+= --enable-pedantic +# needed for the libltdl configure check +LDFLAGS+= -L${LOCALBASE}/lib + +ALL_TARGET= all + +OCL_ICD_VENDORS?= ${PREFIX}/etc/OpenCL/vendors + +OPTIONS_DEFINE= DEBUG + +OPTIONS_GROUP= TEST +OPTIONS_GROUP_TEST= OCLBOOK + +OCLBOOK_DESC= Tests from the OpenCL book +DEBUG_DESC= Debug build of pocl + +OCLBOOK_CONFIGURE_ENABLE= enable_testsuites="opencl-book-samples,cloverleaf,opencl_book_samples,halide,vexcl" +OCLBOOK_ALL_TARGET= check + +DEBUG_CONFIGURE_ENABLE= debug + +do-test: + cd ${WRKSRC} && ${GMAKE} check + +.include <bsd.port.mk> diff --git a/lang/pocl/distinfo b/lang/pocl/distinfo new file mode 100644 index 000000000000..7f1bf982386c --- /dev/null +++ b/lang/pocl/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1479738879 +SHA256 (pocl-0.13.tar.gz) = a17f37d8f26819c0c8efc6de2b57f67a0c8a81514fc9cd5005434e49d67499f9 +SIZE (pocl-0.13.tar.gz) = 1901208 diff --git a/lang/pocl/files/patch-Makefile.in b/lang/pocl/files/patch-Makefile.in new file mode 100644 index 000000000000..49fa57e1e446 --- /dev/null +++ b/lang/pocl/files/patch-Makefile.in @@ -0,0 +1,25 @@ +First part: this is false, this was due to a libtool bug, which is fixed now +Second part: cmp --quiet is long for the -s option, use that since FreeBSD +cmp doesn't have the long option. + +--- Makefile.in.orig 2016-09-13 22:57:13.327123000 +0200 ++++ Makefile.in 2016-09-13 23:01:18.738696000 +0200 +@@ -116,8 +116,7 @@ + @POCL_ANDROID_FALSE@am__append_1 = scripts examples tests + + #TODO: this naming scheme is used on other platforms (primarly BSDs?) too +-@BUILD_ICD_TRUE@@FREEBSD_HOST_OS_TRUE@am__append_2 = -e 's,so.VER,so.$(LIB_CURRENT_VERSION),g' +-@BUILD_ICD_TRUE@@FREEBSD_HOST_OS_FALSE@am__append_3 = -e 's,so.VER,so.$(LIB_FIRST_VERSION).$(LIB_AGE_VERSION).$(LIB_REVISION_VERSION),g' ++@BUILD_ICD_TRUE@am__append_3 = -e 's,so.VER,so.$(LIB_FIRST_VERSION).$(LIB_AGE_VERSION).$(LIB_REVISION_VERSION),g' + @BUILD_ICD_TRUE@am__append_4 = pocl.icd + @BUILD_ICD_TRUE@am__append_5 = pocl.icd + subdir = . +@@ -1076,7 +1075,7 @@ + echo "#define PKGDATADIR \"${pkgdatadir}\"" > $@.new + echo "#define PKGLIBEXECDIR \"${pkglibexecdir}\"" >> $@.new + echo "#define PKGINCLUDEDIR \"${pkgincludedir}\"" >> $@.new +- @if cmp --quiet $@.new $@ ; then \ ++ @if cmp -s $@.new $@ ; then \ + : "Paths not changed" ;\ + $(RM) $@.new ;\ + else \ diff --git a/lang/pocl/files/patch-lib_CL_devices_cpuinfo.c b/lang/pocl/files/patch-lib_CL_devices_cpuinfo.c new file mode 100644 index 000000000000..1b7ce29b8034 --- /dev/null +++ b/lang/pocl/files/patch-lib_CL_devices_cpuinfo.c @@ -0,0 +1,90 @@ +--- lib/CL/devices/cpuinfo.c.orig 2016-11-20 11:31:19.521203000 +0100 ++++ lib/CL/devices/cpuinfo.c 2016-11-20 11:29:24.502817000 +0100 +@@ -31,9 +31,13 @@ + # include "vccompat.hpp" + #endif + ++#include <sys/types.h> ++#include <sys/sysctl.h> ++ + #include "config.h" + #include "cpuinfo.h" + ++#if 0 + const char* cpuinfo = "/proc/cpuinfo"; + #define MAX_CPUINFO_SIZE 64*1024 + //#define DEBUG_POCL_CPUINFO +@@ -152,8 +156,29 @@ pocl_cpuinfo_detect_max_clock_frequency( + } + return -1; + } ++#endif ++ ++/** ++ * Detects the number of parallel hardware threads supported by ++ * the CPU. ++ * ++ * @return The number of hardware threads. ++ */ ++ int ++pocl_cpuinfo_detect_compute_unit_count() ++{ ++ int mib[2], nocpus; ++ size_t len; + ++ mib[0] = CTL_HW; ++ mib[1] = HW_NCPU; ++ len = sizeof(nocpus); ++ sysctl(mib, 2, &nocpus, &len, NULL, 0); + ++ return nocpus; ++} ++ ++#if 0 + /** + * Detects the number of parallel hardware threads supported by + * the CPU by parsing the cpuinfo. +@@ -231,6 +256,27 @@ pocl_cpuinfo_detect_compute_unit_count() + } + return -1; + } ++#endif ++ ++/** ++ * Detects the maximum clock frequency of the CPU. ++ * ++ * Assumes all cores have the same max clock freq. ++ * ++ * @return The clock frequency in MHz. ++ */ ++int ++pocl_cpuinfo_detect_max_clock_frequency() ++{ ++ //XXX PLEASE NOTE, THIS IS NOT TOO PORTABLE (AND/OR ACCURATE)! ++ const char mib[] = "hw.clockrate"; ++ size_t size = sizeof(int); ++ int clockrate; ++ ++ sysctlbyname(mib, (void *)&clockrate, &size, NULL, 0); ++ ++ return clockrate; ++ } + + #ifdef POCL_ANDROID + +@@ -269,6 +315,7 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_ + * short_name is in the .data anyways.*/ + device->long_name = device->short_name; + ++#if 0 + /* default vendor and vendor_id, in case it cannot be found by other means */ + device->vendor = cpuvendor_default; + if (device->vendor_id == 0) +@@ -317,6 +364,7 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_ + char *new_name = (char*)malloc (len); + snprintf (new_name, len, "%s-%s", device->short_name, start); + device->long_name = new_name; ++#endif + + } + diff --git a/lang/pocl/files/patch-scripts_Makefile.in b/lang/pocl/files/patch-scripts_Makefile.in new file mode 100644 index 000000000000..49cc3878bd53 --- /dev/null +++ b/lang/pocl/files/patch-scripts_Makefile.in @@ -0,0 +1,21 @@ +dirty hack, pocl-standalone will be installed into stage with +r-xr-xr-x permissions. So writing to it is problemetic. give the file write +permission and take it away after. + +Upstream (pre 0.14) will be using cmake so this hack is only temporary. + +--- scripts/Makefile.in.orig 2016-09-13 22:10:48.091956000 +0200 ++++ scripts/Makefile.in 2016-09-13 22:13:33.388168000 +0200 +@@ -651,10 +651,11 @@ + + install-exec-hook: $(bin_SCRIPTS) + for f in $(bin_SCRIPTS) ; do \ ++ chmod +w "$(DESTDIR)$(bindir)/$$f" ; \ + sed -e '/^# BEGIN REMOVE ONCE INSTALLED$$/,/^# END REMOVE ONCE INSTALLED$$/d' \ + > "$(DESTDIR)$(bindir)/$$f" \ + < "$$f" && \ +- chmod +x "$(DESTDIR)$(bindir)/$$f" ; \ ++ chmod +x-w "$(DESTDIR)$(bindir)/$$f" ; \ + done + + # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/lang/pocl/pkg-descr b/lang/pocl/pkg-descr new file mode 100644 index 000000000000..eb101155d3b3 --- /dev/null +++ b/lang/pocl/pkg-descr @@ -0,0 +1,22 @@ +Portable OpenCL (pocl) +---------------------- + +Portable OpenCL aims to be an efficient open source (MIT-licensed) +implementation of the OpenCL 1.2 standard. + +In addition to producing an easily portable open source OpenCL +implementation, another major goal of the project is improving +performance portability of OpenCL programs with compiler +optimizations, reducing the need for target-dependent manual +optimizations. At the core of pocl is a set of LLVM passes +used to statically parallelize multiple work-items with the kernel +compiler, even in the presence of work-group barriers. This enables +parallelization of the fine-grained static concurrency in the work +groups in multiple ways (SIMD, VLIW, superscalar,...). + +The code base is modularized to allow easy adding of new "device drivers" +in the host-device layer. A generic multithreaded "target driver" is +included. It allows running OpenCL applications on a host that supports +the pthread library with multithreading at the work group granularity. + +WWW: http://portablecl.org/ diff --git a/lang/pocl/pkg-message b/lang/pocl/pkg-message new file mode 100644 index 000000000000..3dfd31c876d7 --- /dev/null +++ b/lang/pocl/pkg-message @@ -0,0 +1,12 @@ + +Deadlocks (freezes) on FreeBSD: + +OpenCL applications using pocl on FreeBSD must be compiled with +options CFLAGS+=-pthread or CXXFLAGS+=-pthread, otherwise someone risk +that a library may not initialize the threading on BSD independently, +even if an ICD loader is used. + +See: + http://www.freebsd.org/cgi/query-pr.cgi?pr=163512 + +(Source: http://portablecl.org/docs/html/faq.html?highlight=freebsd) diff --git a/lang/pocl/pkg-plist b/lang/pocl/pkg-plist new file mode 100644 index 000000000000..5d52cde5f1aa --- /dev/null +++ b/lang/pocl/pkg-plist @@ -0,0 +1,27 @@ +bin/pocl-standalone +etc/OpenCL/vendors/pocl.icd +include/poclu.h +lib/libpocl.a +lib/libpocl.la +lib/libpocl.so +lib/libpocl.so.1 +lib/libpocl.so.1.6.0 +lib/libpoclu.a +lib/libpoclu.la +lib/libpoclu.so +lib/libpoclu.so.1 +lib/libpoclu.so.1.6.0 +lib/pocl/llvmopencl.a +lib/pocl/llvmopencl.la +lib/pocl/llvmopencl.so +lib/pocl/llvmopencl.so.7 +lib/pocl/llvmopencl.so.7.0.0 +libdata/pkgconfig/pocl.pc +%%DATADIR%%/include/_kernel.h +%%DATADIR%%/include/_kernel_c.h +%%DATADIR%%/include/_kernel_constants.h +%%DATADIR%%/include/pocl.h +%%DATADIR%%/include/pocl_device.h +%%DATADIR%%/include/pocl_tests.h +%%DATADIR%%/include/pocl_types.h +%%DATADIR%%/kernel-amd64-portbld-freebsd%%OSREL%%.bc |