Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/hpc-maths/GenEO
21 May 2024, 17:50:58 UTC
  • Code
  • Branches (7)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/github-services/pull/1/head
    • refs/github-services/pull/2/head
    • refs/github-services/pull/3/head
    • refs/heads/PCAWG
    • refs/heads/elasticity-x
    • refs/heads/master
    • refs/heads/matis
    No releases to show
  • 797efd3
  • /
  • demos
  • /
  • run_test_cases.py
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:b00a45a69a6a769a4c65adce2d91f1639a403ce4
origin badgedirectory badge
swh:1:dir:841670cc903e9984d8d1077b0b627c0dd7b95b00
origin badgerevision badge
swh:1:rev:885ab129b2402c353548bcfc51214f608f09bade
origin badgesnapshot badge
swh:1:snp:5600c58bc442523ff2d2f69616f3f4483ec0d504

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 885ab129b2402c353548bcfc51214f608f09bade authored by Loic Gouarin on 02 December 2022, 12:34:47 UTC
add fenics example and update environment.yml
Tip revision: 885ab12
run_test_cases.py
import os
import sys
import subprocess
from textwrap import dedent

def run_simu(path, nxdomains, nydomains, n, E1, E2, nu1, nu2, stripe_nb, taueigmax, Aposrtol, neigs, option):


    with open('options.txt', 'w') as f:
        f.writelines(dedent(f"""
        -E1 {E1}
        -E2 {E2}
        -nu1 {nu1}
        -nu2 {nu2}
        -Lx {nxdomains}
        -Ly {nydomains}
        -n {n}
        -stripe_nb {stripe_nb}
        -test_case {path}
        {option}
        -PCBNN_verbose False
        -PCBNN_GenEO_verbose False
        -PCNew_view True
        -PCBNN_view True
        -PCBNN_GenEO True
        -PCNew_GenEO True
        -PCNew_ComputeRitzApos True
        -PCBNN_GenEO_taueigmax {taueigmax}
        -PCBNN_GenEO_taueigmin 0.1
        -PCBNN_GenEO_nev {neigs}
        -ksp_Apos_ksp_converged_reason
        -ksp_Apos_ksp_rtol {Aposrtol}
        -computeRitz True
        -global_ksp_ksp_monitor_true_residual
        -global_ksp_ksp_rtol 1e-10
        -global_ksp_ksp_converged_reason
        -global_ksp_ksp_max_it 150
        -PCNew_viewV0 False
        -PCNew_viewGenEO False
        -PCNew_viewminV0 False
        -PCNew_viewnegV0 False
        -PCBNN_viewV0 False
        -PCBNN_viewGenEO False
        -PCBNN_viewminV0 False
        -PCBNN_kscaling False
        """))

    print(f"mpiexec -np {nxdomains*nydomains} --oversubscribe python demo_AGenEO_2d.py -options_file options.txt")
    result = subprocess.run(["mpiexec", "-np", f"{nxdomains*nydomains}", "--oversubscribe", "python", "./demo_AGenEO_2d.py", "-options_file", "options.txt"], capture_output=True)
    if result.stderr:
        with open(f"{path}/stderr_execution.txt", 'w') as f:
            f.write(result.stderr.decode('utf-8'))
    with open(f"{path}/output_execution.txt", 'w') as f:
        f.write(result.stdout.decode('utf-8'))
    # os.system(f"mpiexec -np {ndomains} --oversubscribe python ./demo_AGenEO_2d.py -options_file options.txt")


case = 7

if case == 1:
    nxdomains= [3]
    nydomains= [3]
    n = [21]#, 42]
    Aposrtol = [1e-10]
    E1 = [1e11]
    E2 = [1e7]
    neigs = 30
    taueigmax = [0, 1e-3, 1e-2, 5e-2, 1e-1, 0.2, 0.5]
    stripe_nb = [2]
    nu1 = [0.3]*len(E1)
    nu2 = [0.3]*len(E1)
elif case == 2:
    nxdomains= [3]
    nydomains= [3]
    n = [21]#, 42]
    Aposrtol = [1e-10]
    E1 = [1e11]
    E2 = [1e11]
    neigs = 30
    taueigmax = [5e-2]
    stripe_nb = [0]
    nu1 = [0.2, 0.3, 0.35, 0.4, 0.45, 0.49]
    nu2 = nu1
    E1 = [1e11]*len(nu1)
    E2 = [1e11]*len(nu2)
elif case == 3:
    nxdomains= [3]
    nydomains= [3]
    Aposrtol = [1e-10]
    E1 = [1e11, 1e11, 1e11, 1e11, 1e9,  1e7,  1e5]
    E2 = [1e5, 1e7,  1e9,  1e11, 1e11, 1e11, 1e11]
    neigs = 30
    taueigmax = [0.1]
    stripe_nb = [2]
    n = [21]#, 42]
    nu1 = [0.3]*len(E1)
    nu2 = [0.3]*len(E1)
elif case == 4: #options takes several values (see below)
    nxdomains= [3]
    nydomains= [3]
    E1 = [1e11]
    E2 = [1e7]
    Aposrtol = [1e-10]
    neigs = 20
    taueigmax = [0.1]
    stripe_nb = [2]
    n = [21]#, 42]
    nu1 = [0.3]*len(E1)
    nu2 = [0.3]*len(E1)
elif case == 5: #options takes several values (see below)
    nxdomains= [3]
    nydomains= [3]
    E1 = [1e11]
    E2 = [1e7]
    #Aposrtol = [1e-10, 1e-8, 1e-6, 1e-4, 1e-2]
    Aposrtol = [5e-2, 1e-1, 5e-1, 9e-1]
    neigs = 20
    taueigmax = [0.1]
    stripe_nb = [2]
    n = [21]#, 42]
    nu1 = [0.3]*len(E1)
    nu2 = [0.3]*len(E1)
elif case == 6:
    nxdomains= [3]
    nydomains= [3]
    Aposrtol = [1e-10]
    E1 = [1e11]
    E2 = [1e7]
    neigs = 30
    taueigmax = [0.1]
    #stripe_nb = [0, 1, 2, 3, 4] #4 will set E = E2
    n = [21]#, 42]
    nu1 = [0.3]*len(E1)
    nu2 = [0.3]*len(E1)
elif case == 7:
    nxdomains= [2,4,8,15,29]
    nydomains= [1]*len(nxdomains)
    Aposrtol = [1e-10]
    E1 = [1e11]
    E2 = [1e7]
    neigs = 30
    taueigmax = [0.1]
    stripe_nb = [2] #4 will set E = E2
    n = [14]#, 42]
    nu1 = [0.3]*len(E1)
    nu2 = [0.3]*len(E1)
elif case == 8: #options takes several values (see below)
    nxdomains= [3]
    nydomains= [3]
    E1 = [1e11]
    E2 = [1e7]
    #Aposrtol = [1e-10, 1e-8, 1e-6, 1e-4, 1e-2]
    Aposrtol = [5e-2, 1e-1, 5e-1, 9e-1]
    neigs = 20
    taueigmax = [0.1]
    stripe_nb = [2]
    n = [21]#, 42]
    nu1 = [0.4]*len(E1)
    nu2 = [0.4]*len(E1)
if case == 9:
    nxdomains= [3]
    nydomains= [3]
    n = [21]#, 42]
    Aposrtol = [1e-10]
    E1 = [1e11]
    E2 = [1e7]
    neigs = 30
    taueigmax = [0, 1e-3, 1e-2, 5e-2, 1e-1, 0.2, 0.5]
    stripe_nb = [2]
    nu1 = [0.4]*len(E1)
    nu2 = [0.4]*len(E1)


if case != 4:
    PCNew_options = [('pcnew', "-PCNew True \n-PCNew_switchtoASM False \n-PCNew_switchtoASMpos False \n-PCNew_H2CoarseProjection True \n-PCNew_H3CoarseProjection False"),
                    ('pcbnn', "-PCNew False \n-PCBNN_switchtoASM False \n-PCBNN_CoarseProjection True"),
    ]
else:
    PCNew_options = [#('pcnew_NNhyb_ad', "-PCNew True \n-PCNew_switchtoASM False \n-PCNew_switchtoASMpos False \n-PCNew_H2CoarseProjection True \n-PCNew_H3CoarseProjection False"),
                     #('pcnew_AShyb_ad', "-PCNew True \n-PCNew_switchtoASM True \n-PCNew_switchtoASMpos False \n-PCNew_H2CoarseProjection True \n-PCNew_H3CoarseProjection False"),
                     #('pcnew_ASposhyb_ad', "-PCNew True \n-PCNew_switchtoASM False \n-PCNew_switchtoASMpos True \n-PCNew_H2CoarseProjection True \n-PCNew_H3CoarseProjection False"),
                     #('pcnew_ASposad_ad', "-PCNew True \n-PCNew_switchtoASM False \n-PCNew_switchtoASMpos True \n-PCNew_H2CoarseProjection False \n-PCNew_H3CoarseProjection False"),
                     ('pcnew_NNhyb_hyb', "-PCNew True \n-PCNew_switchtoASM False \n-PCNew_switchtoASMpos False \n-PCNew_H2CoarseProjection True \n-PCNew_H3CoarseProjection True"),
                     #('pcnew_AShyb_hyb', "-PCNew True \n-PCNew_switchtoASM True \n-PCNew_switchtoASMpos False \n-PCNew_H2CoarseProjection True \n-PCNew_H3CoarseProjection True"),
                     #('pcnew_ASposhyb_hyb', "-PCNew True \n-PCNew_switchtoASM False \n-PCNew_switchtoASMpos True \n-PCNew_H2CoarseProjection True \n-PCNew_H3CoarseProjection True"),
                     #('pcnew_ASposad_hyb', "-PCNew True \n-PCNew_switchtoASM False \n-PCNew_switchtoASMpos True \n-PCNew_H2CoarseProjection False \n-PCNew_H3CoarseProjection True"),
                     #('pcbnn_AShyb', "-PCNew False \n-PCBNN_switchtoASM True \n-PCBNN_CoarseProjection True"),
                     #('pcbnn_ASad', "-PCNew False \n-PCBNN_switchtoASM True \n-PCBNN_CoarseProjection False"),
                     #('pcbnn_NNhyb', "-PCNew False \n-PCBNN_switchtoASM False \n-PCBNN_CoarseProjection True"),
                    #  ('pcbnn_AS_onelevel', "-PCNew False \n-PCBNN_switchtoASM True \n-PCBNN_CoarseProjection False \n  -PCBNN_addCoarseSolve False "),
    ]

if not os.path.exists('output.d'):
    os.mkdir('output.d')

id = 0
for nn in n:
    for nx, ny in zip(nxdomains, nydomains):
        for io, (name, option) in enumerate(PCNew_options):
            for s in stripe_nb:
                for tau in taueigmax:
                    for rtol in Aposrtol:
                        for i in range(len(E1)):
                            path = f'output.d/case_{case}_{name}_' + '_'.join([str(el) for el in [nx, ny, nn, E1[i], E2[i], nu1[i], nu2[i], s, tau, rtol]])

                            if not os.path.exists(path):
                                os.mkdir(path)

                            with open(os.path.join(path, 'name.txt'), 'w') as f:
                                f.write(name)

                            run_simu(path, nx, ny, nn, E1[i], E2[i], nu1[i], nu2[i], s, tau, rtol, neigs, option)
                            id += 1

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API