All Projects → j2kun → riemann-divisor-sum

j2kun / riemann-divisor-sum

Licence: other
Code for the series "Searching for Riemann Hypothesis Counterexamples"

Programming Languages

HTML
75241 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to riemann-divisor-sum

gvm-tools
Remote control your Greenbone Community Edition or Greenbone Enterprise Appliance
Stars: ✭ 143 (+793.75%)
Mutual labels:  gmp
me
记录和分享技术的博客
Stars: ✭ 17 (+6.25%)
Mutual labels:  mathematics
humke-4d-geometry
A web-based 4D Geometry viewer
Stars: ✭ 51 (+218.75%)
Mutual labels:  mathematics
Vortice.Mathematics
Cross platform .NET math library.
Stars: ✭ 46 (+187.5%)
Mutual labels:  mathematics
spicyphysics
Sup bois, here's my work
Stars: ✭ 22 (+37.5%)
Mutual labels:  mathematics
susa
High Performance Computing (HPC) and Signal Processing Framework
Stars: ✭ 55 (+243.75%)
Mutual labels:  mathematics
Cs Roadmap
My Computer Science Curriculum
Stars: ✭ 239 (+1393.75%)
Mutual labels:  mathematics
speedy-math
An application which allows user (small kids) to practice basic Mathematics operations
Stars: ✭ 28 (+75%)
Mutual labels:  mathematics
diofant
A Python CAS library
Stars: ✭ 61 (+281.25%)
Mutual labels:  mathematics
finite-fields
Python code and tests for the post 'Programming with Finite Fields'
Stars: ✭ 43 (+168.75%)
Mutual labels:  mathematics
muparsersse
muparsersse a math parser for windows using just in time compilations of the expression
Stars: ✭ 14 (-12.5%)
Mutual labels:  mathematics
cplot
Function plotter
Stars: ✭ 27 (+68.75%)
Mutual labels:  mathematics
AlgebraLinear
Escrita colaborativa de recursos educacionais abertos sobre álgebra linear.
Stars: ✭ 57 (+256.25%)
Mutual labels:  mathematics
MathImprove
Modify and Improve math expressions.
Stars: ✭ 13 (-18.75%)
Mutual labels:  mathematics
generativepy
Library for creating generative art and maths animations
Stars: ✭ 70 (+337.5%)
Mutual labels:  mathematics
Pygalmesh
A Python frontend to CGAL's mesh generators.
Stars: ✭ 245 (+1431.25%)
Mutual labels:  mathematics
geometer
A geometry library written in Python
Stars: ✭ 89 (+456.25%)
Mutual labels:  mathematics
Hacker-Earth
This is my HackerEarth Handle
Stars: ✭ 45 (+181.25%)
Mutual labels:  mathematics
mml-book-chinese
mml-book-chinese《Mathematics For Machine Learning》机器学习中的数学 中文版
Stars: ✭ 113 (+606.25%)
Mutual labels:  mathematics
data sciences campaign
【数据科学家系列课程】
Stars: ✭ 91 (+468.75%)
Mutual labels:  mathematics

Divisor Sums for the Riemann Hypothesis

CircleCI Coverage Status Language grade: Python

An application that glibly searches for RH counterexamples, while also teaching software engineering principles.

Blog posts:

Development requirements

Requires Python 3.7 and

  • GMP for arbitrary precision arithmetic
  • gmpy2 for Python GMP bindings
  • postgres

On Mac OS X these can be installed via brew as follows

brew install gmp mpfr libmpc postgresql

Or using apt

apt install -y libgmp3-dev libmpfr-dev libmpc-dev postgresql-12

Then, in a virtualenv,

pip install -r requrements.txt

Local development with PostgreSQL

For postgres, create a new database cluster and start the server.

initdb --locale=C -E UTF-8 /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /tmp/logfile start

Then create a database like

CREATE DATABASE divisor
    WITH OWNER = jeremy;  -- or whatever your username is

Then install the pgmp extension using pgxn

sudo pip install pgxnclient
pgxn install pgmp
pgxn load -d divisor pgmp

Note you may need to add the location of gmp.h to $C_INCLUDE_PATH so that the build step for pgmp can find it. This appears to be a problem mostly on Mac OSX. See dvarrazzo/pgmp#4 if you run into issues.

# your version may be different than 6.2.0. Find it by running
# brew info gmp
export C_INCLUDE_PATH="/usr/local/Cellar/gmp/6.2.0/include:$C_INCLUDE_PATH"

In this case, you may also want to build pgmp from source,

git clone https://github.com/j2kun/pgmp && cd pgmp
make
sudo make install

Running the program

Run some combination of the following three worker jobs

python -m riemann.generate_search_blocks
python -m riemann.process_search_blocks
python -m riemann.cleanup_stale_blocks

Deploying with Docker

Running with docker removes the need to install postgres and dependencies.

Locally

docker build -t divisordb -f docker/divisordb.Dockerfile .
docker build -t generate -f docker/generate.Dockerfile .
docker build -t process -f docker/process.Dockerfile .
docker build -t cleanup -f docker/cleanup.Dockerfile .

docker volume create pgdata

docker run -d --name divisordb -p 5432:5432 -v pgdata:/var/lib/postgresql/data divisordb:latest
export PGHOST=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" divisordb)

docker run -d --name generate --env PGHOST="$PGHOST" generate:latest
docker run -d --name cleanup --env PGHOST="$PGHOST" cleanup:latest
docker run -d --name process --env PGHOST="$PGHOST" process:latest

Manual inspection

After the divisordb container is up, you can test whether it's working by

pg_isready -d divisor -h $PGHOST -p 5432 -U docker

or by going into the container and checking the database manually

$ docker exec -it divisordb /bin/bash
# now inside the container
$ psql
divisor=# \d   # \d is postgres for 'describe tables'

              List of relations
 Schema |        Name        | Type  | Owner
--------+--------------------+-------+--------
 public | riemanndivisorsums | table | docker
 public | searchmetadata     | table | docker
(2 rows)

On EC2

# install docker, see get.docker.com
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker ubuntu

# log out and log back in

git clone https://github.com/j2kun/riemann-divisor-sum && cd riemann-divisor-sum

Updating existing EC2 deployment

Fill out the environment variables from .env.template in .env, then run python deploy.py.

This will only work if the application has been set up initially (docker installed and the repository cloned).

Running the monitoring script

sudo apt install -y python3-pip ssmtp
pip3 install -r alerts/requirements.txt
sudo -E alerts/configure_ssmtp.sh
nohup python3 -m alerts.monitor_docker &

Exporting and plotting data

python -m riemann.export_for_plotting --data_source_name='dbname=divisor' --divisor_sums_filepath=divisor_sums.csv

# sort the csv by log_n using gnu sort
sort -t , -n -k 1 divisor_sums.csv -o divisor_sums_sorted.csv

# convert to hdf5
python -c "import vaex; vaex.from_csv('divisor_sums.csv', convert=True, chunk_size=5_000_000)"

python -m plot.plot_divisor_sums --divisor_sums_hdf5_path=divisor_sums.hdf5
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].