Source-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/parallel parallel: Add lua-lanes



details:   https://anonhg.NetBSD.org/pkgsrc/rev/15adc911f86d
branches:  trunk
changeset: 435679:15adc911f86d
user:      nia <nia%pkgsrc.org@localhost>
date:      Sat Jul 11 16:15:08 2020 +0000

description:
parallel: Add lua-lanes

Lua Lanes is a Lua extension library providing the possibility to run multiple
Lua states in parallel. It is intended to be used for optimizing performance
on multicore CPUs and to study ways to make Lua programs naturally parallel
to begin with.

diffstat:

 parallel/Makefile                                |   3 +-
 parallel/lua-lanes/DESCR                         |   4 ++
 parallel/lua-lanes/Makefile                      |  40 ++++++++++++++++++++
 parallel/lua-lanes/PLIST                         |   6 +++
 parallel/lua-lanes/distinfo                      |   9 ++++
 parallel/lua-lanes/patches/patch-src_Makefile    |  19 +++++++++
 parallel/lua-lanes/patches/patch-src_threading.c |  46 ++++++++++++++++++++++++
 parallel/lua-lanes/patches/patch-src_threading.h |  15 +++++++
 8 files changed, 141 insertions(+), 1 deletions(-)

diffs (184 lines):

diff -r 90cf9d0f7f55 -r 15adc911f86d parallel/Makefile
--- a/parallel/Makefile Sat Jul 11 15:33:51 2020 +0000
+++ b/parallel/Makefile Sat Jul 11 16:15:08 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.27 2019/08/09 20:25:29 brook Exp $
+# $NetBSD: Makefile,v 1.28 2020/07/11 16:15:08 nia Exp $
 #
 
 COMMENT=       Applications dealing with parallelism in computing
@@ -11,6 +11,7 @@
 SUBDIR+=       gridscheduler
 SUBDIR+=       hwloc
 SUBDIR+=       linda
+SUBDIR+=       lua-lanes
 SUBDIR+=       mpi-ch
 SUBDIR+=       openmp
 SUBDIR+=       openmpi
diff -r 90cf9d0f7f55 -r 15adc911f86d parallel/lua-lanes/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/parallel/lua-lanes/DESCR  Sat Jul 11 16:15:08 2020 +0000
@@ -0,0 +1,4 @@
+Lua Lanes is a Lua extension library providing the possibility to run multiple
+Lua states in parallel. It is intended to be used for optimizing performance
+on multicore CPUs and to study ways to make Lua programs naturally parallel
+to begin with.
diff -r 90cf9d0f7f55 -r 15adc911f86d parallel/lua-lanes/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/parallel/lua-lanes/Makefile       Sat Jul 11 16:15:08 2020 +0000
@@ -0,0 +1,40 @@
+# $NetBSD: Makefile,v 1.1 2020/07/11 16:15:08 nia Exp $
+
+DISTNAME=      lanes-3.13.0
+PKGNAME=       ${LUA_PKGPREFIX}-${DISTNAME}
+CATEGORIES=    parallel lua
+MASTER_SITES=  ${MASTER_SITE_GITHUB:=LuaLanes/}
+GITHUB_PROJECT=        lanes
+GITHUB_TAG=    v${PKGVERSION_NOREV}
+
+MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=      https://lualanes.github.io/lanes/
+COMMENT=       Lightweight, native, lazy evaluating multithreading library for Lua
+LICENSE=       mit
+
+USE_TOOLS+=    gmake
+
+BUILD_DIRS+=   src
+
+MAKE_FLAGS+=   LIBFLAG="${LDFLAGS} -shared"
+
+INSTALLATION_DIRS+=    ${LUA_DOCDIR}
+INSTALLATION_DIRS+=    ${LUA_LDIR}
+INSTALLATION_DIRS+=    ${LUA_CDIR}/lanes
+
+do-install:
+       ${INSTALL_LIB} ${WRKSRC}/src/lanes/core.so \
+               ${DESTDIR}${PREFIX}/${LUA_CDIR}/lanes/core.so
+       ${INSTALL_DATA} ${WRKSRC}/src/lanes.lua \
+               ${DESTDIR}${PREFIX}/${LUA_LDIR}/lanes.lua
+       ${INSTALL_DATA} ${WRKSRC}/docs/*.html ${WRKSRC}/docs/*.png \
+               ${DESTDIR}${PREFIX}/${LUA_DOCDIR}
+
+do-test:
+       cd ${WRKSRC}/tests && \
+               LUA_PATH="${WRKSRC}/src/?.lua;${WRKSRC}/tests/?.lua" \
+               LUA_CPATH="${WRKSRC}/src/?.so" \
+               ${LUA_INTERPRETER} basic.lua
+
+.include "../../lang/lua/module.mk"
+.include "../../mk/bsd.pkg.mk"
diff -r 90cf9d0f7f55 -r 15adc911f86d parallel/lua-lanes/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/parallel/lua-lanes/PLIST  Sat Jul 11 16:15:08 2020 +0000
@@ -0,0 +1,6 @@
+@comment $NetBSD: PLIST,v 1.1 2020/07/11 16:15:08 nia Exp $
+${LUA_CDIR}/lanes/core.so
+${LUA_DOCDIR}/comparison.html
+${LUA_DOCDIR}/index.html
+${LUA_DOCDIR}/multi.png
+${LUA_LDIR}/lanes.lua
diff -r 90cf9d0f7f55 -r 15adc911f86d parallel/lua-lanes/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/parallel/lua-lanes/distinfo       Sat Jul 11 16:15:08 2020 +0000
@@ -0,0 +1,9 @@
+$NetBSD: distinfo,v 1.1 2020/07/11 16:15:08 nia Exp $
+
+SHA1 (lanes-3.13.0.tar.gz) = f9cda1fa99ea042c0645967a4bd573b0ae6762eb
+RMD160 (lanes-3.13.0.tar.gz) = dab59db4717e28e1a248860a9d2441e2bf7e83cc
+SHA512 (lanes-3.13.0.tar.gz) = bb509181757fa2b4f07a55962015b35ca6bb867b18ec89dd655f333babe2e12f56479fa85bc98e0dacf5bec2a523265bbc3a978396dc332dc1fdda4df760b2e5
+Size (lanes-3.13.0.tar.gz) = 247978 bytes
+SHA1 (patch-src_Makefile) = a9f40a821f086574d5debc2ecd434eee1aa93b18
+SHA1 (patch-src_threading.c) = 2daf9d772fbbcd7a04cd41a0b10060c7a97d8b38
+SHA1 (patch-src_threading.h) = 036129d1c9c5e7bf7b6535caff07fbb15f65e23d
diff -r 90cf9d0f7f55 -r 15adc911f86d parallel/lua-lanes/patches/patch-src_Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/parallel/lua-lanes/patches/patch-src_Makefile     Sat Jul 11 16:15:08 2020 +0000
@@ -0,0 +1,19 @@
+$NetBSD: patch-src_Makefile,v 1.1 2020/07/11 16:15:09 nia Exp $
+
+Respect CC/CFLAGS.
+
+--- src/Makefile.orig  2018-11-30 12:28:50.000000000 +0000
++++ src/Makefile
+@@ -88,11 +88,10 @@ ifeq "$(LUAROCKS)" ""
+     # Some machines need 'MACOSX_DEPLOYMENT_TARGET=10.3' for using '-undefined dynamic_lookup'
+     # (at least PowerPC running 10.4.11); does not harm the others
+     #
+-    CC = MACOSX_DEPLOYMENT_TARGET=10.3 gcc
+     LIBFLAG = -bundle -undefined dynamic_lookup
+   endif
+   
+-  CFLAGS=-Wall -Werror $(OPT_FLAGS) $(LUA_FLAGS)
++  CFLAGS+=-fPIC -Wall $(OPT_FLAGS) $(LUA_FLAGS)
+   LIBS=$(LUA_LIBS)
+ endif
+ 
diff -r 90cf9d0f7f55 -r 15adc911f86d parallel/lua-lanes/patches/patch-src_threading.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/parallel/lua-lanes/patches/patch-src_threading.c  Sat Jul 11 16:15:08 2020 +0000
@@ -0,0 +1,46 @@
+$NetBSD: patch-src_threading.c,v 1.1 2020/07/11 16:15:09 nia Exp $
+
+NetBSD support.
+
+--- src/threading.c.orig       2018-11-30 12:28:50.000000000 +0000
++++ src/threading.c
+@@ -886,9 +886,16 @@ void THREAD_SET_PRIORITY( int prio)
+ 
+ void THREAD_SET_AFFINITY( unsigned int aff)
+ {
+-      cpu_set_t cpuset;
+       int bit = 0;
++#ifdef __NetBSD__
++      cpuset_t *cpuset = cpuset_create();
++      if( cpuset == NULL)
++              _PT_FAIL( errno, "cpuset_create", __FILE__, __LINE__-2 );
++#define CPU_SET(b, s) cpuset_set(b, *(s))
++#else
++      cpu_set_t cpuset;
+       CPU_ZERO( &cpuset);
++#endif
+       while( aff != 0)
+       {
+               if( aff & 1)
+@@ -900,6 +907,9 @@ void THREAD_SET_AFFINITY( unsigned int a
+       }
+ #ifdef __ANDROID__
+       PT_CALL( sched_setaffinity( pthread_self(), sizeof(cpu_set_t), &cpuset));
++#elif defined(__NetBSD__)
++      PT_CALL( pthread_setaffinity_np( pthread_self(), cpuset_size(cpuset), cpuset));
++      cpuset_destroy( cpuset);
+ #else
+       PT_CALL( pthread_setaffinity_np( pthread_self(), sizeof(cpu_set_t), &cpuset));
+ #endif
+@@ -996,8 +1006,10 @@ bool_t THREAD_WAIT( THREAD_T *ref, doubl
+       {
+               // exact API to set the thread name is platform-dependant
+               // if you need to fix the build, or if you know how to fill a hole, tell me (bnt.germain%gmail.com@localhost) so that I can submit the fix in github.
+-#if defined PLATFORM_BSD
++#if defined PLATFORM_BSD && !defined __NetBSD__
+               pthread_set_name_np( pthread_self(), _name);
++#elif defined PLATFORM_BSD && defined __NetBSD__
++              pthread_setname_np( pthread_self(), "%s", (void *)_name);
+ #elif defined PLATFORM_LINUX
+       #if LINUX_USE_PTHREAD_SETNAME_NP
+               pthread_setname_np( pthread_self(), _name);
diff -r 90cf9d0f7f55 -r 15adc911f86d parallel/lua-lanes/patches/patch-src_threading.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/parallel/lua-lanes/patches/patch-src_threading.h  Sat Jul 11 16:15:08 2020 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_threading.h,v 1.1 2020/07/11 16:15:09 nia Exp $
+
+NetBSD support.
+
+--- src/threading.h.orig       2018-11-30 12:28:50.000000000 +0000
++++ src/threading.h
+@@ -143,7 +143,7 @@ enum e_status { PENDING, RUNNING, WAITIN
+   //
+   #if defined( PLATFORM_OSX)
+     #define YIELD() pthread_yield_np()
+-#elif defined( PLATFORM_WIN32) || defined( PLATFORM_POCKETPC) || defined(__ANDROID__) // no PTHREAD for PLATFORM_XBOX
++#elif defined( PLATFORM_WIN32) || defined( PLATFORM_POCKETPC) || defined(__ANDROID__) || defined(__NetBSD__) // no PTHREAD for PLATFORM_XBOX
+     // for some reason win32-pthread doesn't have pthread_yield(), but sched_yield()
+     #define YIELD() sched_yield()
+   #else



Home | Main Index | Thread Index | Old Index