Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
c76f35d
add .exe to wrapper to fit windows default behavior
Aug 13, 2024
4efb3c2
minor tweak on printing process
Aug 13, 2024
d114c1e
remove useless.zip after extracting it
Aug 14, 2024
a8c6bc2
add -f to rm zip so it doesnt ask a confirmation question
Aug 14, 2024
8157329
add support for specific VERSION with git var SPECIFIED_VERSION
Aug 14, 2024
0360810
add debung print
Aug 14, 2024
1e98ac3
hardcoded version
Aug 14, 2024
781e8e3
hardcoded version
Aug 14, 2024
16124f6
try to add sig files to app zip
Aug 15, 2024
ae4b183
add more print
Aug 15, 2024
3f32128
fix unzip option
Aug 15, 2024
46a5aa9
up version to 1.08
Aug 15, 2024
4f4d098
added sig
Aug 15, 2024
3b1cd17
up version
Aug 15, 2024
16dc6ff
remove duplicates
Aug 16, 2024
41e0947
up version
Aug 16, 2024
438b665
try adding dll
Aug 16, 2024
a274fbb
try to reinstate LIReC_EXE
Aug 17, 2024
902b892
fix wrapper
Aug 17, 2024
4e23ba4
version 1.14
Aug 17, 2024
9031d47
minor cleanups
Aug 17, 2024
a923850
update app.zip
Aug 18, 2024
498e226
up version
Aug 18, 2024
2d5912b
minor cleanups and try to run LIReC bare
Aug 19, 2024
cbe713b
remove threading and add prints
Aug 19, 2024
2bd6475
minor print tweaks
Aug 19, 2024
c32843f
up version
Aug 20, 2024
6e33bfe
try to print in stderr
Aug 20, 2024
e863aac
try to print in file
Aug 20, 2024
3a4760b
use stderr.txt in a hope it will be sent to logs db
Aug 21, 2024
4fb23d4
version up
Aug 21, 2024
11bc89c
try to print json in stdin
Aug 23, 2024
c3a8f02
try to pass and print json
Aug 27, 2024
7ae483c
try to open config file
Aug 27, 2024
70b0ba7
up version
Aug 27, 2024
6637c14
adding flush to print
Aug 27, 2024
9de8da0
try to fix version number
Aug 27, 2024
4a78412
re fix version to 1.22
Aug 27, 2024
0ee47be
up to 1.23
Aug 27, 2024
5607896
up to 1.24
Aug 28, 2024
5a824d6
remove flush and up version
Aug 28, 2024
a523079
try to use proper config from json (and add validation)
Aug 29, 2024
564e8dc
up version to 1.26
Aug 29, 2024
a2b76c3
update json format
Aug 30, 2024
51485d1
up to 1.27
Aug 30, 2024
b5f7681
add print in job_poly_pslq_v1 to make sure the json config file is be…
Sep 2, 2024
01275a2
add a bunch of prints and flush
Sep 3, 2024
00bb75f
1.29
Sep 3, 2024
7bc4a4a
write results in json file and add prints
Sep 3, 2024
e6a6dc2
up version and add a 404 on errer in result
Sep 4, 2024
8e539dd
up version and add turn off async
Sep 5, 2024
f9e3ab3
multiprocessing "removed"
itaybthl Sep 9, 2024
0ff6b83
git pull removed fork
Sep 9, 2024
f98420e
1.33
Sep 9, 2024
725e300
restored logging for "no multiprocessing"
itaybthl Sep 10, 2024
6ddac3d
up version
Sep 10, 2024
fccd80d
KeyboardInterrupt fix
itaybthl Sep 10, 2024
894ba31
ValueError fix
itaybthl Sep 10, 2024
63f42ed
iterations default changed to 1
itaybthl Sep 10, 2024
c9a0169
reverted test code
itaybthl Sep 10, 2024
10010d1
git pull / fix conflict
Sep 11, 2024
27dcf9e
up version
Sep 11, 2024
0658cf9
job imports are now hardcoded
itaybthl Sep 11, 2024
70b1d3b
now the hardcoded import works
itaybthl Sep 11, 2024
68b126b
Merge remote-tracking branch 'upstream/main' into LIReC-1-Robin--upda…
Sep 11, 2024
36c66cc
up version and update _import
Sep 11, 2024
0184e31
try to add gmpy2 to cx_freeze, up version
Sep 11, 2024
3bcee8c
job_poly_pslq_v1 minor fixes
itaybthl Sep 11, 2024
3bed7a2
try update gmpy version
Sep 12, 2024
a6a905b
uploading test version
itaybthl Sep 16, 2024
11822d3
pull Itay's update to trigger new relations to test results processing
Sep 16, 2024
d8373fa
up version
Sep 16, 2024
4bf21fd
job_poly_pslq_v1 bugfix
itaybthl Sep 24, 2024
bfb6a0c
fixed logging in job_poly_pslq_v1
itaybthl Sep 24, 2024
4aebff7
Merge remote-tracking branch 'upstream/main' into LIReC-1-Robin--upda…
Sep 24, 2024
4c0ba9c
up version and pull result update
Sep 24, 2024
f1de0c4
less keep alive prints please
itaybthl Sep 24, 2024
6e79834
fig git conflict
Sep 24, 2024
c57e69e
up version
Sep 24, 2024
70dcb95
try fix version, remove some logs
Sep 25, 2024
c916bc7
revert versioning
Sep 25, 2024
9459614
PolyPSLQRelation.to_json
itaybthl Sep 26, 2024
c5e94be
fix to PreciseConstant.to_json with no symbol
itaybthl Sep 26, 2024
7b60475
Merge remote-tracking branch 'upstream/main' into LIReC-1-Robin--upda…
Sep 26, 2024
bafd4e3
test version fix and add json format to results to be pushed
Sep 26, 2024
a651e0f
revert versioning
Sep 26, 2024
a110b72
version up + only return 1 result
Sep 26, 2024
0e7dcfd
up version, only print/write 3 results to test
Sep 27, 2024
a5dc79d
implemented pcf_search in identify
itaybthl Oct 1, 2024
e0fdd72
version fix and cleanup
Oct 11, 2024
1fb98af
roll old versioning script
Oct 11, 2024
21e69c4
roll old versioning script
Oct 11, 2024
fc0f545
add workflow_dispatch:
Oct 11, 2024
0e9b851
add debug print
Oct 11, 2024
f0e03a4
add debug print
Oct 11, 2024
368cfda
add debug print
Oct 11, 2024
3fd38f5
try to desiable github UI prompt for env var
Oct 11, 2024
9680540
reverting test code
itaybthl Oct 14, 2024
ec89f20
fix git conflict
Oct 14, 2024
36c6759
cleanup code
Oct 14, 2024
d101cbc
add documentation about BOINC process
Oct 15, 2024
e08d05e
update doc
Oct 16, 2024
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
20 changes: 0 additions & 20 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,10 @@ jobs:
strategy:
matrix:
runner:
# - ubuntu-latest
# - macos-latest
- windows-latest
include:
# - runner: ubuntu-latest
# # we use this platform string to make our download artifacts unique for the same version across platforms
# platform: 'linux'
- runner: windows-latest
# we use this platform string to make our download artifacts unique for the same version across platforms
platform: 'win'
# - runner: macos-latest
# # we use this platform string to make our download artifacts unique for the same version across platforms
# platform: 'mac'
steps:
- name: "Checkout repository"
# https://github.com/actions/checkout
Expand Down Expand Up @@ -100,20 +91,11 @@ jobs:
strategy:
matrix:
platform:
# - linux
# - mac
- win
include:
# - platform: 'linux'
# # These wrappers come from BOINC and should be watched for newer versions: https://boinc.berkeley.edu/dl/?C=M;O=D
# wrapper: 'wrapper_26002_x86_64-pc-linux-gnu'
# boinc_platform: 'x86_64-pc-linux-gnu'
- platform: 'win'
wrapper: 'wrapper_26016_windows_x86_64'
boinc_platform: 'windows_x86_64'
# - platform: 'mac'
# wrapper: 'wrapper_26017_universal-apple-darwin'
# boinc_platform: 'arm64-apple-darwin'

cleanup:
needs: [bundle-and-deploy]
Expand All @@ -124,7 +106,5 @@ jobs:
name: |
version
freeze_config.py
# linux
# mac
win
failOnError: false
15 changes: 12 additions & 3 deletions .github/workflows/bundle_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,13 @@ jobs:
with:
name: ${{ env.PLATFORM }}
path: app.${{ env.NEW_VERSION }}-${{ env.PLATFORM }}
- name: "Zip build output"
- name: "sign binary and Zip build output"
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
run: |
zip -r app.$NEW_VERSION-$PLATFORM.zip app.$NEW_VERSION-$PLATFORM
echo "$SIGNING_KEY" > key
cd app.$NEW_VERSION-$PLATFORM
zip -r ../app.$NEW_VERSION-$PLATFORM.zip .
- name: "Sign files"
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
Expand All @@ -96,6 +100,8 @@ jobs:
- name: "Create app bundle (Windows)"
if: ${{ inputs.platform == 'win' }}
run: |
# Exclude the WRAPPER.exe and WRAPPER.exe.sig from this zip because they are included in app.$NEW_VERSION-$PLATFORM.zip
# Including them again could cause issues with duplicate entries when updating versions on the BOINC server.
zip -r --junk-paths $BOINC_PLATFORM.zip . -i version.xml job.$NEW_VERSION-$PLATFORM.xml job.$NEW_VERSION-$PLATFORM.xml.sig $WRAPPER.exe $WRAPPER.exe.sig app.$NEW_VERSION-$PLATFORM.zip app.$NEW_VERSION-$PLATFORM.zip.sig
- name: "Create app bundle (non-Windows)"
if: ${{ inputs.platform != 'win' }}
Expand Down Expand Up @@ -141,7 +147,10 @@ jobs:
- name: 'Unpack binaries'
if: ${{ ! vars.DO_NOT_DEPLOY }}
run: |
ssh boinc 'sudo su - boincadm -c "cd /home/boincadm/projects/boinc/apps/${{env.APP_DIR}}/${{env.NEW_VERSION}} && unzip -o -q -d ${{env.BOINC_PLATFORM}} ${{env.BOINC_PLATFORM}}.zip"'
ssh boinc 'sudo su - boincadm -c "cd /home/boincadm/projects/boinc/apps/${{env.APP_DIR}}/${{env.NEW_VERSION}} && ls && unzip -o -q -d ${{env.BOINC_PLATFORM}} ${{env.BOINC_PLATFORM}}.zip && rm -f ${{env.BOINC_PLATFORM}}.zip && ls"'
#ssh boinc 'sudo su - boincadm -c "cd /home/boincadm/projects/boinc/apps/${{env.APP_DIR}}/${{env.NEW_VERSION}}/${{env.BOINC_PLATFORM}} && ls && unzip -o -q app.${{env.NEW_VERSION}}-${{inputs.platform}}.zip && ls "'
#ssh boinc 'sudo su - boincadm -c "cd /home/boincadm/projects/boinc/apps/${{env.APP_DIR}}/${{env.NEW_VERSION}}/${{env.BOINC_PLATFORM}} && ls && unzip -o -q app.${{env.NEW_VERSION}}-${{inputs.platform}}.zip && ls && mv app.${{env.NEW_VERSION}}-${{inputs.platform}}/* . && ls"'

- name: 'Run BOINC update versions'
if: ${{ ! vars.DO_NOT_DEPLOY }}
run: |
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/identify_target_version.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: 'Identify Target Version'

on:
workflow_dispatch:
inputs:
boinc_app_description:
description: 'The BOINC app "description" value from the BOINC server / database'
default: 'LIReC using BOINC instead of AWS'
required: false
type: string
workflow_call:
inputs:
boinc_app_description:
Expand Down Expand Up @@ -28,7 +35,7 @@ jobs:
env:
BOINC_APP_DESCRIPTION: ${{ inputs.boinc_app_description }}
run: |
VERSION=$(sed -n "/<th class=\"bg-primary\" colspan=4>$(printf '%s\n' "$BOINC_APP_DESCRIPTION" | sed 's/[\^$.|?*+(){}]/\\&/g')<\/th>/,/<td>\([0-9].[0-9]\)/p" apps.php | sed -n 's/.*<td>\([0-9][0-9]*\.[0-9]*\)<\/td>.*/\1/ p')
VERSION=$(sed -n "/<th class=\"bg-primary\" colspan=4>$(printf '%s\n' "$BOINC_APP_DESCRIPTION" | sed 's/[\^$.|?*+{}]/\\&/g')<\/th>/,/<td>\([0-9].[0-9]\)/p" apps.php | sed -n 's/.*<td>\([0-9][0-9]*\.[0-9]*\)<\/td>.*/\1/ p')
if [ -z "$VERSION" ]; then
VERSION="1.0"
fi
Expand Down
57 changes: 57 additions & 0 deletions BOINC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# LIReC Application on BOINC

## Configuration and Execution Overview

The LIReC application, as configured for the BOINC platform, operates primarily through JSON configuration files that specify the behavior and parameters for each computational job. Here's how the system works:

### JSON Configuration

- **Input**: A JSON file is passed as a parameter when initiating a job. The content of this file is used to configure the specifics of the computation.
- **Fallback**: If the provided JSON configuration is invalid or cannot be parsed, the system will revert to using a hardcoded configuration defined in `config.py`.

### Output and Results Handling

- **Output File**: The results of new relations discovered during the computation (up to 3 per job) are written to `output.json`. This file is then fetched by BOINC to send the results back to the server.

### File and Job Management

- **Input Files Directory**: All JSON configuration files should be placed in:
```
/home/boincadm/projects/boinc/data/lirec_input
```

This directory contains the list of JSON files that will be used to configure the LIReC jobs.

- **Job Launching**:
- Navigate to the directory:
```
/home/boincadm/projects/boinc/bin
```
- Execute the command:
```
./tasks_avail_workgen_lirec
```
This script will launch a job for each JSON file found in the `data/lirec_input` directory and subsequently clear the folder.

### Monitoring and Retrieving Results

- **Job Tracking**: You can navigate to the following URL to monitor the jobs:
https://rnma.xyz/1b50635216bc11eca7a35f5cf61fb0ec/db_action.php?table=workunit&appid=7&detail=low

Here, the name of the result file for each job will be listed under the "XML doc out" section.

- **Results Retrieval**:
- On the BOINC server, navigate to the upload folder and use the following command to find the result file:
```
find . -type f -name "lirec_wu_20240927_1541_config_60_0_r156311_0"
```
Replace `"lirec_wu_20240927_1541_config_60_0_r156311_0"` with the actual name of your result file as listed on the job tracking page.

- **Result Contents**: Reading the specified result file will provide a list of results that the job discovered.

### Application Version Handling

- **Version Check**: The `tasks_avail_workgen_lirec` script checks for the latest version of the application to ensure compatibility.
- **Version Compatibility**: If the version of the application is unknown or not listed, the job will not be executed, ensuring that only compatible versions process jobs.

Ensure that all configurations and executable scripts are properly set up and that the correct permissions are in place to execute and modify files as described.
74 changes: 52 additions & 22 deletions LIReC/db/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from collections import namedtuple
from decimal import Decimal, getcontext
from functools import reduce
from itertools import combinations
from itertools import combinations, product
from sympy import Symbol, parse_expr
from sqlalchemy import create_engine
from sqlalchemy.exc import IntegrityError
Expand Down Expand Up @@ -50,11 +50,11 @@ class DBConnection:
db_name: str

def __init__(self):
self.host = 'database-1.c1keieal025m.us-east-2.rds.amazonaws.com'
self.host = 'rmdb.cluster-czg4ecmu66lx.us-east-2.rds.amazonaws.com'
self.port = 5432
self.user = 'spectator_public'
self.passwd = 'helloworld123'
self.db_name = 'lirec-main'
self.db_name = 'lirec'

def __str__(self):
return f'postgresql://{self.user}:{self.passwd}@{self.host}:{self.port}/{self.db_name}'
Expand Down Expand Up @@ -249,7 +249,7 @@ def get_actual_pcfs(self) -> List[PCF]:
"""
return [PCF.from_canonical_form(c) for c in self.canonical_forms()]

def identify(self, values, degree=2, order=1, min_prec=None, min_roi=2, isolate=0, strict=False, wide_search=False, see_also=False, verbose=False):
def identify(self, values, degree=2, order=1, min_prec=None, min_roi=2, isolate=0, strict=False, wide_search=False, pcf_search=False, see_also=False, verbose=False):
if not values: # SETUP - organize values
return []
numbers, named, pcfs = {}, {}, {}
Expand Down Expand Up @@ -307,7 +307,7 @@ def identify(self, values, degree=2, order=1, min_prec=None, min_roi=2, isolate=
res = check_consts(list(numbers.values()), degree, order, min_prec, min_roi, False, verbose)
if res:
cond_print(verbose, 'Found relation(s) between the given numbers without using the named constants!')
elif not named and not wide_search:
elif not (named or wide_search or pcf_search):
cond_print(verbose, 'No named constants were given, and the given numbers have no relation. Consider running with wide_search=True to search with all named constants.')
return []

Expand All @@ -329,30 +329,60 @@ def identify(self, values, degree=2, order=1, min_prec=None, min_roi=2, isolate=
res = check_consts(numbers, degree, order, min_prec, min_roi, strict, verbose)

extra = None
if not res and wide_search: # STEP 3 - wide search
if not res and (wide_search or pcf_search): # STEP 3 - wide search
try: # if it's a generator, convert it first
wide_search = set(wide_search)
except:
pass
consts = [PreciseConstant(c.base.value, c.base.precision, c.name) for c in names]
sizes = sorted(wide_search) if isinstance(wide_search, set) else [1] # no more unbounded searches!
cond_print(verbose, 'Preparing for wide search...')
consts = [numbers]
if pcf_search:
if pcf_search == True:
pcf_search = [-1, -1, -1]
pcf_search = pcf_search[:3]
pcf_search += [-1] * (3 - len(pcf_search))
cond_print(verbose, 'Filtering continued fractions... this may take a few seconds')
res = []
maxcoeff, maxdega, maxdegb = pcf_search
for canonical in db.cfs:
pcf = PCF.from_canonical_form((canonical.P, canonical.Q))
if canonical.convergence != models.PcfConvergence.RATIONAL.value \
and canonical.base.precision >= min_prec \
and (maxcoeff < 0 or all(abs(c) <= maxcoeff for c in pcf.a.coeffs() + pcf.b.coeffs())) \
and (maxdega < 0 or pcf.a.degree() <= maxdega) \
and (maxdegb < 0 or pcf.b.degree() <= maxdegb):
res += [PreciseConstant(canonical.base.value, canonical.base.precision, str(pcf))]
consts += [res]
sizes = [0]
nameds = []
if wide_search:
sizes = sorted(wide_search) if isinstance(wide_search, set) else [1] # no more unbounded searches!
nameds = [PreciseConstant(c.base.value, c.base.precision, c.name) for c in names]
original_symbols = {n.symbol for n in numbers}
cond_print(verbose, 'Wide search beginning (PSLQ verbose prints are suppressed during the wide search!)')
for i in sizes:
cond_print(verbose, f'Searching subsets of size {i}')
for subset in combinations(consts, i):
if any(c for c in subset if c.symbol=='C_10'): # TODO temporarily ignore champernowne, it's causing too many false positives
continue
to_test = numbers + list(subset)
min_prec = min(v.precision for v in to_test)
res = check_consts(to_test, degree, order, min_prec, min_roi, False, False) # too much printing!
res = [r for r in res if {c.symbol for c in r.constants} & original_symbols]
go = True
if wide_search and pcf_search:
print('WARNING: You are about to start a huge search, involving both fundamental constants and continued fractions.')
print('This search can take a very long time! If you know what you\'re doing, input Y to continue.')
if input() != "Y":
go = False
if go:
cond_print(verbose, 'Wide search beginning (PSLQ verbose prints are suppressed during the wide search!)')
for i in sizes:
cond_print(i > 0 and verbose, f'Searching subsets of size {i}')
for subset in product(combinations(nameds, i), *consts):
subset_nameds, *subset_rest = subset
to_test = list(subset_nameds) + subset_rest
if any(c for c in to_test if c.symbol=='C_10'): # TODO temporarily ignore champernowne, it's causing too many false positives
continue
min_prec = min(v.precision for v in to_test)
res = check_consts(to_test, degree, order, min_prec, min_roi, False, False) # too much printing!
res = [r for r in res if {c.symbol for c in r.constants} & original_symbols]
if res:
if wide_search and see_also:
extra = self.relations_with(to_test[0].symbol, degree, order)
break
if res:
if see_also:
extra = self.relations_with(subset[0].symbol, degree, order)
break
if res:
break

if isolate != None and not (isolate is False): # need to differentiate between 0 and False
isolate = named[0].symbol if (isolate is True) and named else isolate
Expand Down
8 changes: 5 additions & 3 deletions LIReC/db/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@
from os import system
from LIReC.db.access import connection, db
from LIReC.db.models import NamedConstant, Constant
from LIReC.lib.calculator import Constants
from LIReC.lib.calculator import Constants, Universal

if __name__ == '__main__':
oldname = connection.db_name
connection.db_name = 'postgres'
system(f'psql {connection} < LIReC/db/create.sql')
connection.db_name = oldname

precision = 4000
precision = 16000
print(f'Using {precision} digits of precision')
Constants.set_precision(precision)
for const in Constants.__dict__.keys():
if const[0] == '_' or const == 'set_precision':
continue
print(f'Adding named constant {const}')
db.session.add(Universal.calc_named(const, True, True))
if 'CAUTION' in Constants.__dict__[const].__get__(0).__doc__: Constants.set_precision(precision // 4)
else: Constants.set_precision(precision)
db.session.add(Universal.calc_named(const, None, True, True))

from mpmath import zeta

Expand Down
1 change: 1 addition & 0 deletions LIReC/db/create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ CREATE ROLE spectator WITH
NOCREATEROLE
NOREPLICATION;

GRANT ALL ON SCHEMA public TO spectator;
GRANT SELECT ON constant TO spectator;
GRANT SELECT ON constant_in_relation TO spectator;
GRANT SELECT, REFERENCES ON named_constant TO spectator;
Expand Down
20 changes: 4 additions & 16 deletions LIReC/jobs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,13 @@
'jobs_to_run': [
('poly_pslq_v1', {
'args': { 'degree': 5, 'order': 2, 'bulk': 1000, 'filters': {
'global': { 'min_precision': 50 },
'global': { 'min_precision': 100 },
'PcfCanonical': { 'count': 2, 'balanced_only': False },
'Named': { 'count': 1, 'addons': ['pi*e'] }
}
},
'run_async': True,
'async_cores': 2
}),#,
#'poly_pslq_v2', {
# 'args': {
# 'degree': 2, 'order': 1,
# 'min_precision': 50, 'min_roi': 2,
# 'testing_precision': 15, # replaces min_precision when fed to pslq
# 'bulk': 10, # if testing lots of constants, can instead limit discovery to 'bulk' constants at a time until no relevant relation is found, then another 'bulk' constants are added
# #'filters': { # the existence of filters disables antirelation logging
# # 'PcfCanonical': { 'balanced_only': True }
# #}
# },
# 'run_async': True,
# 'iterations': 1
'run_async': False,
'async_cores': 1
})
]
}
Loading