Compare commits

..

5 Commits

Author SHA1 Message Date
Florian Stecker
f89545e995 simplify image generation 2022-06-18 14:54:50 +02:00
Florian Stecker
920a530385 remove unnecessary function qext_newtype() 2022-06-16 15:43:19 +02:00
Florian Stecker
cfc13d2ba7 add useful help text 2022-06-15 18:47:55 +02:00
Florian Stecker
979cbe7922 parallelization scripts 2022-06-15 18:04:42 +02:00
Florian Stecker
ec34567ace Makefile fix 2022-06-15 15:27:08 +02:00
10 changed files with 70 additions and 57 deletions

View File

@@ -12,7 +12,7 @@ CC=gcc
all: complex_anosov
complex_anosov: complex_anosov.o mat.o coxeter.o enumerate.o generators.o qext.o
$(CC) $(OPTIONS) -o complex_anosov -lm complex_anosov.o mat.o coxeter.o enumerate.o generators.o qext.o -lgmp -lmps
$(CC) $(OPTIONS) -o complex_anosov complex_anosov.o mat.o coxeter.o enumerate.o generators.o qext.o -lgmp -lmps -lm
complex_anosov.o: complex_anosov.c $(HEADERS)
gcc $(OPTIONS) -c complex_anosov.c

View File

@@ -161,10 +161,17 @@ int main(int argc, char *argv[])
if(mode == MODE_HELP) {
fprintf(stderr, "Usage: %s <help|evs|summary|trace_ids> [arguments]\n", argv[0]);
fprintf(stderr, "%s help display this page\n", argv[0]);
fprintf(stderr, "%s evs <n> <q1> <q2> <q3> <treal> <timag> enumerate group and output unique (log) eigenvalue triples\n", argv[0]);
fprintf(stderr, "%s summary <n> <q1> <q2> <q3> <treal> <timag> only output max slope etc.\n", argv[0]);
fprintf(stderr, "%s help display this page\n", argv[0]);
fprintf(stderr, "%s evs <n> <q1> <q2> <q3> <treal> <timag> enumerate group and output unique (log) eigenvalue triples\n", argv[0]);
fprintf(stderr, "%s summary <n> <q1> <q2> <q3> <treal> <timag> only output max slope etc.\n", argv[0]);
fprintf(stderr, "%s trace_ids <n> <q1> <q2> <q3> <treal> <timag> list of ids of unique traces\n", argv[0]);
fprintf(stderr, "\n");
fprintf(stderr, "This program computes the traces and inverse traces of the first n elements of a SL(3,C) representation of the\n");
fprintf(stderr, "triangle reflection group with corner orders (5,5,5). The representation is given by the parameters q1,q2,q3,\n");
fprintf(stderr, "treal, and timag. q1,q2,q3 can each be 1 or 2 and determine the connected component. (1,1,1) is Hitchin and\n");
fprintf(stderr, "(2,2,2) is Barbot. treal and timag are the components of the complex parameter and have to be given as rational\n");
fprintf(stderr, "numbers. If the environment variable IDLIST is set to a filename, a list of elements can be read from this file.\n");
fprintf(stderr, "Such a list can be precomputed with the \"trace_ids\" subcommand and speeds up the computation considerably.\n");
return 0;
}

View File

@@ -3,65 +3,43 @@
import sys
import math
def sharpen(x):
alpha = 1
y = abs(2*x-1)**alpha # between 0 and 1
if x > 0.499 and x < 0.501:
return 0.5
elif x > 0.5:
return (y+1)/2
else:
return (1-y)/2
f = open(sys.argv[1])
lines = [x.split() for x in f]
f.close()
res1 = int(sys.argv[2]) # 400 pixel per unit
res2 = int(sys.argv[3]) # 50 pixel in picture (acutally one quadrant)
res = int(sys.argv[2]) # pixel per unit
data = {(round(float(l[0])*res1), round(float(l[1])*res1)) : float(l[5]) for l in lines}
data = {(round(float(l[0])*res), round(float(l[1])*res)) : float(l[5]) for l in lines}
data[(0,0)] = 2.0
xmin = min([p[0] for p in data.keys()])
xmax = max([p[0] for p in data.keys()])
ymin = min([p[1] for p in data.keys()])
ymax = max([p[1] for p in data.keys()])
yrange=max([-ymin,ymax])
print("P3")
print("1000 1000")
print("{dx:d} {dy:d}".format(dx=xmax-xmin+1, dy=2*yrange+1))
print("255")
for i in range (-500,500):
for j in range(-500,500):
x = j/500*res2
y = i/500*res2
for i in range(-yrange,yrange+1):
for j in range(xmin,xmax+1):
x = j
y = i if i >= ymin and i <= ymax else -i
if y < 0:
y = -y
x0 = math.floor(x)
y0 = math.floor(y)
x1 = math.ceil(x)
y1 = math.ceil(y)
tx = sharpen(x-x0)
ty = sharpen(y-y0)
if not (x0,y0) in data or not (x0,y1) in data or not (x1,y0) in data or not (x1,y1) in data:
if not (x,y) in data:
value = 0
else:
value = 0.0
value += data[(x0,y0)]*(1-tx)*(1-ty)
value += data[(x0,y1)]*(1-tx)*ty
value += data[(x1,y0)]*tx*(1-ty)
value += data[(x1,y1)]*tx*ty
value -= 1
value = data[(x,y)]-1
value = 0 if value < 0 else 1 if value > 1 else value
r = round(255*math.sqrt(value))
r = round(255*value**0.5)
g = round(255*(value)**3)
b = round(255*math.sin(2*math.pi*(value)))
b = round(255*(math.sin(2*math.pi*value)))
r = 0 if r < 0 else 255 if r > 255 else r
g = 0 if g < 0 else 255 if g > 255 else g
b = 0 if b < 0 else 255 if b > 255 else b
print("%d %d %d" % (r,g,b))
#print(data)

6
parallelization/check_hostfile Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
for a in $(cat $1 | egrep -o '^[^ ]*'); do
echo -n "$a "
ssh -o ConnectTimeout=5 $a "cat /proc/cpuinfo | egrep '^processor' | wc -l"
done

View File

@@ -2,13 +2,13 @@
wordlength = 16
n = 101038
res = 50
radius = 1.0
res = 200
radius = 1
q = [1,1,1]
denom = round(res/radius)
cmd = "IDLIST=./output/idlist_{len} ./complex_anosov summary {n} {q1} {q2} {q3} {rnum}/{rden} {inum}/{iden}"
cmd = "IDLIST=idlist_{len} ../complex_anosov summary {n} {q1} {q2} {q3} {rnum}/{rden} {inum}/{iden}"
for i in range(-res,res+1):
for j in range(0,res+1):

View File

@@ -0,0 +1,19 @@
instructions to run in parallel on a cluster:
the hostfile should look like this:
host1 slots=2
host2 slots=4
host3 slots=4
host4 slots=8
...
- git clone
- fix dependencies
- compile
- ./generate_commands.py > commands
- get hostfile
- check hostfile, delete entries which don't work
- get idlist
- ./sync
- delete old result and done files
- execute ./run on server

7
parallelization/run Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
cd /home/stecker/compute/triangle_reflection_complex/parallelization
unset DISPLAY
time mpirun -n 50 -x LD_LIBRARY_PATH=/home/stecker/compute/mps/lib --hostfile hostfile_big python3 runjobs.py

7
parallelization/sync Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
rsync -rvt * utexas:compute/triangle_reflection_complex/parallelization/
#rsync -lvt /usr/lib/libmps.so* utexas:compute/mps/lib/
#rsync -rvt /usr/include/mps utexas:compute/mps/include/
# now run it with ssh utexas compute/triangle_reflection_complex/parallelization/run

10
qext.c
View File

@@ -37,16 +37,6 @@ static void qext_init_type(struct qext_type *type)
}
}
struct qext_type *qext_newtype(int rank, const int *coeffs)
{
struct qext_type *type = malloc(sizeof(struct qext_type));
type->rank = rank;
type->integer_coeffs = coeffs;
qext_init_type(type);
return type;
}
void qext_init(qext_number x, struct qext_type *type)
{
if(type->coeffs == NULL) // uninitialized default type

1
qext.h
View File

@@ -20,7 +20,6 @@ extern struct qext_type *QT_TRIVIAL;
extern struct qext_type *QT_SQRT5;
extern struct qext_type *QT_GAUSS_SQRT5;
struct qext_type *qext_newtype(int rank, const int *coeffs);
void qext_init(qext_number x, struct qext_type *type);
void qext_clear(qext_number x);
void qext_set(qext_number x, qext_number y);