diff options
author | yuri <yuri@FreeBSD.org> | 2018-09-10 04:57:26 +0800 |
---|---|---|
committer | yuri <yuri@FreeBSD.org> | 2018-09-10 04:57:26 +0800 |
commit | 2db0120565a83690aa7fb686c56712264b58295e (patch) | |
tree | 2bece6c4c41e4b47dae4fe1efa9a50efa792a77f /science/lm | |
parent | ad3687b68edb880fdf469aa0c01c00349ee72595 (diff) | |
download | freebsd-ports-gnome-2db0120565a83690aa7fb686c56712264b58295e.tar.gz freebsd-ports-gnome-2db0120565a83690aa7fb686c56712264b58295e.tar.zst freebsd-ports-gnome-2db0120565a83690aa7fb686c56712264b58295e.zip |
New port: science/lm: Software for sampling trajectories of the reaction-diffusion equations
Diffstat (limited to 'science/lm')
-rw-r--r-- | science/lm/Makefile | 79 | ||||
-rw-r--r-- | science/lm/distinfo | 3 | ||||
-rw-r--r-- | science/lm/files/patch-Makefile | 29 | ||||
-rw-r--r-- | science/lm/files/patch-src_c_lm_main_Main.cpp | 24 | ||||
-rw-r--r-- | science/lm/files/patch-src_c_lm_main_runSimulation.cpp | 22 | ||||
-rw-r--r-- | science/lm/files/patch-src_c_lm_rng_XORShift.cpp | 14 | ||||
-rw-r--r-- | science/lm/files/patch-src_c_lm_thread_Thread.cpp | 36 | ||||
-rw-r--r-- | science/lm/files/patch-src_swig_lm.i | 11 | ||||
-rw-r--r-- | science/lm/pkg-descr | 9 | ||||
-rw-r--r-- | science/lm/pkg-plist | 26 |
10 files changed, 253 insertions, 0 deletions
diff --git a/science/lm/Makefile b/science/lm/Makefile new file mode 100644 index 000000000000..d9bbdf526c9e --- /dev/null +++ b/science/lm/Makefile @@ -0,0 +1,79 @@ +# $FreeBSD$ + +PORTNAME= lm +DISTVERSION= 2.3.0 +DISTVERSIONSUFFIX= -src +CATEGORIES= science +MASTER_SITES= http://scs.illinois.edu/schulten/${PORTNAME}/download/${PORTNAME}${DISTVERSION:R:S/.//}/ +PKGNAMESUFFIX= -uiuc + +MAINTAINER= yuri@FreeBSD.org +COMMENT= Software for sampling trajectories of the reaction-diffusion equations + +LICENSE= UIUC_OPEN_SOURCE_LICENSE +LICENSE_NAME= University of Illinois Open Source License +LICENSE_FILE= ${WRKSRC}/LICENSE +LICENSE_PERMS= auto-accept dist-mirror dist-sell pkg-mirror pkg-sell + +BUILD_DEPENDS= swig3.0:devel/swig30 +LIB_DEPENDS= libhdf5.so:science/hdf5 \ + libprotobuf.so:devel/protobuf \ + libsz.so:science/szip + +USES= gettext-runtime gmake localbase python + +WRKSRC= ${WRKDIR}/${PORTNAME}-${DISTVERSION} +CXXFLAGS+= -DLINUX +MAKE_ENV= BUILD_DIR=${WRKSRC} PROTOBUF_DIR=${LOCALBASE} + +OPTIONS_DEFINE= MPI PYTHON VMD +OPTIONS_DEFAULT= MPI PYTHON # VMD can't be default because VMD requires manual tarball fetch +OPTIONS_SUB= yes + +MPI_USES= fortran +MPI_VARS= XUSE_MPI=1 +MPI_VARS_OFF= XUSE_MPI=0 +MPI_LIB_DEPENDS= libmpich.so:net/mpich2 + +PYTHON_VARS= XUSE_PYTHON=1 +PYTHON_VARS_OFF= XUSE_PYTHON=0 +PYTHON_CXXFLAGS= -I${PYTHON_SITELIBDIR}/numpy/core/include +PYTHON_BUILD_DEPENDS= ${PYTHON_SITELIBDIR}/numpy/core/include/numpy/arrayobject.h:math/py-numpy@${PY_FLAVOR} + +VMD_DESC= Build the VMD plugin +VMD_VARS= XUSE_VMD=1 +VMD_VARS_OFF= XUSE_VMD=0 +VMD_VARS= VMD_ARCH=${ARCH:S/amd64/FREEBSDAMD64/:S/${ARCH}/FREEBSD/} +VMD_BUILD_DEPENDS= ${LOCALBASE}/vmd/plugins/${VMD_ARCH}/molfile/libmolfile_plugin.h:science/vmd +VMD_PLIST_SUB= VMD_ARCH=${VMD_ARCH} + +post-patch: + @${CP} ${WRKSRC}/docs/config/local.mk.linux ${WRKSRC}/local.mk + @${REINPLACE_CMD} -i '' ' \ + s|USE_MPI := 0|USE_MPI := ${XUSE_MPI}|; \ + s|USE_PYTHON := 1|USE_PYTHON := ${XUSE_PYTHON}|; \ + s|USE_VMD := 1|USE_VMD := ${XUSE_VMD}|; \ + s|USE_CUDA := 1|USE_CUDA := 0|; \ + s|swig|swig3.0|; \ + s|/usr/local|${LOCALBASE}|; \ + s|INSTALL_PREFIX := /opt/lm|INSTALL_PREFIX := ${STAGEDIR}${PREFIX}|; \ + s|BUILD_DIR := Build-linux|BUILD_DIR := Build-freebsd|; \ + s|CCFLAGS := -m64 -O2|CCFLAGS := $$(CXXFLAGS)|; \ + s|gcc|${CC}|; \ + s|g++|${CXX}|; \ + s| -lrt||' \ + ${WRKSRC}/local.mk + +post-patch-MPI-on: + @${REINPLACE_CMD} -i '' ' \ + s|MPI_COMPILE_FLAGS = .*|MPI_COMPILE_FLAGS =|; \ + s|MPI_LINK_FLAGS = .*|MPI_LINK_FLAGS = -lmpich ${LOCALBASE}/lib/gcc${GCC_DEFAULT}/libgcc_s.so|' \ + ${WRKSRC}/local.mk + +post-patch-PYTHON-on: + @${REINPLACE_CMD} -i '' 's|python-config|${PYTHON_CMD}-config|' ${WRKSRC}/local.mk + +post-patch-VMD-on: + @${REINPLACE_CMD} -i '' 's|LINUXAMD64|${VMD_ARCH}|' ${WRKSRC}/local.mk + +.include <bsd.port.mk> diff --git a/science/lm/distinfo b/science/lm/distinfo new file mode 100644 index 000000000000..8ce75f7be4ea --- /dev/null +++ b/science/lm/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1536517852 +SHA256 (lm-2.3.0-src.tar.gz) = c1a7908997e46c6590e179a4a269cbaddaab8533c7b9b3c9ff2297f5fd6dbe0c +SIZE (lm-2.3.0-src.tar.gz) = 7657245 diff --git a/science/lm/files/patch-Makefile b/science/lm/files/patch-Makefile new file mode 100644 index 000000000000..337fe89d34b4 --- /dev/null +++ b/science/lm/files/patch-Makefile @@ -0,0 +1,29 @@ +--- Makefile.orig 2016-12-06 05:23:11 UTC ++++ Makefile +@@ -282,21 +282,23 @@ installlm: + install -d $(INSTALL_PREFIX)/bin + install -m 0755 $(MAIN) $(UTIL_BINS) $(INSTALL_PREFIX)/bin + @echo 'Installing LM libraries' ++ifeq ($(USE_PYTHON),1) + install -d $(INSTALL_PREFIX)/lib/lm + install -m 0644 $(INSTALL_LIBS) $(INSTALL_PREFIX)/lib/lm + install -d $(INSTALL_PREFIX)/lib/python/pySTDLM + install -d $(INSTALL_PREFIX)/lib/python/pyLM + install -m 0644 ./src/python/pyLM/* $(INSTALL_PREFIX)/lib/python/pyLM + install -m 0644 ./src/python/pySTDLM/* $(INSTALL_PREFIX)/lib/python/pySTDLM ++endif + ifeq ($(USE_MPI),1) +- install -m 0755 lm-mpmpd $(INSTALL_PREFIX)/bin ++ install -m 0755 ./$(BUILD_DIR)/lm-mpmpd $(INSTALL_PREFIX)/bin + endif + + + installvmd: + @echo 'Installing VMD plugin' +- install -d $(VMD_INSTALL_DIR) +- install -m 0644 $(VMD_PLUGIN) $(VMD_INSTALL_DIR) ++ install -d $(DESTDIR)$(VMD_INSTALL_DIR) ++ install -m 0644 $(VMD_PLUGIN) $(DESTDIR)$(VMD_INSTALL_DIR) + + # Build a distribution package. + dist: diff --git a/science/lm/files/patch-src_c_lm_main_Main.cpp b/science/lm/files/patch-src_c_lm_main_Main.cpp new file mode 100644 index 000000000000..912ba029e793 --- /dev/null +++ b/science/lm/files/patch-src_c_lm_main_Main.cpp @@ -0,0 +1,24 @@ +--- src/c/lm/main/Main.cpp.orig 2018-09-09 19:24:07 UTC ++++ src/c/lm/main/Main.cpp +@@ -49,6 +49,9 @@ + #include <sys/stat.h> + #if defined(MACOSX) + #include <sys/sysctl.h> ++#elif defined(__FreeBSD__) ++#include <sys/types.h> ++#include <sys/sysctl.h> + #elif defined(LINUX) + #include <sys/sysinfo.h> + #endif +@@ -110,6 +113,11 @@ int getPhysicalCpuCores() + size_t physicalCpuCoresSize=sizeof(physicalCpuCores); + sysctlbyname("hw.activecpu",&physicalCpuCores,&physicalCpuCoresSize,NULL,0); + return physicalCpuCores; ++ #elif defined(__FreeBSD__) ++ int np = 0; ++ size_t len = sizeof(np); ++ sysctlbyname("hw.ncpu",&np,&len,NULL,0); ++ return np; + #elif defined(LINUX) + #ifdef ARM + return get_nprocs_conf(); diff --git a/science/lm/files/patch-src_c_lm_main_runSimulation.cpp b/science/lm/files/patch-src_c_lm_main_runSimulation.cpp new file mode 100644 index 000000000000..0774fcaac549 --- /dev/null +++ b/science/lm/files/patch-src_c_lm_main_runSimulation.cpp @@ -0,0 +1,22 @@ +--- src/c/lm/main/runSimulation.cpp.orig 2018-09-09 19:31:22 UTC ++++ src/c/lm/main/runSimulation.cpp +@@ -45,6 +45,9 @@ + */ + #if defined(MACOSX) + #include <sys/sysctl.h> ++#elif defined(__FreeBSD__) ++#include <sys/types.h> ++#include <sys/sysctl.h> + #elif defined(LINUX) + #include <sys/sysinfo.h> + #endif +@@ -149,6 +152,9 @@ void runSolver(char *simulationFilename, + size_t physicalCpuCoresSize=sizeof(physicalCpuCores); + sysctlbyname("hw.activecpu",&physicalCpuCores,&physicalCpuCoresSize,NULL,0); + numberCpuCores = physicalCpuCores; ++#elif defined(__FreeBSD__) ++ size_t len = sizeof(numberCpuCores); ++ sysctlbyname("hw.ncpu",&numberCpuCores,&len,NULL,0); + #elif defined(LINUX) + #ifdef ARM + numberCpuCores = get_nprocs_conf(); diff --git a/science/lm/files/patch-src_c_lm_rng_XORShift.cpp b/science/lm/files/patch-src_c_lm_rng_XORShift.cpp new file mode 100644 index 000000000000..fd468235ae52 --- /dev/null +++ b/science/lm/files/patch-src_c_lm_rng_XORShift.cpp @@ -0,0 +1,14 @@ +--- src/c/lm/rng/XORShift.cpp.orig 2018-09-09 20:03:05 UTC ++++ src/c/lm/rng/XORShift.cpp +@@ -42,6 +42,11 @@ + #include "lm/rng/RandomGenerator.h" + #include "lm/rng/XORShift.h" + ++// sincos doesn't exist on all current (2018-08) FreeBSD versions ++#if defined(__FreeBSD__) ++# define sincos(x,s,c) *s = sin(x); *c = cos(x); ++#endif ++ + namespace lm { + namespace rng { + diff --git a/science/lm/files/patch-src_c_lm_thread_Thread.cpp b/science/lm/files/patch-src_c_lm_thread_Thread.cpp new file mode 100644 index 000000000000..edcbfccaa110 --- /dev/null +++ b/science/lm/files/patch-src_c_lm_thread_Thread.cpp @@ -0,0 +1,36 @@ +--- src/c/lm/thread/Thread.cpp.orig 2018-09-09 19:28:35 UTC ++++ src/c/lm/thread/Thread.cpp +@@ -40,6 +40,7 @@ + #include <pthread.h> + #include "lm/Print.h" + #include "lm/thread/Thread.h" ++#include <pthread_np.h> + + namespace lm { + namespace thread { +@@ -72,10 +73,10 @@ void Thread::setAffinity(int cpuNumber) + if (running) + { + #if defined(LINUX) && !defined(ARM) +- cpu_set_t cpuset; ++ cpuset_t cpuset; + CPU_ZERO(&cpuset); + CPU_SET(cpuNumber, &cpuset); +- if (pthread_setaffinity_np(threadId, sizeof(cpu_set_t), &cpuset) != 0) ++ if (pthread_setaffinity_np(threadId, sizeof(cpuset_t), &cpuset) != 0) + Print::printf(Print::WARNING, "Could not bind thread %u to CPU core %d", threadId, cpuNumber); + #endif + } +@@ -100,10 +101,10 @@ void Thread::start() throw(PthreadExcept + if (cpuNumber >= 0) + { + #if defined(LINUX) && !defined(ARM) +- cpu_set_t cpuset; ++ cpuset_t cpuset; + CPU_ZERO(&cpuset); + CPU_SET(cpuNumber, &cpuset); +- if (pthread_setaffinity_np(threadId, sizeof(cpu_set_t), &cpuset) != 0) ++ if (pthread_setaffinity_np(threadId, sizeof(cpuset_t), &cpuset) != 0) + Print::printf(Print::WARNING, "Could not bind thread %u to CPU core %d", threadId, cpuNumber); + #endif + } diff --git a/science/lm/files/patch-src_swig_lm.i b/science/lm/files/patch-src_swig_lm.i new file mode 100644 index 000000000000..61ef40d8dae0 --- /dev/null +++ b/science/lm/files/patch-src_swig_lm.i @@ -0,0 +1,11 @@ +--- src/swig/lm.i.orig 2018-09-09 20:47:46 UTC ++++ src/swig/lm.i +@@ -66,7 +66,7 @@ using lm::rdme::InvalidParticleException + %} + + %inline %{ +-typedef long time_t; ++//typedef long time_t; + typedef unsigned char uchar; + typedef unsigned int uint; + typedef unsigned long ulong; diff --git a/science/lm/pkg-descr b/science/lm/pkg-descr new file mode 100644 index 000000000000..775688ad57b8 --- /dev/null +++ b/science/lm/pkg-descr @@ -0,0 +1,9 @@ +Lattice Microbes is a software package for efficiently sampling trajectories +from the chemical and reaction-diffusion master equations (CME/RDME) on high +performance computing (HPC) infrastructure using both exact and approximate +methods. pyLM is a problem solving environment written in Python that leverages +the high-performance nature of the Lattice Microbes package while providing ease +of use for common stochastic simulations and high customizability for complex +biological applications. + +WWW: http://www.scs.illinois.edu/schulten/lm/ diff --git a/science/lm/pkg-plist b/science/lm/pkg-plist new file mode 100644 index 000000000000..b1a2790f2c63 --- /dev/null +++ b/science/lm/pkg-plist @@ -0,0 +1,26 @@ +bin/lm +%%MPI%%bin/lm-mpmpd +%%PYTHON%%bin/lm_python +bin/lm_setdm +bin/lm_setp +bin/lm_setrm +%%PYTHON%%lib/lm/_lm.so +%%PYTHON%%lib/lm/lm.py +%%PYTHON%%lib/python/pyLM/CME.py +%%PYTHON%%lib/python/pyLM/LMLogger.py +%%PYTHON%%lib/python/pyLM/RDME.py +%%PYTHON%%lib/python/pyLM/__init__.py +%%PYTHON%%lib/python/pyLM/ipyInterface.py +%%PYTHON%%lib/python/pyLM/units.py +%%PYTHON%%lib/python/pySTDLM/CellArranger.py +%%PYTHON%%lib/python/pySTDLM/Cells.py +%%PYTHON%%lib/python/pySTDLM/Distributions.py +%%PYTHON%%lib/python/pySTDLM/NetworkVisualization.py +%%PYTHON%%lib/python/pySTDLM/OnTheFly.py +%%PYTHON%%lib/python/pySTDLM/PostProcessing.py +%%PYTHON%%lib/python/pySTDLM/SBMLReader.py +%%PYTHON%%lib/python/pySTDLM/StandardCells.py +%%PYTHON%%lib/python/pySTDLM/StandardReactionSystems.py +%%PYTHON%%lib/python/pySTDLM/StandardReactions.py +%%PYTHON%%lib/python/pySTDLM/__init__.py +%%VMD%%lib/vmd/plugins/%%VMD_ARCH%%/molfile/lmplugin.so |