Commit 164372ee authored by Daniel Brown's avatar Daniel Brown

Merge branch 'develop'

parents 82ab9638 2f3f765f
......@@ -34,7 +34,8 @@ conda install numpy requests -y
# update finessetest repo
cd $FINESSE_TEST_DIR
git pull
git pull --all --tags
git checkout master
cd $CWD
ln -s $FINESSE_TEST_DIR test
......
......@@ -15,4 +15,5 @@ test
doc
finesse.project
nbproject*
\ No newline at end of file
nbproject*
.vscode/
\ No newline at end of file
......@@ -10,6 +10,101 @@ fixed bugs.
This list starts with Version 0.53 since there were just too many
changes before. Not every version number is listed.
2.2 -> 2.3 (December 2019)
main changes:
This release contains multiple fixes that have been made over nearly two years. Few additional
features have been added in this release, it predominatly has bug fixes for both physics and in
general. The features that have been added are still experimental and typically revolve around
mode-matching sensing/actuation, so are not suggested to be used currently.
syntax change:
o Refractive index warning at 4 now instead of 3 due to Silicon test mass modelling being more frequent
added features:
o Astigmatic lenses:
lens** name fx fy node1 node2
lens*** name px py node1 node2
fx,fy,px,py also work as xaxis and put targets. These astigmatic parameters are only available
when you define the component with lens** or lens*** otherwise you can only tune with f and p.
o Overall amplitude of the map applied to a mirror can be changed with the `map_amp` attribute.
Added so that you can lock drag some a map from off to on from some known DC operating point.
o Modulators can have tilt modulation applied
o Laser can now fsig modulate the waist size and position effects
to compute how beam shape noise transfer functions behave. This
will generate the additional n+-2 and m+-2 modes signal sidebands
around the carrier field:
l l1 1 0 n0
tem l1 0 0 0 0
tem l1 2 0 1 0
s s1 0 n0 n1
ad a00 0 0 0 n1
ad a20 2 0 0 n1
ad u00 0 0 $fs n1
ad l00 0 0 $mfs n1
ad u20 2 0 $fs n1
ad l20 2 0 $mfs n1
ad u40 4 0 $fs n1
ad l40 4 0 $mfs n1
pd1 P $fs n1
noxaxis
fsig noise l1 z 1 0 1
# or this for waist modulation fsig noise l1 w0 1 0 1
maxtem 4
yaxis abs:deg
o Can switch off the mode self-coupling term for beam shape modulations above with:
conf l1 z_fsig_self_coupling 1
This removes the phase modulation like term that appears with waist position modulation.
o Xaxis stepping using Kahan summation now to ensure we hit zero more accurately
o Signal matrix calculations are not performed when computing the DC lock point now.
This means that signal matrix calculations cannot be used for computing the DC operating point
anymore, however this shouldn't really have been a use case anyway.
bug fixes:
o tf2 won't add duplicate of a real pole/zero, it only adds a conjugate if it's a complex ones
o Minus sign fixes have been applied for suspended components: mirrors and beamsplitters
this doesn't seem to have affected any results shown before, but does affect the sign
of some transfer functions. The minus sign problem was the direction in which a mirror moves
relative the force applied to it.
o RF frequency mixing matrix wasn't getting reset between runs and causing spurious frequency couplings
o Fixed problem with small signals jumping between being either a TF or a signal, getting
an odd factor of two occasionally
o Beamsplitter fsig targetting z was not being applied
o $fs was not working correctly when fsig was first frequency and RF the second
o Beam trace wasn't taking into account axis flip for sagittal plane on reflection
which leads to the wrong cavity parameters being show for odd-number mirror cavities.
This doesn't affect any actual calculation of optical fields amplitudes, just detector
and trace outputs.
o Windows named pipe correctly closed, hopefully stops Windows pykat connection being dropped
when too many connections are left open.
o Rebuild flag for knm calculations was getting overwritten for m and bs when using x2axis, this
is fixed now.
o Laser frequency modulation amplitude factor is now fixed, erroneous 4pi factor
o segfault when using slink fixed
o modulator phase fsig lower sideband conjugate missing, now included
o dbs component now checks refractive index differences stopping weird beam parameter
propagations.
2.1 -> 2.2 (June 2017)
main changes:
......@@ -103,7 +198,7 @@ bug fixes:
in certain circumstances.
o ASC signals through composite mirrors were fixed. See https://dcc.ligo.org/LIGO-T1700114
o Plancks constant was only set to 5 significant figures, this was fixed
2.0 -> 2.1 (22/04/2016)
main changes:
......@@ -402,7 +497,7 @@ added feature:
being used in the simulation, frequency n: `n' bit coded word,
produces the following output:
frequency 1: print all frequencies used for the compuation
frequency 2: print frequency coupling matrix for each modulator
frequency 2: print frequency coupling matrix for each oscillator
misc:
o Data in output to file now has always 15 digits precision
......
......@@ -20,7 +20,7 @@ HOSTNAME = $(shell uname -n)
# Set defaults for including libraries
ifeq "$(ARCH)" "mac"
INCLUDE_NICSLU=1
INCLUDE_NICSLU=0
INCLUDE_CUBA=1
INCLUDE_NET=1
INCLUDE_PARALUTION=0
......
......@@ -369,6 +369,7 @@ case "$1" in
NATIVE="-march=native"
CPUARCH=""
target_arch=$platform
<<<<<<< HEAD
if [[ "$platform" == 'linux' ]]; then
TARGET=$TARGET_LINUX
......@@ -395,6 +396,34 @@ case "$1" in
failure
fi
=======
if [[ "$platform" == 'linux' ]]; then
TARGET=$TARGET_LINUX
elif [[ "$platform" == 'mac' ]]; then
TARGET=$TARGET_MAC
elif [[ "$platform" == 'cygwin32' ]]; then
TARGET=$TARGET_WIN32
CPUARCH=
target_arch=win32
elif [[ "$platform" == 'cygwin64' ]]; then
TARGET=$TARGET_WIN64
CPUARCH=
target_arch=win64
elif [[ "$platform" == 'win32' ]]; then
TARGET=$TARGET_WIN32
CPUARCH=
target_arch=win64
elif [[ "$platform" == 'win64' ]]; then
TARGET=$TARGET_WIN64
CPUARCH=
target_arch=win64
else
echo "Platform Target could not be determined" | tee -a $LOGFILE
failure
fi
>>>>>>> develop
echo "Building native Finesse version:" | tee -a $LOGFILE
;;
"--build-linux")
......@@ -447,10 +476,17 @@ case "$1" in
"--remove")
echo "--remove is no longer used." | tee -a $LOGFILE
;;
<<<<<<< HEAD
"--clean")
TARGET=$TARGET_CLEAN
;;
"--make-win-package")
=======
"--clean")
TARGET=$TARGET_CLEAN
;;
"--make-win-package")
>>>>>>> develop
make-win-package
exit 0
;;
......@@ -462,8 +498,6 @@ esac
# here we go...
#export OPTIM_CFLAGS="-mfpmath=sse -O3 -ffast-math -Wall -fexpensive-optimizations -fomit-frame-pointer -funroll-loops -DNDEBUG "
if ( cc 2>&1 | grep clang >/dev/null ); then
echo "Setting optimisation flags for clang compiler"
export OPTIM_CFLAGS="-mfpmath=sse -O3 -fno-math-errno -ffinite-math-only -fno-trapping-math -fno-signed-zeros -Wall -Wextra -Wno-missing-field-initializers -fomit-frame-pointer -funroll-loops -DNDEBUG "
......
/*
* -- SuperLU MT routine (version 2.0) --
* Lawrence Berkeley National Lab, Univ. of California Berkeley,
* and Xerox Palo Alto Research Center.
* September 10, 2007
*
*/
#include "pdsp_defs.h"
main(int argc, char *argv[])
{
SuperMatrix A, L, U;
SuperMatrix B, X;
NCformat *Astore;
SCPformat *Lstore;
NCPformat *Ustore;
int nprocs;
fact_t fact;
trans_t trans;
yes_no_t refact, usepr;
equed_t equed;
double *a;
int *asub, *xa;
int *perm_c; /* column permutation vector */
int *perm_r; /* row permutations from partial pivoting */
void *work;
superlumt_options_t superlumt_options;
int info, lwork, nrhs, ldx, panel_size, relax;
int m, n, nnz, permc_spec;
int i, firstfact;
double *rhsb, *rhsx, *xact;
double *R, *C;
double *ferr, *berr;
double u, drop_tol, rpg, rcond;
superlu_memusage_t superlu_memusage;
void parse_command_line();
/* Default parameters to control factorization. */
nprocs = 1;
fact = EQUILIBRATE;
trans = NOTRANS;
equed = NOEQUIL;
refact= NO;
panel_size = sp_ienv(1);
relax = sp_ienv(2);
u = 1.0;
usepr = NO;
drop_tol = 0.0;
lwork = 0;
nrhs = 1;
/* Command line options to modify default behavior. */
parse_command_line(argc, argv, &nprocs, &lwork, &panel_size, &relax,
&u, &fact, &trans, &refact, &equed);
if ( lwork > 0 ) {
work = SUPERLU_MALLOC(lwork);
printf("Use work space of size LWORK = %d bytes\n", lwork);
if ( !work ) {
SUPERLU_ABORT("DLINSOLX: cannot allocate work[]");
}
}
#if ( PRNTlevel==1 )
cpp_defs();
#endif
#define HB
#if defined( DEN )
m = n;
nnz = n * n;
dband(n, n, nnz, &a, &asub, &xa);
#elif defined( BAND )
m = n;
nnz = (2*b+1) * n;
dband(n, b, nnz, &a, &asub, &xa);
#elif defined( BD )
nb = 5;
bs = 200;
m = n = bs * nb;
nnz = bs * bs * nb;
dblockdiag(nb, bs, nnz, &a, &asub, &xa);
#elif defined( HB )
dreadhb(&m, &n, &nnz, &a, &asub, &xa);
#else
dreadmt(&m, &n, &nnz, &a, &asub, &xa);
#endif
firstfact = (fact == FACTORED || refact == YES);
dCreate_CompCol_Matrix(&A, m, n, nnz, a, asub, xa, SLU_NC, SLU_D, SLU_GE);
Astore = A.Store;
printf("Dimension %dx%d; # nonzeros %d\n", A.nrow, A.ncol, Astore->nnz);
if (!(rhsb = doubleMalloc(m * nrhs))) SUPERLU_ABORT("Malloc fails for rhsb[].");
if (!(rhsx = doubleMalloc(m * nrhs))) SUPERLU_ABORT("Malloc fails for rhsx[].");
dCreate_Dense_Matrix(&B, m, nrhs, rhsb, m, SLU_DN, SLU_D, SLU_GE);
dCreate_Dense_Matrix(&X, m, nrhs, rhsx, m, SLU_DN, SLU_D, SLU_GE);
xact = doubleMalloc(n * nrhs);
ldx = n;
dGenXtrue(n, nrhs, xact, ldx);
dFillRHS(trans, nrhs, xact, ldx, &A, &B);
if (!(perm_r = intMalloc(m))) SUPERLU_ABORT("Malloc fails for perm_r[].");
if (!(perm_c = intMalloc(n))) SUPERLU_ABORT("Malloc fails for perm_c[].");
if (!(R = (double *) SUPERLU_MALLOC(A.nrow * sizeof(double))))
SUPERLU_ABORT("SUPERLU_MALLOC fails for R[].");
if ( !(C = (double *) SUPERLU_MALLOC(A.ncol * sizeof(double))) )
SUPERLU_ABORT("SUPERLU_MALLOC fails for C[].");
if ( !(ferr = (double *) SUPERLU_MALLOC(nrhs * sizeof(double))) )
SUPERLU_ABORT("SUPERLU_MALLOC fails for ferr[].");
if ( !(berr = (double *) SUPERLU_MALLOC(nrhs * sizeof(double))) )
SUPERLU_ABORT("SUPERLU_MALLOC fails for berr[].");
/*
* Get column permutation vector perm_c[], according to permc_spec:
* permc_spec = 0: natural ordering
* permc_spec = 1: minimum degree ordering on structure of A'*A
* permc_spec = 2: minimum degree ordering on structure of A'+A
* permc_spec = 3: approximate minimum degree for unsymmetric matrices
*/
permc_spec = 1;
get_perm_c(permc_spec, &A, perm_c);
superlumt_options.nprocs = nprocs;
superlumt_options.fact = fact;
superlumt_options.trans = trans;
superlumt_options.refact = refact;
superlumt_options.panel_size = panel_size;
superlumt_options.relax = relax;
superlumt_options.diag_pivot_thresh = u;
superlumt_options.usepr = usepr;
superlumt_options.drop_tol = drop_tol;
superlumt_options.SymmetricMode = NO;
superlumt_options.PrintStat = NO;
superlumt_options.perm_c = perm_c;
superlumt_options.perm_r = perm_r;
superlumt_options.work = work;
superlumt_options.lwork = lwork;
/*
* Solve the system and compute the condition number
* and error bounds using pdgssvx.
*/
pdgssvx(nprocs, &superlumt_options, &A, perm_c, perm_r,
&equed, R, C, &L, &U, &B, &X, &rpg, &rcond,
ferr, berr, &superlu_memusage, &info);
printf("pdgssvx(): info %d\n", info);
if ( info == 0 || info == n+1 ) {
printf("Recip. pivot growth = %e\n", rpg);
printf("Recip. condition number = %e\n", rcond);
printf("%8s%16s%16s\n", "rhs", "FERR", "BERR");
for (i = 0; i < nrhs; ++i) {
printf("%8d%16e%16e\n", i+1, ferr[i], berr[i]);
}
Lstore = (SCPformat *) L.Store;
Ustore = (NCPformat *) U.Store;
printf("No of nonzeros in factor L = %d\n", Lstore->nnz);
printf("No of nonzeros in factor U = %d\n", Ustore->nnz);
printf("No of nonzeros in L+U = %d\n", Lstore->nnz + Ustore->nnz - n);
printf("L\\U MB %.3f\ttotal MB needed %.3f\texpansions %d\n",
superlu_memusage.for_lu/1e6, superlu_memusage.total_needed/1e6,
superlu_memusage.expansions);
fflush(stdout);
} else if ( info > 0 && lwork == -1 ) {
printf("** Estimated memory: %d bytes\n", info - n);
}
SUPERLU_FREE (rhsb);
SUPERLU_FREE (rhsx);
SUPERLU_FREE (xact);
SUPERLU_FREE (perm_r);
SUPERLU_FREE (perm_c);
SUPERLU_FREE (R);
SUPERLU_FREE (C);
SUPERLU_FREE (ferr);
SUPERLU_FREE (berr);
Destroy_CompCol_Matrix(&A);
Destroy_SuperMatrix_Store(&B);
Destroy_SuperMatrix_Store(&X);
if ( lwork >= 0 ) {
Destroy_SuperNode_SCP(&L);
Destroy_CompCol_NCP(&U);
}
}
/*
* Parse command line options.
*/
void
parse_command_line(int argc, char *argv[], int *nprocs, int *lwork,
int *w, int *relax, double *u, fact_t *fact,
trans_t *trans, yes_no_t *refact, equed_t *equed)
{
int c;
extern char *optarg;
while ( (c = getopt(argc, argv, "hp:l:w:x:u:f:t:r:e:")) != EOF ) {
switch (c) {
case 'h':
printf("Options:\n");
printf("\t-p <int> - number of processes\n");
printf("\t-l <int> - length of work[*] array\n");
printf("\t-w <int> - panel size\n");
printf("\t-x <int> - maximum size of relaxed supernodes\n");
printf("\t-u <int> - pivoting threshold\n");
printf("\t-f <FACTORED/DOFACT/EQUILIBRATE> - factor control\n");
printf("\t-t <NOTRANS/TRANS/CONJ> - transpose or not\n");
printf("\t-r <NO/YES> - refactor or not\n");
printf("\t-e <NOEQUIL/ROW/COL/BOTH> - equilibrate or not\n");
exit(1);
break;
case 'p': *nprocs = atoi(optarg);
break;
case 'l': *lwork = atoi(optarg);
break;
case 'w': *w = atoi(optarg);
break;
case 'x': *relax = atoi(optarg);
break;
case 'u': *u = atof(optarg);
break;
case 'f': *fact = (fact_t) atoi(optarg);
break;
case 't': *trans = (trans_t) atoi(optarg);
break;
case 'r': *refact = (yes_no_t) atoi(optarg);
break;
case 'e': *equed = (equed_t) atoi(optarg);
break;
default: fprintf(stderr, "Invalid command line option.\n");
break;
}
}
}
This diff is collapsed.
/* Elimination tree computation and layout routines */
#include <stdio.h>
#ifndef __STDC__
#include <malloc.h>
#endif
#include <stdlib.h>
#include "util.h"
/*
* Implementation of disjoint set union routines.
* Elements are integers in 0..n-1, and the
* names of the sets themselves are of type int.
*
* Calls are:
* initialize_disjoint_sets (n) initial call.
* s = make_set (i) returns a set containing only i.
* s = link (t, u) returns s = t union u, destroying t and u.
* s = find (i) return name of set containing i.
* finalize_disjoint_sets final call.
*
* This implementation uses path compression but not weighted union.
* See Tarjan's book for details.
* John Gilbert, CMI, 1987.
*/
static int *pp; /* parent array for sets */
static
int *mxCallocInt(int n)
{
register int i;
int *buf;
buf = (int *) SUPERLU_MALLOC( n * sizeof(int) );
if ( !buf ) {
printf("SUPERLU_MALLOC failed for buf in mxCallocInt()");
exit (1);
}
for (i = 0; i < n; i++) buf[i] = 0;
return (buf);
}
static
void initialize_disjoint_sets (
int n
)
{
pp = mxCallocInt(n);
}
static
int make_set (
int i
)
{
pp[i] = i;
return i;
}
static
int link (
int s,
int t
)
{
pp[s] = t;
return t;
}
/* PATH HALVING */
static
int find (int i)
{
register int p, gp;
p = pp[i];
gp = pp[p];
while (gp != p) {
pp[i] = gp;
i = gp;
p = pp[i];
gp = pp[p];
}
return (p);
}
#if 0
static
int find (
int i
)
{
if (pp[i] != i)
pp[i] = find (pp[i]);
return pp[i];
}
#endif
static
void finalize_disjoint_sets (
void
)
{
SUPERLU_FREE(pp);
}
/*
* Find the elimination tree for A'*A.
* This uses something similar to Liu's algorithm.
* It runs in time O(nz(A)*log n) and does not form A'*A.
*
* Input:
* Sparse matrix A. Numeric values are ignored, so any
* explicit zeros are treated as nonzero.
* Output:
* Integer array of parents representing the elimination
* tree of the symbolic product A'*A. Each vertex is a
* column of A, and nc means a root of the elimination forest.
*
* John R. Gilbert, Xerox, 10 Dec 1990
* Based on code by JRG dated 1987, 1988, and 1990.
*/
/*
* Nonsymmetric elimination tree
*/
int
sp_coletree(
int *acolst, int *acolend, /* column start and end past 1 */
int *arow, /* row indices of A */
int nr, int nc, /* dimension of A */
int *parent /* parent in elim tree */
)
{
int *root; /* root of subtee of etree */
int *firstcol; /* first nonzero col in each row*/
int rset, cset;
int row, col;
int rroot;
int p;
root = mxCallocInt (nc);
initialize_disjoint_sets (nc);
/* Compute firstcol[row] = first nonzero column in row */
firstcol = mxCallocInt (nr);
for (row = 0; row < nr; firstcol[row++] = nc);
for (col = 0; col < nc; col++)
for (p = acolst[col]; p < acolend[col]; p++) {
row = arow[p];
firstcol[row] = MIN(firstcol[row], col);
}
/* Compute etree by Liu's algorithm for symmetric matrices,
except use (firstcol[r],c) in place of an edge (r,c) of A.
Thus each row clique in A'*A is replaced by a star
centered at its first vertex, which has the same fill. */
for (col = 0; col < nc; col++) {
cset = make_set (col);
root[cset] = col;
parent[col] = nc; /* Matlab */
for (p = acolst[col]; p < acolend[col]; p++) {
row = firstcol[arow[p]];
if (row >= col) continue;
rset = find (row);
rroot = root[rset];
if (rroot != col) {
parent[rroot] = col;
cset = link (cset, rset);
root[cset] = col;
}
}
}
SUPERLU_FREE (root);
SUPERLU_FREE (firstcol);
finalize_disjoint_sets ();
return 0;
}
/*
* q = TreePostorder (n, p);
*
* Postorder a tree.
* Input:
* p is a vector of parent pointers for a forest whose
* vertices are the integers 0 to n-1; p[root]==n.
* Output:
* q is a vector indexed by 0..n-1 such that q[i] is the
* i-th vertex in a postorder numbering of the tree.
*
* ( 2/7/95 modified by X.Li:
* q is a vector indexed by 0:n-1 such that vertex i is the
* q[i]-th vertex in a postorder numbering of the tree.
* That is, this is the inverse of the previous q. )
*
* In the child structure, lower-numbered children are represented
* first, so that a tree which is already numbered in postorder
* will not have its order changed.
*
* Written by John Gilbert, Xerox, 10 Dec 1990.
* Based on code written by John Gilbert at CMI in 1987.
*/
static int *first_kid, *next_kid; /* Linked list of children. */
static int *post, postnum;
static
/*
* Depth-first search from vertex v.
*/
void etdfs (
int v
)
{
int w;
for (w = first_kid[v]; w != -1; w = next_kid[w]) {
etdfs (w);
}
/* post[postnum++] = v; in Matlab */
post[v] = postnum++; /* Modified by X.Li on 2/14/95 */
}
/*
* Post order a tree
*/
int *TreePostorder(
int n,
int *parent
)
{
int v, dad;
/* Allocate storage for working arrays and results */
first_kid = mxCallocInt (n+1);
next_kid = mxCallocInt (n+1);
post = mxCallocInt (n+1);
/* Set up structure describing children */
for (v = 0; v <= n; first_kid[v++] = -1);
for (v = n-1; v >= 0; v--) {
dad = parent[v];
next_kid[v] = first_kid[dad];
first_kid[dad] = v;
}
/* Depth-first search from dummy root vertex #n */
postnum = 0;
etdfs (n);
SUPERLU_FREE (first_kid);
SUPERLU_FREE (next_kid);
return post;
}
print("""
This tool will create the web distribution packages for Finesse from the
Anaconda packages created from each platform. Please update the links in
this file to point to the correct Anaconda packages for extracting the
binaries:
https://anaconda.org/gwoptics/finesse/files
""")
conda_win32 = "https://anaconda.org/gwoptics/finesse/2.2/download/win-32/finesse-2.2-hf88ea13_11.tar.bz2"
conda_win64 = "https://anaconda.org/gwoptics/finesse/2.2/download/win-64/finesse-2.2-h995273b_11.tar.bz2"
conda_linux32 = "https://anaconda.org/gwoptics/finesse/2.2/download/linux-32/finesse-2.2-h69580f5_11.tar.bz2"
conda_linux64 = "https://anaconda.org/gwoptics/finesse/2.2/download/linux-64/finesse-2.2-hd0a936e_11.tar.bz2"
conda_osx64 = "https://anaconda.org/gwoptics/finesse/2.2/download/osx-64/finesse-2.2-h4005e35_11.tar.bz2"
version = "2.2"
conda_pkgs = [
conda_win32,
conda_win64,
conda_linux32,
conda_linux64,
conda_osx64
]
output_pkgs = [
"kat-" +version + "-win_32bit",