tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Please consider inclusion of my mk/ and the wip/openblas{,_pthread,_openmp} packages

	1. Please import attached file to pkgsrc/mk/ .
	2. Please import wip/openblas{,_pthread,_openmp} .


I am finally getting around fixing up the BLAS situation in pkgsrc.
There is a new set of packages to replace and extend the current
math/lapack and wip/cblas:

wip/lapack-ng: and from netlib reference code
wip/cblas-ng: C interface to any BLAS library
wip/lapacke-ng: C interface to any LAPACK library

Attached is my mk/ that I am testing right now with
a patched (simplified) math/R. It reads a variable BLAS_TYPE and then
includes the matching package's, also setting BLAS_LIBS
and LAPACK_LIBS to help configure things.

It's clear that it is rather late in the release cycle to push the
upated wip/lapack over math/lapack and math/blas (what would be a clean
way to deprecate the latter?). But I would like to ease further
development (me pushing changes in wip that rely on it) by including
the attached file in the main pkgsrc tree.

Reminder about the removal of math/blas: We're building LAPACK and
BLAS together from one source as it is customary for optimized BLAS
implementations to also include (partially) optimized LAPACK. It makes
no sense separating these two and two packages for the netlib code
would make things rather difficult for changing the implementation.
Also, we do support all implementations being installed next to each
other, with the name being reserved for the netlib code.
Including mk/ helps choosing one of them for a build.

I opted for offering wip/cblas-ng and wip/lapacke-ng from the netlib
code to ensure that we have one source for the rather straightforward C
wrapper libraries. Both are also often included with optimized BLAS
libraries, but I think there is value in keeping the API clear by using
the reference implementations.

Also, I think it makes sense to finally import wip/openblas,
wip/openblas_pthread, and wip/openblas_openmp. They have been sitting
around on the previous version for over half a year. I just made some
small changes to bring the version up to date. If they are imported,
the paths in the attached need adjustment, of course.

Of course, feel free to discuss things to pieces before including
anything. I just wanted to sound optimistic for a start;-)

Alrighty then,


Dr. Thomas Orgis
HPC @ Universität Hamburg
# $NetBSD$
# This Makefile fragment is meant to be included by packages
# that use any BLAS implementation instead of one particular one.
# Since we always ship BLAS and LAPACK together (as upstream variants
# do), this sets both BLAS_LIBS to the linker flags needed to pull in
# the BLAS library and LAPACK_LIBS to the flags for the LAPACK library.
# Often, they will be identical or at least redundant. It is a matter
# of style to stay consistent in their use.

# TODO: Also set a variable to find a matching pkg-config file
# to avoid duplicating its contents in BLAS_LIBS?
# === User-settable variables ===
#	This value represents the type of BLAS we wish to use on the system.
#	Possible: netlib, openblas, openblas_pthread, openblas_openmp
#	Default: netlib
# === Per-package variables ===
#       This is a list of blas packages that are compatible with the current
#       package. If not set, any package is OK.

.if !defined(BLAS_BUILDLINK3_MK)
BLAS_BUILDLINK3_MK=	# define it

.include "../../mk/"

# List of all possible BLAS choices.
_BLAS_TYPES=	netlib openblas openblas_pthread openblas_openmp
# Add Accelerate framework on Darwin (pulled from math/R).
.if exists(/System/Library/Frameworks/Accelerate.framework)
_BLAS_TYPES+=	accelerate.framework
# Currently chosen type.
# Default is the standard, slow, easily available.
BLAS_TYPE?=	netlib

.  else
_BLAS_TYPE=     none
.  endif

.if $(_BLAS_TYPE) == "netlib"
_BLAS_PACKAGE=	wip/lapack-ng
BLAS_LIBS=	-lblas
.elif $(_BLAS_TYPE) == "openblas"
_BLAS_PACKAGE=	wip/openblas
BLAS_LIBS=	-lopenblas
.elif $(_BLAS_TYPE) == "openblas_pthread"
_BLAS_PACKAGE=	wip/openblas_pthread
BLAS_LIBS=	-lopenblas_pthread
.elif $(_BLAS_TYPE) == "openblas_openmp"
_BLAS_PACKAGE=	wip/openblas_openmp
BLAS_LIBS=	-lopenblas_openmp
.elif $(_BLAS_TYPE) == "accelerate.framework"
BLAS_LIBS=	-framework Accelerate
# TODO: atlas
# TODO: external BLAS (other OpenBLAS/ATLAS, Intel MKL)
.else # invalid or unimplemented type
	"${BLAS_TYPE} is not an acceptable BLAS type for ${PKGNAME}."

.if defined(_BLAS_PACKAGE)
.include "../../${_BLAS_PACKAGE}/"


Home | Main Index | Thread Index | Old Index