• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

WISDEM / WEIS / 12794974524

15 Jan 2025 06:45PM UTC coverage: 77.953% (-0.5%) from 78.492%
12794974524

push

github

dzalkind
Set up MPI

21946 of 28153 relevant lines covered (77.95%)

0.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/weis/glue_code/weis_args.py
1
import argparse
×
2
from openmdao.utils.mpi  import MPI
×
3

4
def weis_args():
×
5

6
    # Set up argument parser
7
    parser = argparse.ArgumentParser(description="Run WEIS driver with flag prepping for MPI run.")
×
8
    # Add the flag
9
    parser.add_argument("--preMPI", type=bool, default=False, help="Flag for preprocessing MPI settings (True or False).")
×
10
    parser.add_argument("--maxnP", type=int, default=1, help="Maximum number of processors available.")
×
11
    # Parse the arguments
12
    args, _ = parser.parse_known_args()
×
13
    # Use the flag in your script
14
    if args.preMPI:
×
15
        print("Preprocessor flag is set to True. Running preprocessing setting up MPI run.")
×
16
    else:
17
        print("Preprocessor flag is set to False. Run WEIS now.")
×
18

19
    return args
×
20

21
def get_max_procs(args):
×
22
    # Set max number of processes, either set by user or extracted from MPI
23
    if args.preMPI:
×
24
        maxnP = args.maxnP
×
25
    else:
26
        if MPI:
×
27
            maxnP = MPI.COMM_WORLD.Get_size()
×
28
        else:
29
            maxnP = 1
×
30
    return maxnP
×
31

32
def set_modopt_procs(modeling_options):
×
33
    print('Applying the modeling option updates as overrides.')
×
34
    modeling_override = {}
×
35
    modeling_override['General'] = {}
×
36
    modeling_override['General']['openfast_configuration'] = {}
×
37
    modeling_override['General']['openfast_configuration']['nFD'] = modeling_options['General']['openfast_configuration']['nFD']
×
38
    modeling_override['General']['openfast_configuration']['nOFp'] = modeling_options['General']['openfast_configuration']['nOFp']
×
39
    return modeling_override
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc