Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7f8d3b7
Need to clean forces in step 1
briandrawert Jul 8, 2020
d0c57fe
reworking rdme
briandrawert Jul 9, 2020
d40ee8d
adding new list types
briandrawert Jul 13, 2020
e9053c2
Merge branch 'develop' of github.com:spatialpy/SpatialPy into fix_dat…
briandrawert Jul 13, 2020
6a286e0
NSM refactor in progress
briandrawert Jul 22, 2020
fcdddbc
linked lists refactored
briandrawert Jul 24, 2020
035edac
find_neighbor() now does all neighbor distance/diffusion compuataions
briandrawert Jul 24, 2020
11870a7
Python fixes
briandrawert Jul 24, 2020
4e835b7
compile errors
briandrawert Jul 24, 2020
e1cb95b
more debugging
briandrawert Jul 25, 2020
4797f68
compiling
briandrawert Jul 25, 2020
3b389ce
more debugging
briandrawert Jul 25, 2020
76d3272
compile errors fixed
briandrawert Jul 26, 2020
f606aff
fix bug in VTKreader, fail on blank lines
briandrawert Jul 26, 2020
b3fa2e9
Sorting the neighbors to prevent bias in diffusion direction
briandrawert Jul 27, 2020
22c671b
pushing notebook
briandrawert Jul 27, 2020
07e4488
ability to disable RDME computation
briandrawert Jul 28, 2020
44ce400
Fixed bug in diffusion, major bug still exists
makdl Sep 1, 2020
14702c6
saving work
briandrawert Sep 2, 2020
ead130c
diffusion test works correctly
briandrawert Sep 2, 2020
61bc7ef
merge
briandrawert Sep 2, 2020
bcecb1f
All this so it will work with spaces in the folder names
briandrawert Sep 4, 2020
d98477b
Updated cdc42 notebook
makdl Sep 12, 2020
e830936
Reduced plotting output due to large file size
makdl Sep 12, 2020
df0885c
Fixed bug that was causing CylinderDemo to run incorrectly
briandrawert Sep 13, 2020
4b633df
Merge branch 'test_fix_data_function' of github.com:spatialpy/Spatial…
briandrawert Sep 13, 2020
8042faa
removing density filter for wall particles
briandrawert Sep 14, 2020
e891577
Wall particles do need to change density in non-static simulations
briandrawert Sep 15, 2020
deb69a2
Updated diffusion & cdc42
makdl Sep 15, 2020
dc1323e
Added diffusion reaction debug model
makdl Sep 15, 2020
5223921
Merged minor Windows bug fixes
makdl Sep 22, 2020
cd9de08
dSFMT replacement for srand48
makdl Sep 23, 2020
8ef3333
Resolving merge conflicts
makdl Sep 23, 2020
7c1a83d
Models now use set_type not add_subdomain
makdl Sep 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
dSFMT replacement for srand48
  • Loading branch information
makdl committed Sep 23, 2020
commit cd9de082a7af8c52d3a79b6ea151c86c7d9d616f
10 changes: 6 additions & 4 deletions spatialpy/ssa_sdpd-c-simulation-engine/build/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
CC = gcc
CFLAGS = -O3 -Wall
LFLAGS = -pthread -lm
INCDIR = $(ROOTINC)/include/
DSFMTFLAGS = -DHAVE_SSE2 -DDSFMT_MEXP=521
INCDIR = $(ROOTINC)/include/ $(ROOTINC)/external/
INCDIRPARAMS = $(INCDIR:%=-I%)
OBJ = linked_list.o particle.o simulate.o count_cores.o output.o simulate_rdme.o binheap.o simulate_threads.o model.o pthread_barrier.o


Expand All @@ -10,10 +12,10 @@ OBJ = linked_list.o particle.o simulate.o count_cores.o output.o simulate_rdme.o
all: ssa_sdpd

main.o:
$(CC) -c -o main.o $(MODEL) -I$(INCDIR) $(CFLAGS)
$(CC) -c -o main.o $(MODEL) $(INCDIRPARAMS) $(CFLAGS) $(DSFMTFLAGS)

%.o: $(ROOT)/src/%.c
$(CC) -c -o $@ "$<" -I$(INCDIR) $(CFLAGS)
$(CC) -c -o $@ "$<" $(INCDIRPARAMS) $(CFLAGS) $(DSFMTFLAGS)

ssa_sdpd: main.o $(OBJ)
$(CC) -o ssa_sdpd $(OBJ) main.o $(LFLAGS)
$(CC) -o ssa_sdpd $(OBJ) $(ROOTINC)/external/dSFMT/dSFMT.c main.o $(DSFMTFLAGS) $(LFLAGS)
32 changes: 32 additions & 0 deletions spatialpy/ssa_sdpd-c-simulation-engine/external/dSFMT/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Copyright (c) 2007, 2008, 2009 Mutsuo Saito, Makoto Matsumoto
and Hiroshima University.
Copyright (c) 2011, 2002 Mutsuo Saito, Makoto Matsumoto, Hiroshima
University and The University of Tokyo.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of the Hiroshima University nor the names of
its contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
=================================================================
dSFMT ver. 2.1.1
2011.11.10

double precision SIMD oriented Fast Mersenne Twister(dSFMT)
based on IEEE 754 floating point format.

Mutsuo Saito (Hiroshima University) and
Makoto Matsumoto (Hiroshima University)

Copyright (C) 2007, 2008, 2009 Mutsuo Saito, Makoto Matsumoto and
Hiroshima University.
Copyright (C) 2011 Mutsuo Saito, Makoto Matsumoto, Hiroshima
University and The University of Tokyo.
All rights reserved.

The (modified) BSD License is applied to this software, see
LICENSE.txt
=================================================================

�ɥ�����Ȥϡ����Ȥ��Ѹ줬ʸˡŪ���������ʤ����Ǥ⡢�Ѹ��Ǥ�������
��ΤǤ���

dSFMT2.0 ����� 2.1 ��dSFMT1.x �Ȥϵ���������������������㤤�ޤ����Ĥޤꡢ
dSFMT1.x��Ʊ������ͤ�Ϳ���Ƥ�ۤʤ뵿���������������ޤ���

doxygen �ˤ�ä��������줿�ɥ�����ȡʱѸ�ˤ���html �ǥ��쥯�ȥ��
���ˤ���Τǻ��Ȥ��Ƥ���������

���Υץ������� IEEE754 ��������ư������������Ѥ��Ƥ��륷���ƥ�Ǥ�
��ư��ޤ���

���Υץ������ϡ�C����ι�¤�Τ���Ѥ��Ƥ��ޤ����������äơ������
�ޤ��Ȥ��С�����å�����̡��ε������������Ѥ��뤳�Ȥ��Ǥ��ޤ�������
����dSFMT.c�Υ���ѥ�����Ȱۤʤ�DSFMT_MEXP��桼�����ץ������Υ���
�ѥ�����˻��ꤹ��ȡ����꤬ȯ�����ޤ����ʥ��ԡ��ɤ����ˤ��ơ��ѥ�᡼
����������¤�Τ������Ȥ�����ˡ�⤢��ޤ����������Ǥϥ��ԡ��ɤ�ͥ�褷
�ޤ�����

�Ȥꤢ�����ƥ��ȥץ����������餻�Ƥߤ����Ȥ����ͤϡ�html �ǥ��쥯��
��β���howto-compile.html�ʱѸ�ˤ�ߤƲ�������CPU ���ӥå�����ǥ���
��ξ��ϡ����դ�ɬ�פǤ�����������ץ�ץ����å��ޥ����ˤ�äơ�����
�ǥ������Ƚ��򤷤Ƥ��ޤ���������Ū�� DSFMT_BIG_ENDIAN �ޥ����������
�������������Ȼפ��ޤ���

�����������ɤ��ѹ������ꤷ�ʤ��ä��ꤷ�Ƥ��Υץ�����������ۤ�������
�ϡ�LICENSE.txt�ʱѸ�ˤ��ɤ�Dz�������

�ե�������ѹ���ä��ƺ����ۤ�����ϡ��ɤ���������ʪ����ˤ��ʤ���Ϣ
�����񤤤Ƥ����ơ����꤬���ä��Ȥ��ϡ��䤿���ǤϤʤ������ʤ��ˤޤ�Ϣ
������褦�����ѼԤ������Ʋ�������

41 changes: 41 additions & 0 deletions spatialpy/ssa_sdpd-c-simulation-engine/external/dSFMT/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
=================================================================
dSFMT ver. 2.2.1
2011.11.10

double precision SIMD oriented Fast Mersenne Twister(dSFMT)
based on IEEE 754 floating point format.

Mutsuo Saito (Hiroshima University) and
Makoto Matsumoto (Hiroshima University)

Copyright (C) 2007, 2008, 2009 Mutsuo Saito, Makoto Matsumoto and
Hiroshima University.
Copyright (C) 2011, 2013 Mutsuo Saito, Makoto Matsumoto, Hiroshima
University and The University of Tokyo.
All rights reserved.

The (modified) BSD License is applied to this software, see
LICENSE.txt
=================================================================
The documents written in English is the official one.

dSFMT ver. 2.0 and ver. 2.1 are completely different from dSFMT ver 1.xx.
The algorithm is changed.

This program only works on systems which have IEEE754 floating point
format.

This version uses `struct' of C language.
Don't use different DSFMT_MEXP for compiling dSFMT.c and your program.

To see documents, see html/index.html.

To make test program, see html/howto-compile.html.
If your CPU is BIG ENDIAN and your compiler is not gcc,
define DSFMT_BIG_ENDIAN preprocessor macro, please.

If you want to redistribute and/or change source files, see LICENSE.txt.

When you change these files and redistribute them, PLEASE write your
e-mail address in redistribution and write to contact YOU first if
users of your changed source encounter troubles.
115 changes: 115 additions & 0 deletions spatialpy/ssa_sdpd-c-simulation-engine/external/dSFMT/dSFMT-common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#pragma once
/**
* @file dSFMT-common.h
*
* @brief SIMD oriented Fast Mersenne Twister(SFMT) pseudorandom
* number generator with jump function. This file includes common functions
* used in random number generation and jump.
*
* @author Mutsuo Saito (Hiroshima University)
* @author Makoto Matsumoto (The University of Tokyo)
*
* Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
* University.
* Copyright (C) 2012 Mutsuo Saito, Makoto Matsumoto, Hiroshima
* University and The University of Tokyo.
* All rights reserved.
*
* The 3-clause BSD License is applied to this software, see
* LICENSE.txt
*/
#ifndef DSFMT_COMMON_H
#define DSFMT_COMMON_H

#include "dSFMT.h"

#if defined(HAVE_SSE2)
# include <emmintrin.h>
union X128I_T {
uint64_t u[2];
__m128i i128;
};
union X128D_T {
double d[2];
__m128d d128;
};
/** mask data for sse2 */
static const union X128I_T sse2_param_mask = {{DSFMT_MSK1, DSFMT_MSK2}};
#endif

#if defined(HAVE_ALTIVEC)
inline static void do_recursion(w128_t *r, w128_t *a, w128_t * b,
w128_t *lung) {
const vector unsigned char sl1 = ALTI_SL1;
const vector unsigned char sl1_perm = ALTI_SL1_PERM;
const vector unsigned int sl1_msk = ALTI_SL1_MSK;
const vector unsigned char sr1 = ALTI_SR;
const vector unsigned char sr1_perm = ALTI_SR_PERM;
const vector unsigned int sr1_msk = ALTI_SR_MSK;
const vector unsigned char perm = ALTI_PERM;
const vector unsigned int msk1 = ALTI_MSK;
vector unsigned int w, x, y, z;

z = a->s;
w = lung->s;
x = vec_perm(w, (vector unsigned int)perm, perm);
y = vec_perm(z, (vector unsigned int)sl1_perm, sl1_perm);
y = vec_sll(y, sl1);
y = vec_and(y, sl1_msk);
w = vec_xor(x, b->s);
w = vec_xor(w, y);
x = vec_perm(w, (vector unsigned int)sr1_perm, sr1_perm);
x = vec_srl(x, sr1);
x = vec_and(x, sr1_msk);
y = vec_and(w, msk1);
z = vec_xor(z, y);
r->s = vec_xor(z, x);
lung->s = w;
}
#elif defined(HAVE_SSE2)
/**
* This function represents the recursion formula.
* @param r output 128-bit
* @param a a 128-bit part of the internal state array
* @param b a 128-bit part of the internal state array
* @param d a 128-bit part of the internal state array (I/O)
*/
inline static void do_recursion(w128_t *r, w128_t *a, w128_t *b, w128_t *u) {
__m128i v, w, x, y, z;

x = a->si;
z = _mm_slli_epi64(x, DSFMT_SL1);
y = _mm_shuffle_epi32(u->si, SSE2_SHUFF);
z = _mm_xor_si128(z, b->si);
y = _mm_xor_si128(y, z);

v = _mm_srli_epi64(y, DSFMT_SR);
w = _mm_and_si128(y, sse2_param_mask.i128);
v = _mm_xor_si128(v, x);
v = _mm_xor_si128(v, w);
r->si = v;
u->si = y;
}
#else
/**
* This function represents the recursion formula.
* @param r output 128-bit
* @param a a 128-bit part of the internal state array
* @param b a 128-bit part of the internal state array
* @param lung a 128-bit part of the internal state array (I/O)
*/
inline static void do_recursion(w128_t *r, w128_t *a, w128_t * b,
w128_t *lung) {
uint64_t t0, t1, L0, L1;

t0 = a->u[0];
t1 = a->u[1];
L0 = lung->u[0];
L1 = lung->u[1];
lung->u[0] = (t0 << DSFMT_SL1) ^ (L1 >> 32) ^ (L1 << 32) ^ b->u[0];
lung->u[1] = (t1 << DSFMT_SL1) ^ (L0 >> 32) ^ (L0 << 32) ^ b->u[1];
r->u[0] = (lung->u[0] >> DSFMT_SR) ^ (lung->u[0] & DSFMT_MSK1) ^ t0;
r->u[1] = (lung->u[1] >> DSFMT_SR) ^ (lung->u[1] & DSFMT_MSK2) ^ t1;
}
#endif
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#ifndef DSFMT_PARAMS_H
#define DSFMT_PARAMS_H

#include "dSFMT.h"

/*----------------------
the parameters of DSFMT
following definitions are in dSFMT-paramsXXXX.h file.
----------------------*/
/** the pick up position of the array.
#define DSFMT_POS1 122
*/

/** the parameter of shift left as four 32-bit registers.
#define DSFMT_SL1 18
*/

/** the parameter of shift right as four 32-bit registers.
#define DSFMT_SR1 12
*/

/** A bitmask, used in the recursion. These parameters are introduced
* to break symmetry of SIMD.
#define DSFMT_MSK1 (uint64_t)0xdfffffefULL
#define DSFMT_MSK2 (uint64_t)0xddfecb7fULL
*/

/** These definitions are part of a 128-bit period certification vector.
#define DSFMT_PCV1 UINT64_C(0x00000001)
#define DSFMT_PCV2 UINT64_C(0x00000000)
*/

#define DSFMT_LOW_MASK UINT64_C(0x000FFFFFFFFFFFFF)
#define DSFMT_HIGH_CONST UINT64_C(0x3FF0000000000000)
#define DSFMT_SR 12

/* for sse2 */
#if defined(HAVE_SSE2)
#define SSE2_SHUFF 0x1b
#elif defined(HAVE_ALTIVEC)
#if defined(__APPLE__) /* For OSX */
#define ALTI_SR (vector unsigned char)(4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4)
#define ALTI_SR_PERM \
(vector unsigned char)(15,0,1,2,3,4,5,6,15,8,9,10,11,12,13,14)
#define ALTI_SR_MSK \
(vector unsigned int)(0x000fffffU,0xffffffffU,0x000fffffU,0xffffffffU)
#define ALTI_PERM \
(vector unsigned char)(12,13,14,15,8,9,10,11,4,5,6,7,0,1,2,3)
#else
#define ALTI_SR {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}
#define ALTI_SR_PERM {15,0,1,2,3,4,5,6,15,8,9,10,11,12,13,14}
#define ALTI_SR_MSK {0x000fffffU,0xffffffffU,0x000fffffU,0xffffffffU}
#define ALTI_PERM {12,13,14,15,8,9,10,11,4,5,6,7,0,1,2,3}
#endif
#endif

#if DSFMT_MEXP == 521
#include "dSFMT-params521.h"
#elif DSFMT_MEXP == 1279
#include "dSFMT-params1279.h"
#elif DSFMT_MEXP == 2203
#include "dSFMT-params2203.h"
#elif DSFMT_MEXP == 4253
#include "dSFMT-params4253.h"
#elif DSFMT_MEXP == 11213
#include "dSFMT-params11213.h"
#elif DSFMT_MEXP == 19937
#include "dSFMT-params19937.h"
#elif DSFMT_MEXP == 44497
#include "dSFMT-params44497.h"
#elif DSFMT_MEXP == 86243
#include "dSFMT-params86243.h"
#elif DSFMT_MEXP == 132049
#include "dSFMT-params132049.h"
#elif DSFMT_MEXP == 216091
#include "dSFMT-params216091.h"
#else
#ifdef __GNUC__
#error "DSFMT_MEXP is not valid."
#undef DSFMT_MEXP
#else
#undef DSFMT_MEXP
#endif

#endif

#endif /* DSFMT_PARAMS_H */
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#ifndef DSFMT_PARAMS11213_H
#define DSFMT_PARAMS11213_H

/* #define DSFMT_N 107 */
/* #define DSFMT_MAXDEGREE 11256 */
#define DSFMT_POS1 37
#define DSFMT_SL1 19
#define DSFMT_MSK1 UINT64_C(0x000ffffffdf7fffd)
#define DSFMT_MSK2 UINT64_C(0x000dfffffff6bfff)
#define DSFMT_MSK32_1 0x000fffffU
#define DSFMT_MSK32_2 0xfdf7fffdU
#define DSFMT_MSK32_3 0x000dffffU
#define DSFMT_MSK32_4 0xfff6bfffU
#define DSFMT_FIX1 UINT64_C(0xd0ef7b7c75b06793)
#define DSFMT_FIX2 UINT64_C(0x9c50ff4caae0a641)
#define DSFMT_PCV1 UINT64_C(0x8234c51207c80000)
#define DSFMT_PCV2 UINT64_C(0x0000000000000001)
#define DSFMT_IDSTR "dSFMT2-11213:37-19:ffffffdf7fffd-dfffffff6bfff"


/* PARAMETERS FOR ALTIVEC */
#if defined(__APPLE__) /* For OSX */
#define ALTI_SL1 (vector unsigned char)(3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3)
#define ALTI_SL1_PERM \
(vector unsigned char)(2,3,4,5,6,7,30,30,10,11,12,13,14,15,0,1)
#define ALTI_SL1_MSK \
(vector unsigned int)(0xffffffffU,0xfff80000U,0xffffffffU,0xfff80000U)
#define ALTI_MSK (vector unsigned int)(DSFMT_MSK32_1, \
DSFMT_MSK32_2, DSFMT_MSK32_3, DSFMT_MSK32_4)
#else /* For OTHER OSs(Linux?) */
#define ALTI_SL1 {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}
#define ALTI_SL1_PERM \
{2,3,4,5,6,7,30,30,10,11,12,13,14,15,0,1}
#define ALTI_SL1_MSK \
{0xffffffffU,0xfff80000U,0xffffffffU,0xfff80000U}
#define ALTI_MSK \
{DSFMT_MSK32_1, DSFMT_MSK32_2, DSFMT_MSK32_3, DSFMT_MSK32_4}
#endif

#endif /* DSFMT_PARAMS11213_H */
Loading