[Beignet] [PATCH] Enable multiarch (32/64-bit co-installation)
Zhigang Gong
zhigang.gong at linux.intel.com
Thu Feb 26 21:57:52 PST 2015
On Thu, Feb 26, 2015 at 06:12:27PM +0000, Rebecca N. Palmer wrote:
> It is currently not possible to have 32- and 64-bit builds of beignet
> installed on the same system, as the path in intel-beignet.icd
> can only be one of the two installations. This fixes this by giving
> this file a different name when beignet is installed inmalformed a multiarch
> directory:
> intel-beignet-i386-linux-gnu.icd -> /usr/lib/i386-linux-gnu/beignet/libCL.so
> intel-beignet-x86_64-linux-gnu.icd -> /usr/lib/x86_64-linux-gnu/beignet/libCL.so
>
> Discussion and possible alternative approaches:
> http://lists.alioth.debian.org/pipermail/pkg-opencl-devel/Week-of-Mon-20150223/date.html
>
> While preparing this patch I noticed that intel-beignet.icd.in
> uses @LIB_INSTALL_DIR@/beignet/ rather than @BEIGNET_INSTALL_DIR@,
It should be a bug, and we should use BEIGNET_INSTALL_DIR.
I will merge this fix firstly.
As to the multi-arch support for beignet, I assume the requirement is from
running 32-bit binary on a 64-bit system. Right?
Then the 32bit application will call to ocl-icd to search available icd files.
I never test it and don't know whether the ocl-icd library will choose the
32bit beignet icd file rather than the 64 bit beignet icd file.
On the other hand, if we are runing a 64 bit application, is there already a
mechanism to make sure it will get the 64-bit beignet icd file rather than
the 32-bit?
As you know, the 64-bit and 32-bit beignet icd file point to the same
ocl device which has the same platform and device name, we can't seprate
them at the CL level. Just not sure whether this problem is solved at
lower system level.
Thanks,
Zhigang Gong.
> which will obviously break if the latter is set directly. Is
> that a bug or is this intended to be an internal-only variable?
>
> Signed-off-by: Rebecca Palmer <rebecca_palmer at zoho.com>
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 9c398e9..52f94ac 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -38,13 +38,30 @@ INCLUDE (FindPkgConfig)
> SET(CMAKE_VERBOSE_MAKEFILE "false")
> set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake/")
> +
> +INCLUDE (GNUInstallDirs OPTIONAL)
> +# support old CMake without GNUInstallDirs
> +if (NOT CMAKE_INSTALL_FULL_LIBDIR)
> + set (CMAKE_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib")
> + set (CMAKE_LIBRARY_ARCHITECTURE "")
> +endif (NOT CMAKE_INSTALL_FULL_LIBDIR)
> +
> if (NOT LIB_INSTALL_DIR)
> - set (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib")
> + set (LIB_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
> endif (NOT LIB_INSTALL_DIR)
> if (NOT BEIGNET_INSTALL_DIR)
> set (BEIGNET_INSTALL_DIR "${LIB_INSTALL_DIR}/beignet/")
> endif (NOT BEIGNET_INSTALL_DIR)
> +# allow co-installation of 32- and 64-bit versions:
> +# https://wiki.debian.org/Multiarch
> +if (BEIGNET_INSTALL_DIR STREQUAL "${CMAKE_INSTALL_PREFIX}/lib/beignet/")
> + set (ICD_FILE_NAME "intel-beignet.icd")
> +else (BEIGNET_INSTALL_DIR STREQUAL "${CMAKE_INSTALL_PREFIX}/lib/beignet/")
> + set (ICD_FILE_NAME "intel-beignet-${CMAKE_LIBRARY_ARCHITECTURE}.icd")
> +endif (BEIGNET_INSTALL_DIR STREQUAL "${CMAKE_INSTALL_PREFIX}/lib/beignet/")
> +
> +
> # Force Release with debug info
> if (NOT CMAKE_BUILD_TYPE)
> set (CMAKE_BUILD_TYPE RelWithDebInfo)
> @@ -172,9 +189,9 @@ IF(OCLIcd_FOUND)
> MESSAGE(STATUS "Looking for OCL ICD header file - found")
> configure_file (
> "intel-beignet.icd.in"
> - "intel-beignet.icd"
> + "${ICD_FILE_NAME}"
> )
> - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/intel-beignet.icd DESTINATION /etc/OpenCL/vendors)
> + install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${ICD_FILE_NAME} DESTINATION /etc/OpenCL/vendors)
> ELSE(OCLIcd_FOUND)
> MESSAGE(STATUS "Looking for OCL ICD header file - not found")
> ENDIF(OCLIcd_FOUND)
>
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list