From owner-freebsd-performance@FreeBSD.ORG Wed Sep 5 14:45:56 2012 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9E9B3106566B; Wed, 5 Sep 2012 14:45:56 +0000 (UTC) (envelope-from ohartman@mail.zedat.fu-berlin.de) Received: from outpost1.zedat.fu-berlin.de (outpost1.zedat.fu-berlin.de [130.133.4.66]) by mx1.freebsd.org (Postfix) with ESMTP id 3F6538FC0A; Wed, 5 Sep 2012 14:45:56 +0000 (UTC) Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost1.zedat.fu-berlin.de (Exim 4.69) with esmtp (envelope-from ) id <1T9Grb-0000zr-9w>; Wed, 05 Sep 2012 16:45:55 +0200 Received: from telesto.geoinf.fu-berlin.de ([130.133.86.198]) by inpost2.zedat.fu-berlin.de (Exim 4.69) with esmtpsa (envelope-from ) id <1T9Grb-0007g1-56>; Wed, 05 Sep 2012 16:45:55 +0200 Message-ID: <5047659D.8000107@mail.zedat.fu-berlin.de> Date: Wed, 05 Sep 2012 16:45:49 +0200 From: "O. Hartmann" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120810 Thunderbird/14.0 MIME-Version: 1.0 To: Ports FreeBSD , "freebsd-performance@freebsd.org" X-Enigmail-Version: 1.4.3 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigDA220183AD5D429D7C88391E" X-Originating-IP: 130.133.86.198 X-Mailman-Approved-At: Wed, 05 Sep 2012 15:34:08 +0000 Cc: Subject: Help. Porting "FreeOCL" fails (atomic_ops.h missing, CLANG++ libc++ issues ...) X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2012 14:45:56 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDA220183AD5D429D7C88391E Content-Type: multipart/mixed; boundary="------------020905080102060901040901" This is a multi-part message in MIME format. --------------020905080102060901040901 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello. FreeBSD has fallen back far behind the standards of modern scientific computing and I dsperately look for solutions having OpenCL support on FreeBSD anyway. I stumbled into this project recently: FreeOCL at http://code.google.com/p/freeocl/ or the sources located at http://code.google.com/p/freeocl/downloads/detail?name=3DFreeOCL-0.3.6-sr= c.tar.gz&can=3D2&q=3D For your convenience, please find my naive attempt of a port attached to this email. Well, I tried LLVM/CLANG, but Cmake of the sources fairly fails many checks especuially for OpenMP. Using clang++ requisites the usage of the new libc++ (CXXFLAGS+=3D -stdlib=3Dlibc++). But this fails with this erro= r: [...] [ 17%] Building CXX object src/CMakeFiles/FreeOCL.dir/codebuilder.cpp.o In file included from /usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/codebuilder.cpp:26= : /usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/parser/parser.h:11= 8:15: error: no viable conversion from 'std::__1::basic_istream' to 'const bool' const bool ok =3D in.get(c); ^ ~~~~~~~~~ /usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/codebuilder.cpp:44= 4:13: warning: 70 enumeration values not handled in switch: 'VOID', 'BOOL', 'HALF'... [-Wswitch] switch(native->get_type_id()) ^ 1 warning and 1 error generated. *** [src/CMakeFiles/FreeOCL.dir/codebuilder.cpp.o] Error code 1 [..] I tried also setting USE_GCC=3D 4.7+ using gcc-4.7 I installed, but that fails with [...] -- Build files have been written to: /usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source =3D=3D=3D> Building for freeocl-0.3.6 Scanning dependencies of target FreeOCL [ 1%] Building CXX object src/CMakeFiles/FreeOCL.dir/freeocl.cpp.o In file included from /usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/freeocl.cpp:18:0: /usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/freeocl.h:71:2: error: 'u_int64_t' does not name a type *** [src/CMakeFiles/FreeOCL.dir/freeocl.cpp.o] Error code 1 [...] I think patches are required. More disturbing is the use of gcc-4.6 via USE_GCC=3D 4.6+ The error is then a compalin about a missing include file atomic_ops.h which is located in the abandoned KSE facility of the kernel, so the includes seem not to be installed anymore - but since I'm not involved in the development, I can only guess and ask the people here. Maybe some experienced freeBSD developers with the same need for OpenCl is willing to pick up this and help a bit. Well, as far as I see, the FreeOCL project of Roland Borchard is a OpenCL library for CPU usage. As far as I can understand, if we on FreeBSd could have a library "libOpenCL" as this is usually installed by the nVidia BLOB drivers on Linux for the use of OpenCL/GPGPU support with their GPUs, this would fill a still painfull open gap in FreeBSD as a scientific development platform. There is still no suitable compiler for OpenCL out here for freeBSD, but I have still the hope that LLVM can provide such a thing in the near futu= re. I cross post this posting also to "performance" in the hope finding some people attracted and "lurd" into this subject. Regards, O. Hartmann --------------020905080102060901040901 Content-Type: text/plain; charset=us-ascii; name="Makefile" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Makefile" PORTNAME=3D freeocl PORTVERSION=3D 0.3.6 CATEGORIES=3D devel MAINTAINER=3D ports@FreeBSD.org COMMENT=3D FreeOCL - a free OpenCL implementation for CPU #MASTER_SITES=3D http://freeocl.googlecode.com/files/FreeOCL-0.3= =2E6-src.tar.gz MASTER_SITES=3D http://freeocl.googlecode.com/files/ DISTNAME=3D FreeOCL-${PORTVERSION}-src WRKSRC=3D ${WRKDIR}/FreeOCL-${PORTVERSION}-Source USE_CMAKE=3D YES CMAKE_BUILD_TYPE=3D Release USE_GCC=3D 4.7+ #CXXFLAGS+=3D -stdlib=3Dlibc++ =2Einclude --------------020905080102060901040901-- --------------enigDA220183AD5D429D7C88391E Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBAgAGBQJQR2WjAAoJEOgBcD7A/5N8Ih4H/2yb0SMUgrJSiSls0jGuFaD3 P/B28GTeIvnaHHSZyvamY7itARkMx48WAfXRf1Nw5hVT+DLDCmt8T2lDnVmpysrJ GSFSCPNy1/zQ1zmaS6DnLNRV5HPWCSu/YsPbWbDTq3pKPKBRm6zxfifE6XojXiwk a4d4RwvFJ3K9a6riN3ND3N0nK3+fNyRzhVTlYPeVu1yLTNzrYd1OypisuhK5oabl TochS9hr7sKvoAvrlcrR0AUhmhD06CC+DT5MthAFWCumlkCCRq71ZOLp0YBdYToF LRFiHW/0SPYUdJ4UBfRkHUrSqnYB8V/bIrRIl5YhxgR/fmPN9dI66HtK9umJKx4= =m4Px -----END PGP SIGNATURE----- --------------enigDA220183AD5D429D7C88391E-- From owner-freebsd-performance@FreeBSD.ORG Thu Sep 6 12:51:19 2012 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 802AF1065670; Thu, 6 Sep 2012 12:51:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id D1BEE8FC14; Thu, 6 Sep 2012 12:51:18 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:f8a2:c245:f52d:c435] (unknown [IPv6:2001:7b8:3a7:0:f8a2:c245:f52d:c435]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 65D0C5C37; Thu, 6 Sep 2012 14:51:16 +0200 (CEST) Message-ID: <50489C47.4040101@FreeBSD.org> Date: Thu, 06 Sep 2012 14:51:19 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20120828 Thunderbird/16.0 MIME-Version: 1.0 To: "O. Hartmann" References: <5047659D.8000107@mail.zedat.fu-berlin.de> In-Reply-To: <5047659D.8000107@mail.zedat.fu-berlin.de> Content-Type: multipart/mixed; boundary="------------090904010800010802030106" X-Mailman-Approved-At: Thu, 06 Sep 2012 15:36:06 +0000 Cc: "freebsd-performance@freebsd.org" , Ports FreeBSD Subject: Re: Help. Porting "FreeOCL" fails (atomic_ops.h missing, CLANG++ libc++ issues ...) X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2012 12:51:19 -0000 This is a multi-part message in MIME format. --------------090904010800010802030106 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2012-09-05 16:45, O. Hartmann wrote: ... > Well, I tried LLVM/CLANG, but Cmake of the sources fairly fails many > checks especuially for OpenMP. Yes, it is currently not supported. I am not sure if there are serious attempts to add it. > Using clang++ requisites the usage of the > new libc++ (CXXFLAGS+= -stdlib=libc++). But this fails with this error: ... > /usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/parser/parser.h:118:15: > error: no viable conversion from 'std::__1::basic_istream' to > 'const bool' > const bool ok = in.get(c); > ^ ~~~~~~~~~ This is a bug in FreeOCL. The istream::get() function returns an istream reference, which can't be cast directly to bool. However, there is a negation operator defined for istream, so the line can be changed to: const bool ok = !!in.get(c); I have attached a patch for the port as I have built it here with clang. I didn't add the dependency on atomic_ops yet, but it should be fairly trivial. Note I also needed a fix for Mk/bsd.cmake.mk, otherwise the required ${CPPFLAGS} would not be passed along to CMake, and then the build would still fail to find the atomic_ops headers in /usr/local/include. --------------090904010800010802030106 Content-Type: text/x-diff; name="clangports-devel-freeocl-1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="clangports-devel-freeocl-1.diff" Index: Mk/bsd.cmake.mk =================================================================== --- Mk/bsd.cmake.mk (revision 303593) +++ Mk/bsd.cmake.mk (working copy) @@ -50,12 +50,12 @@ BUILD_DEPENDS+= ${CMAKE_BIN}:${CMAKE_PORT} CMAKE_ENV?= ${CONFIGURE_ENV} CMAKE_ARGS+= -DCMAKE_C_COMPILER:STRING="${CC}" \ -DCMAKE_CXX_COMPILER:STRING="${CXX}" \ - -DCMAKE_C_FLAGS:STRING="${CFLAGS}" \ - -DCMAKE_C_FLAGS_DEBUG:STRING="${CFLAGS}" \ - -DCMAKE_C_FLAGS_RELEASE:STRING="${CFLAGS}" \ - -DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS}" \ - -DCMAKE_CXX_FLAGS_DEBUG:STRING="${CXXFLAGS}" \ - -DCMAKE_CXX_FLAGS_RELEASE:STRING="${CXXFLAGS}" \ + -DCMAKE_C_FLAGS:STRING="${CPPFLAGS} ${CFLAGS}" \ + -DCMAKE_C_FLAGS_DEBUG:STRING="${CPPFLAGS} ${CFLAGS}" \ + -DCMAKE_C_FLAGS_RELEASE:STRING="${CPPFLAGS} ${CFLAGS}" \ + -DCMAKE_CXX_FLAGS:STRING="${CPPFLAGS} ${CXXFLAGS}" \ + -DCMAKE_CXX_FLAGS_DEBUG:STRING="${CPPFLAGS} ${CXXFLAGS}" \ + -DCMAKE_CXX_FLAGS_RELEASE:STRING="${CPPFLAGS} ${CXXFLAGS}" \ -DCMAKE_EXE_LINKER_FLAGS:STRING="${LDFLAGS}" \ -DCMAKE_MODULE_LINKER_FLAGS:STRING="${LDFLAGS}" \ -DCMAKE_SHARED_LINKER_FLAGS:STRING="${LDFLAGS}" \ Index: devel/freeocl/Makefile =================================================================== --- devel/freeocl/Makefile (revision 0) +++ devel/freeocl/Makefile (working copy) @@ -0,0 +1,22 @@ +PORTNAME= freeocl +PORTVERSION= 0.3.6 +CATEGORIES= devel + +MAINTAINER= ports@FreeBSD.org +COMMENT= FreeOCL - a free OpenCL implementation for CPU + +#MASTER_SITES= http://freeocl.googlecode.com/files/FreeOCL-0.3.6-src.tar.gz +MASTER_SITES= http://freeocl.googlecode.com/files/ +DISTNAME= FreeOCL-${PORTVERSION}-src + +WRKSRC= ${WRKDIR}/FreeOCL-${PORTVERSION}-Source + +USE_CMAKE= YES +CMAKE_BUILD_TYPE= Release + +#USE_GCC= 4.7+ + +CPPFLAGS+= -I${LOCALBASE}/include +CXXFLAGS+= -stdlib=libc++ + +.include Index: devel/freeocl/files/patch-src__parser__parser.h =================================================================== --- devel/freeocl/files/patch-src__parser__parser.h (revision 0) +++ devel/freeocl/files/patch-src__parser__parser.h (working copy) @@ -0,0 +1,11 @@ +--- src/parser/parser.h.orig 2012-09-02 19:00:41.000000000 +0200 ++++ src/parser/parser.h 2012-09-06 14:14:01.000000000 +0200 +@@ -115,7 +115,7 @@ namespace FreeOCL + inline std::istream &get(char &c) + { + c = 0; +- const bool ok = in.get(c); ++ const bool ok = !!in.get(c); + if (c == '\n') + ++line; + if (!current_line.empty() && *current_line.rbegin() == '\n') --------------090904010800010802030106-- From owner-freebsd-performance@FreeBSD.ORG Thu Sep 6 14:04:38 2012 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6026E1065677; Thu, 6 Sep 2012 14:04:38 +0000 (UTC) (envelope-from ohartman@mail.zedat.fu-berlin.de) Received: from outpost1.zedat.fu-berlin.de (outpost1.zedat.fu-berlin.de [130.133.4.66]) by mx1.freebsd.org (Postfix) with ESMTP id 017F78FC1A; Thu, 6 Sep 2012 14:04:36 +0000 (UTC) Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost1.zedat.fu-berlin.de (Exim 4.69) with esmtp (envelope-from ) id <1T9ch9-0002oE-KO>; Thu, 06 Sep 2012 16:04:35 +0200 Received: from telesto.geoinf.fu-berlin.de ([130.133.86.198]) by inpost2.zedat.fu-berlin.de (Exim 4.69) with esmtpsa (envelope-from ) id <1T9ch9-0003ro-GF>; Thu, 06 Sep 2012 16:04:35 +0200 Message-ID: <5048AD6D.1050600@mail.zedat.fu-berlin.de> Date: Thu, 06 Sep 2012 16:04:29 +0200 From: "O. Hartmann" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120810 Thunderbird/14.0 MIME-Version: 1.0 To: Dimitry Andric References: <5047659D.8000107@mail.zedat.fu-berlin.de> <50489C47.4040101@FreeBSD.org> In-Reply-To: <50489C47.4040101@FreeBSD.org> X-Enigmail-Version: 1.4.3 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigEA6BB21C6FDF7EBEAABD5674" X-Originating-IP: 130.133.86.198 X-Mailman-Approved-At: Thu, 06 Sep 2012 16:16:56 +0000 Cc: "freebsd-performance@freebsd.org" , mazhe@alkumuna.eu, Ports FreeBSD Subject: Re: Help. Porting "FreeOCL" fails (atomic_ops.h missing, CLANG++ libc++ issues ...) X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2012 14:04:38 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigEA6BB21C6FDF7EBEAABD5674 Content-Type: multipart/mixed; boundary="------------050803020201020404080901" This is a multi-part message in MIME format. --------------050803020201020404080901 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello Dimitry, thanks for your response and patches. On 09/06/12 14:51, Dimitry Andric wrote: > On 2012-09-05 16:45, O. Hartmann wrote: > ... >> Well, I tried LLVM/CLANG, but Cmake of the sources fairly fails many >> checks especuially for OpenMP. >=20 > Yes, it is currently not supported. I am not sure if there are serious= > attempts to add it. >=20 >=20 >> Using clang++ requisites the usage of the >> new libc++ (CXXFLAGS+=3D -stdlib=3Dlibc++). But this fails with this e= rror: > ... >> /usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/parser/parser.h= :118:15: >> >> error: no viable conversion from 'std::__1::basic_istream' to >> 'const bool' >> const bool ok =3D in.get(c); >> ^ ~~~~~~~~~ >=20 > This is a bug in FreeOCL. The istream::get() function returns an > istream reference, which can't be cast directly to bool. However, ther= e > is a negation operator defined for istream, so the line can be changed > to: >=20 > const bool ok =3D !!in.get(c); >=20 > I have attached a patch for the port as I have built it here with clang= =2E > I didn't add the dependency on atomic_ops yet, but it should be fairly > trivial. I fixed that, I forgot the pkg-plist, also. Will followup the PR I sent. it is a simple line: BUILD_DEPENDS=3D ... >=20 > Note I also needed a fix for Mk/bsd.cmake.mk, otherwise the required > ${CPPFLAGS} would not be passed along to CMake, and then the build woul= d > still fail to find the atomic_ops headers in /usr/local/include. Is this going to be fixed with your patch in the ports tree? I'm amazed by the speed you came up with the patches ...;-) My port request can be found here: http://www.freebsd.org/cgi/query-pr.cgi?pr=3D171376 and one for providing the OpenCL header: http://www.freebsd.org/cgi/query-pr.cgi?pr=3D171375 Matthieu Volat also stated that there is another promising OpenCL port "Portable OpenCL", pocl. It seems to have a better LLVM support by design= : http://sourceforge.net/apps/mediawiki/pocl/index.php?title=3DMain_Page Attached you'll find my first naiv attempt to build a port-Makefile, but I fail to fetch(1), since there is an authentication error while trying to fetch from a HTTPS:// source. My abilities in depp-insight-development are limited, so I'm happy if some experienced developers could also look at those software projects and help making a port ;-) it would be nice having FreeOCL and portable OCL for comparison purposes available on FreeBSD. I still have the hope to "lurd" more developers and scientists back to FreeBSD. Never mind ... oh --------------050803020201020404080901 Content-Type: text/plain; charset=us-ascii; name="Makefile" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Makefile" PORTNAME=3D pocl PORTVERSION=3D 0.6 CATEGORIES=3D devel MAINTAINER=3D ports@FreeBSD.org COMMENT=3D Portable OpenCL - an efficient open source (MIT-licensed) imp= lementation of the OpenCL 1.2 standard. MASTER_SITES=3D https://launchpad.net/pocl/${PORTVERSION}/0.6.0/+downloa= d/ #CONFLICTS=3D freeocl CXXFLAGS+=3D -stdlib=3Dlibc++ LIB_DEPENDS=3D ltdl:${PORTSDIR}/devel/libltdl #USE_GMAKE=3D yes GNU_CONFIGURE=3D yes USE_LDCONFIG=3D yes =2Einclude --------------050803020201020404080901-- --------------enigEA6BB21C6FDF7EBEAABD5674 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBAgAGBQJQSK1zAAoJEOgBcD7A/5N8GVUH/A3OIDJSmhXV/QImCnV5nRvp YeumzzpO8WB7LnMVS2L439wZ4WKjiinPOJCV0qA8GLB2GqyLhW0f36dqD200tZmm nObZxm6W6E2o5acleeVVV3RSdA9PklKomUIDs4qMNr83Cmy+gUIOZD/sTGcnc7xc IBnHs2JjMA5nCrIbfZRL5PmVwckPeT8xPY1bvgVSNusxfQa2DjQzig+0J5K77wiL 77wxUaRz6BVRpcfZJW0F8QlCRgaxvBUIGhSpEn48gNfpmg5JpTNJpVJiqSLCZk5E IvCl0Fa4jQx5HCENVXkYwiEb7bhlDaL/MteRBpnIPNuIRoDMMLTCBr65NnpWSJY= =upkW -----END PGP SIGNATURE----- --------------enigEA6BB21C6FDF7EBEAABD5674-- From owner-freebsd-performance@FreeBSD.ORG Thu Sep 6 18:28:45 2012 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0AAE106566B; Thu, 6 Sep 2012 18:28:45 +0000 (UTC) (envelope-from ohartman@zedat.fu-berlin.de) Received: from outpost1.zedat.fu-berlin.de (outpost1.zedat.fu-berlin.de [130.133.4.66]) by mx1.freebsd.org (Postfix) with ESMTP id 50A348FC16; Thu, 6 Sep 2012 18:28:45 +0000 (UTC) Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost1.zedat.fu-berlin.de (Exim 4.69) with esmtp (envelope-from ) id <1T9gom-000836-5H>; Thu, 06 Sep 2012 20:28:44 +0200 Received: from e178003010.adsl.alicedsl.de ([85.178.3.10] helo=thor.walstatt.dyndns.org) by inpost2.zedat.fu-berlin.de (Exim 4.69) with esmtpsa (envelope-from ) id <1T9gol-0002k2-Vf>; Thu, 06 Sep 2012 20:28:44 +0200 Message-ID: <5048EB56.2070402@zedat.fu-berlin.de> Date: Thu, 06 Sep 2012 20:28:38 +0200 From: "O. Hartmann" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120810 Thunderbird/14.0 MIME-Version: 1.0 To: Dimitry Andric References: <5047659D.8000107@mail.zedat.fu-berlin.de> <50489C47.4040101@FreeBSD.org> In-Reply-To: <50489C47.4040101@FreeBSD.org> X-Enigmail-Version: 1.4.3 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigD4E7CD31FFDFB764121CBF17" X-Originating-IP: 85.178.3.10 Cc: "O. Hartmann" , "freebsd-performance@freebsd.org" , Ports FreeBSD Subject: Re: Help. Porting "FreeOCL" fails (atomic_ops.h missing, CLANG++ libc++ issues ...) X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2012 18:28:45 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigD4E7CD31FFDFB764121CBF17 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 09/06/12 14:51, Dimitry Andric wrote: > On 2012-09-05 16:45, O. Hartmann wrote: > ... >> Well, I tried LLVM/CLANG, but Cmake of the sources fairly fails many >> checks especuially for OpenMP. >=20 > Yes, it is currently not supported. I am not sure if there are serious= > attempts to add it. >=20 >=20 >> Using clang++ requisites the usage of the >> new libc++ (CXXFLAGS+=3D -stdlib=3Dlibc++). But this fails with this e= rror: > ... >> /usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/parser/parser.h= :118:15: >> >> error: no viable conversion from 'std::__1::basic_istream' to >> 'const bool' >> const bool ok =3D in.get(c); >> ^ ~~~~~~~~~ >=20 > This is a bug in FreeOCL. The istream::get() function returns an > istream reference, which can't be cast directly to bool. However, ther= e > is a negation operator defined for istream, so the line can be changed > to: >=20 > const bool ok =3D !!in.get(c); >=20 > I have attached a patch for the port as I have built it here with clang= =2E > I didn't add the dependency on atomic_ops yet, but it should be fairly > trivial. >=20 > Note I also needed a fix for Mk/bsd.cmake.mk, otherwise the required > ${CPPFLAGS} would not be passed along to CMake, and then the build woul= d > still fail to find the atomic_ops headers in /usr/local/include. With the patch for Mk/bsd.cmake.mk attached, I can not compile the port with CLANG, compilation results in [ 15%] Building CXX object src/CMakeFiles/FreeOCL.dir/image.cpp.o /usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/image.cpp:442:27: error: member access into incomplete type 'struct _cl_event' if (event_wait_list[i]->status < 0) ^ /usr/local/include/CL/cl.h:46:16: note: forward declaration of '_cl_event= ' typedef struct _cl_event * cl_event; ^ /usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/image.cpp:449:58: error: allocation of incomplete type '_cl_event' cmd->event =3D (blocking_read =3D=3D CL_TRUE || event) ? = new _cl_event(command_queue->context) : NULL; ^~~~~~~~~ /usr/local/include/CL/cl.h:46:16: note: forward declaration of '_cl_event= ' typedef struct _cl_event * cl_event; ^ /usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/image.cpp:463:14: error: member access into incomplete type '_cl_event' cmd->event->command_queue =3D command_queue; ^ /usr/local/include/CL/cl.h:46:16: note: forward declaration of '_cl_event= ' typedef struct _cl_event * cl_event; ^ /usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/image.cpp:464:14: error: member access into incomplete type '_cl_event' cmd->event->command_type =3D CL_COMMAND_READ_IMAG= E; ^ /usr/local/include/CL/cl.h:46:16: note: forward declaration of '_cl_event= ' typedef struct _cl_event * cl_event; Without the patch, CLANG++ doesn't find the atomic_ops.h header as you wrote. Oliver --------------enigD4E7CD31FFDFB764121CBF17 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBAgAGBQJQSOtbAAoJEOgBcD7A/5N8GYMIAMcRzFu0/Mc8a1Jke+tO6gT4 QsPTDGUPJo+K8irt/tPXtMnV6jwYGpgSVlOt4QehZiwV822Y9IepXTT4snl2lVcc OhjfWnLhiljTJF9fSlw6j4/4PP4L82oPXfGJKMhb4mv6XF7v2ySIk1qVvaTtXZSM Rg4ToiYeD4/5xNf6GDTTU2cRWFDwV2g551jf9htH/WqJPYq51WjJ7BIeaklEmqds rMg0l+e33jSBY9/qNdVVZrUlrS47QvLMBkc69TttwxGIAOAX13YdBSNuGdhB/yDo /IpVbToGewqDKk7EAIbq1nWQUQ1drtzbkoLmpC+T3NvLwRPJf+4V3SG+SklWo3w= =ixdR -----END PGP SIGNATURE----- --------------enigD4E7CD31FFDFB764121CBF17-- From owner-freebsd-performance@FreeBSD.ORG Thu Sep 6 19:19:15 2012 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 892BC1065672; Thu, 6 Sep 2012 19:19:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 41BCF8FC15; Thu, 6 Sep 2012 19:19:15 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:f8a2:c245:f52d:c435] (unknown [IPv6:2001:7b8:3a7:0:f8a2:c245:f52d:c435]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id D88F55C37; Thu, 6 Sep 2012 21:19:13 +0200 (CEST) Message-ID: <5048F733.3090301@FreeBSD.org> Date: Thu, 06 Sep 2012 21:19:15 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20120905 Thunderbird/16.0 MIME-Version: 1.0 To: "O. Hartmann" References: <5047659D.8000107@mail.zedat.fu-berlin.de> <50489C47.4040101@FreeBSD.org> <5048EB56.2070402@zedat.fu-berlin.de> In-Reply-To: <5048EB56.2070402@zedat.fu-berlin.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Thu, 06 Sep 2012 19:27:26 +0000 Cc: "freebsd-performance@freebsd.org" , Ports FreeBSD Subject: Re: Help. Porting "FreeOCL" fails (atomic_ops.h missing, CLANG++ libc++ issues ...) X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2012 19:19:15 -0000 On 2012-09-06 20:28, O. Hartmann wrote: ... > With the patch for Mk/bsd.cmake.mk attached, I can not compile the port > with CLANG, compilation results in > > [ 15%] Building CXX object src/CMakeFiles/FreeOCL.dir/image.cpp.o > /usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/image.cpp:442:27: > error: member access into incomplete type 'struct _cl_event' > if (event_wait_list[i]->status < 0) > ^ > /usr/local/include/CL/cl.h:46:16: note: forward declaration of '_cl_event' > typedef struct _cl_event * cl_event; > ^ Which package installed that /usr/local/include/CL/cl.h file? It looks like it should take this header from the source package, not from whatever is installed into /usr/local. In the top-level CMakeLists.txt, there is this fragment: include_directories(.) include_directories(include) include_directories(src) which indicates to CMake it should add -I flags for each of those directories. However, it seems -I/usr/local/include is placed earlier in the arguments of the actual clang++ invocations: /usr/bin/clang++ -DFreeOCL_EXPORTS -O2 -pipe -I/usr/local/include -fno-strict-aliasing -I/usr/local/include -stdlib=libc++ -std=c++0x -DFREEOCL_USE_CXX0X -DFREEOCL_ARCH_amd64 -O3 -ffast-math -fPIC -I/usr/work/share/dim/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/. -I/usr/work/share/dim/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/include -I/usr/work/share/dim/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src -o CMakeFiles/FreeOCL.dir/image.cpp.o -c /usr/work/share/dim/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/image.cpp So it will take /usr/local/include/CL/cl.h before the cl.h under ${WRKSRC}. Now, as to how we can convince CMake to put the -I/usr/local/include at the end... Maybe we should just patch the CMakeLists.txt, but that is a rather ugly solution. :)