Пример #1
0
                    jg.runtime.rexi_ci_max_imag = 1

                else:
                    jg.runtime.rexi_ci_n = 32
                    jg.runtime.rexi_ci_max_real = 2
                    jg.runtime.rexi_ci_max_imag = 2

                jg.runtime.rexi_ci_mu = 0
                jg.runtime.rexi_ci_primitive = 'circle'

            elif 'etdrk' in jg.runtime.timestepping_method:
                # CI REXI via file input
                jg.runtime.rexi_method = 'file'

                cirexi = CIREXI()
                coeffs_phi0 = cirexi.setup("phi0", N=32, R=2).toFloat()
                coeffs_phi1 = cirexi.setup("phi1", N=32, R=2).toFloat()
                coeffs_phi2 = cirexi.setup("phi2", N=32, R=2).toFloat()
                coeffs_phi3 = cirexi.setup("phi3", N=32, R=2).toFloat()
                jg.runtime.rexi_files_coefficients = [
                    coeffs_phi0, coeffs_phi1, coeffs_phi2, coeffs_phi3
                ]

            else:
                # B REXI via file
                jg.runtime.rexi_method = 'file'

                brexi = BREXI()
                coeffs = brexi.setup(N=8, quadrature_method='gauss').toFloat()
                jg.runtime.rexi_files_coefficients = [coeffs]
Пример #2
0
def get_rexi_benchmarks(jg):

    # Accumulator of all REXI methods
    # rexi_method['rexi_method'] = 'file'               # Choose REXI method which is typically 'file' for all file-based ones
    # rexi_method['rexi_files_coefficients'] = None     # List with approximations for different 'phi' functions
    rexi_methods = []

    #
    # CI REXI
    #
    if True:
        # REXI stuff
        def fun_params_ci_N(ci_max_real, ci_max_imag):
            if ci_max_imag >= 7:
                return 128
            else:
                return 32

        params_ci_max_imag = [30.0]
        params_ci_max_real = [10.0]

        #
        # Scale the CI circle radius relative to this time step size
        # We do this simply to get a consistent time stepping method
        # Otherwise, CI would not behave consistently
        # Yes, that's ugly, but simply how it goes :-)
        #
        params_ci_max_imag_scaling_relative_to_timestep_size = 480
        #params_ci_max_imag_scaling_relative_to_timestep_size = None

        params_ci_min_imag = 5.0

        rexi_method = {}

        # Choose REXI method which is typically 'file' for all file-based ones
        rexi_method['rexi_method'] = 'file'

        # List with approximations for different 'phi' functions
        rexi_method['rexi_files_coefficients'] = None

        for ci_max_imag, ci_max_real in product(params_ci_max_imag,
                                                params_ci_max_real):

            if params_ci_max_imag_scaling_relative_to_timestep_size != None:
                ci_max_imag *= (
                    jg.runtime.timestep_size /
                    params_ci_max_imag_scaling_relative_to_timestep_size)

            # "phi0"
            cirexi = CIREXI(efloat_mode=efloat_mode)
            coeffs_phi0 = cirexi.setup(function_name="phi0",
                                       N=fun_params_ci_N(
                                           ci_max_real, ci_max_imag),
                                       lambda_include_imag=ci_max_imag,
                                       lambda_max_real=ci_max_real).toFloat()

            # "phi1"
            cirexi = CIREXI(efloat_mode=efloat_mode)
            coeffs_phi1 = cirexi.setup(function_name="phi1",
                                       N=fun_params_ci_N(
                                           ci_max_real, ci_max_imag),
                                       lambda_include_imag=ci_max_imag,
                                       lambda_max_real=ci_max_real).toFloat()

            # "phi2"
            cirexi = CIREXI(efloat_mode=efloat_mode)
            coeffs_phi2 = cirexi.setup(function_name="phi2",
                                       N=fun_params_ci_N(
                                           ci_max_real, ci_max_imag),
                                       lambda_include_imag=ci_max_imag,
                                       lambda_max_real=ci_max_real).toFloat()

            rexi_method['rexi_files_coefficients'] = [
                coeffs_phi0, coeffs_phi1, coeffs_phi2
            ]

            # Add to list of REXI methods
            rexi_methods.append(rexi_method)

    return rexi_methods
Пример #3
0
                    jg.runtime.rexi_ci_max_imag = 1

                else:
                    jg.runtime.rexi_ci_n = 32
                    jg.runtime.rexi_ci_max_real = 2
                    jg.runtime.rexi_ci_max_imag = 2

                jg.runtime.rexi_ci_mu = 0
                jg.runtime.rexi_ci_primitive = 'circle'

            elif 0:
                # CI REXI via file input
                jg.runtime.rexi_method = 'file'

                cirexi = CIREXI()
                coeffs = cirexi.setup("phi0", N=32, R=2).toFloat()
                jg.runtime.rexi_files_coefficients = [coeffs]

            else:
                # B REXI via file
                jg.runtime.rexi_method = 'file'

                brexi = BREXI()
                coeffs = brexi.setup(
                    N=8, quadrature_method='gauss_legendre').toFloat()
                jg.runtime.rexi_files_coefficients = [coeffs]

        else:
            jg.runtime.rexi_method = None

        jg.gen_jobscript_directory()
                # CI-REXI: Number of quadrature poles
                N_list = [256, 512]

                # CI-REXI: Value on imaginary axis to be included
                lambda_include_imag_list = [15, 20]

                # CI-REXI: Maximum value of quadrature pole
                lambda_max_real_list = [5, 10]

                for (N, lambda_include_imag,
                     lambda_max_real) in product(N_list,
                                                 lambda_include_imag_list,
                                                 lambda_max_real_list):
                    coeffs = cirexi.setup(
                        function_name=function_name,
                        N=N,
                        lambda_include_imag=lambda_include_imag,
                        lambda_max_real=lambda_max_real).toFloat()
                    jg.runtime.rexi_files_coefficients = [coeffs]
                    jg.gen_jobscript_directory()

                    if True:
                        # Validate with C-implementation of CI-REXI method
                        jg.runtime.rexi_method = "ci"
                        jg.runtime.rexi_ci_n = N
                        jg.runtime.rexi_ci_max_real = lambda_max_real
                        jg.runtime.rexi_ci_max_imag = lambda_include_imag
                        jg.gen_jobscript_directory()

                        # Back to original version
                        jg.runtime.rexi_method = "file"
Пример #5
0
def get_rexi_benchmarks(jg):
    # Accumulator of all REXI methods
    # rexi_method['rexi_method'] = 'file'               # Choose REXI method which is typically 'file' for all file-based ones
    # rexi_method['rexi_files_coefficients'] = None     # List with approximations for different 'phi' functions
    rexi_methods = []

    #for N in [64, 96, 128]:
    for N in [64]:
        #
        # CI REXI
        #
        if False:

            # REXI stuff
            def fun_params_ci_N(ci_max_real, ci_max_imag):
                raise Exception("XXX")
                return 64
                N = max(64, int(75 * ci_max_imag / 30))
                return N

            params_ci_max_imag = [30.0, 15.0]
            params_ci_max_real = [10.0]

            #
            # Scale the CI circle radius relative to this time step size
            # We do this simply to get a consistent time stepping method
            # Otherwise, CI would not behave consistently
            # Yes, that's ugly, but simply how it goes :-)
            #
            params_ci_max_imag_scaling_relative_to_timestep_size = 480
            # params_ci_max_imag_scaling_relative_to_timestep_size = None

            params_ci_min_imag = 5.0

            for ci_max_imag, ci_max_real in product(params_ci_max_imag,
                                                    params_ci_max_real):
                rexi_method = new_rexi_method()

                #if params_ci_max_imag_scaling_relative_to_timestep_size != None:
                #    ci_max_imag *= (jg.runtime.timestep_size / params_ci_max_imag_scaling_relative_to_timestep_size)

                # "phi0"
                cirexi = CIREXI(efloat_mode=efloat_mode)
                coeffs_phi0 = cirexi.setup(
                    function_name="phi0",
                    N=N,
                    #N=fun_params_ci_N(ci_max_real, ci_max_imag),
                    #N=max(64, int(75 * ci_max_imag / 30)),
                    lambda_include_imag=ci_max_imag,
                    lambda_max_real=ci_max_real,
                    half_shifted=True).toFloat()

                # "phi1"
                cirexi = CIREXI(efloat_mode=efloat_mode)
                coeffs_phi1 = cirexi.setup(
                    function_name="phi1",
                    N=N,
                    #N=max(64, int(75 * ci_max_imag / 30)),
                    #N=fun_params_ci_N(ci_max_real, ci_max_imag),
                    lambda_include_imag=ci_max_imag,
                    lambda_max_real=ci_max_real,
                    half_shifted=True).toFloat()

                # "phi2"
                cirexi = CIREXI(efloat_mode=efloat_mode)
                coeffs_phi2 = cirexi.setup(
                    function_name="phi2",
                    N=N,
                    #N=max(64, int(75 * ci_max_imag / 30)),
                    #N=fun_params_ci_N(ci_max_real, ci_max_imag),
                    lambda_include_imag=ci_max_imag,
                    lambda_max_real=ci_max_real,
                    half_shifted=True).toFloat()

                rexi_method['rexi_files_coefficients'] = [
                    coeffs_phi0, coeffs_phi1, coeffs_phi2
                ]

                # Add to list of REXI methods
                rexi_methods.append(rexi_method)

        #
        # EL-REXI
        #
        if True:
            max_imags = [30.0]

            for normalize_rexi in [True, False]:
                for max_imag in max_imags:
                    rexi_method = new_rexi_method()

                    # "phi0"
                    elrexi = ELREXI(efloat_mode=efloat_mode)
                    coeffs_phi0 = elrexi.setup(
                        function_name="phi0",
                        #N=fun_params_ci_N(1, max_imag),
                        N=N,
                        #N=max(64, int(75 * max_imag / 30)),
                        lambda_max_real=10.5,
                        lambda_max_imag=max_imag + 2.5).toFloat()

                    # "phi1"
                    elrexi = ELREXI(efloat_mode=efloat_mode)
                    coeffs_phi1 = elrexi.setup(
                        function_name="phi1",
                        #N=fun_params_ci_N(1, max_imag),
                        N=N,
                        #N=max(64, int(75 * max_imag / 30)),
                        lambda_max_real=10.5,
                        lambda_max_imag=max_imag + 2.5).toFloat()

                    # "phi2"
                    elrexi = ELREXI(efloat_mode=efloat_mode)
                    coeffs_phi2 = elrexi.setup(
                        function_name="phi2",
                        #N=fun_params_ci_N(1, max_imag),
                        N=N,
                        #N=max(64, int(75 * max_imag / 30)),
                        lambda_max_real=10.5,
                        lambda_max_imag=max_imag + 2.5).toFloat()

                    if normalize_rexi:
                        coeffs_phi0.normalize_steady_state()
                        coeffs_phi1.normalize_steady_state()
                        coeffs_phi2.normalize_steady_state()

                    rexi_method['rexi_files_coefficients'] = [
                        coeffs_phi0, coeffs_phi1, coeffs_phi2
                    ]

                    # Add to list of REXI methods
                    rexi_methods.append(rexi_method)

        #
        # LR-REXI (Rectangle contour with Gauss-Legendre Quadrature)
        #
        if False:
            max_imags = [30.0]

            for max_imag in max_imags:
                rexi_method = new_rexi_method()

                # "phi0"
                lrrexi = LRREXI(efloat_mode=efloat_mode)
                coeffs_phi0 = lrrexi.setup(
                    function_name="phi0",
                    width=23,
                    height=2 * max_imag + 20,
                    center=-1,
                    N=N,
                    #N=128
                ).toFloat()

                # "phi1"
                lrrexi = LRREXI(efloat_mode=efloat_mode)
                coeffs_phi1 = lrrexi.setup(
                    function_name="phi1",
                    width=23,
                    height=2 * max_imag + 20,
                    center=-1,
                    N=N,
                    #N=128
                ).toFloat()

                # "phi2"
                lrrexi = LRREXI(efloat_mode=efloat_mode)
                coeffs_phi2 = lrrexi.setup(
                    function_name="phi2",
                    width=23,
                    height=2 * max_imag + 20,
                    center=-1,
                    N=N,
                    #N=128
                ).toFloat()

                rexi_method['rexi_files_coefficients'] = [
                    coeffs_phi0, coeffs_phi1, coeffs_phi2
                ]

                # Add to list of REXI methods
                rexi_methods.append(rexi_method)

        #
        # Bean-REXI
        #
        if False:
            max_imags = [30.0]

            for max_imag in max_imags:
                rexi_method = new_rexi_method()

                # "phi0"
                beanrexi = BeanREXI(efloat_mode=efloat_mode)
                coeffs_phi0 = beanrexi.setup(
                    function_name="phi0",
                    horizontal_radius=16,
                    vertical_radius=max_imag / 30 * 35,
                    center=-2,
                    #N=fun_params_ci_N(1, max_imag),
                    N=N,
                    #N=max(64, int(75 * max_imag / 30))
                ).toFloat()

                # "phi1"
                beanrexi = BeanREXI(efloat_mode=efloat_mode)
                coeffs_phi1 = beanrexi.setup(
                    function_name="phi1",
                    horizontal_radius=16,
                    vertical_radius=max_imag / 30 * 35,
                    center=-2,
                    #N=fun_params_ci_N(1, max_imag),
                    N=N,
                    #N=max(64, int(75 * max_imag / 30))
                ).toFloat()

                # "phi2"
                beanrexi = BeanREXI(efloat_mode=efloat_mode)
                coeffs_phi2 = beanrexi.setup(
                    function_name="phi2",
                    horizontal_radius=16,
                    vertical_radius=max_imag / 30 * 35,
                    center=-2,
                    #N=fun_params_ci_N(1, max_imag),
                    N=N,
                    #N=max(64, int(75 * max_imag / 30))
                ).toFloat()

                rexi_method['rexi_files_coefficients'] = [
                    coeffs_phi0, coeffs_phi1, coeffs_phi2
                ]

                # Add to list of REXI methods
                rexi_methods.append(rexi_method)

    return rexi_methods
Пример #6
0
                    jg.gen_jobscript_directory('job_bench_'+jg.getUniqueID())

                else:

                    raise Exception("This branch shouldn't be taken, yet")

                    jg.runtime.rexi_method = 'file'
                    for ci_max_imag, ci_max_real in product(params_ci_max_imag, params_ci_max_real):

                        if params_ci_max_imag_scaling_relative_to_timestep_size != None:
                            ci_max_imag *= (jg.runtime.timestep_size/params_ci_max_imag_scaling_relative_to_timestep_size)

                        # "phi0"
                        cirexi = CIREXI(efloat_mode = efloat_mode)
                        coeffs_phi0 = cirexi.setup(function_name="phi0", N=fun_params_ci_N(ci_max_real, ci_max_imag), lambda_include_imag=ci_max_imag, lambda_max_real=ci_max_real).toFloat()

                        # "phi1"
                        cirexi = CIREXI(efloat_mode = efloat_mode)
                        coeffs_phi1 = cirexi.setup(function_name="phi1", N=fun_params_ci_N(ci_max_real, ci_max_imag), lambda_include_imag=ci_max_imag, lambda_max_real=ci_max_real).toFloat()

                        # "phi2"
                        cirexi = CIREXI(efloat_mode = efloat_mode)
                        coeffs_phi2 = cirexi.setup(function_name="phi2", N=fun_params_ci_N(ci_max_real, ci_max_imag), lambda_include_imag=ci_max_imag, lambda_max_real=ci_max_real).toFloat()

                        jg.runtime.rexi_files_coefficients = [coeffs_phi0, coeffs_phi1, coeffs_phi2]


                        # Update TIME parallelization
                        ptime = JobParallelizationDimOptions('time')
                        ptime.num_cores_per_rank = 1