Beispiel #1
0
            for j in range(0, nTimers):
                mean_timers_sec[i, j] = np.mean(timers_sec[i, j, :])
            speedUp[i, :] = mean_timers_sec[0, :] / (mean_timers_sec[i, :])

        print('timers')
        print(mean_timers_sec)

        print('speed up')
        print(speedUp)
        if printPlot:
            fig = plt.figure(figsize=(10, 6))
            plt.plot(np.arange(1, nMaxProcs + 1), np.arange(1, nMaxProcs + 1),
                     '--')
            for j in range(0, nTimers):
                plt.plot(np.arange(1, nMaxProcs + 1),
                         speedUp[:, j],
                         'o-',
                         label=timerNames[j])
            plt.ylabel('speed up')
            plt.xlabel('number of MPI processes')
            plt.grid(True)
            plt.legend()
            plt.savefig('speedup.jpeg', dpi=800)
            plt.close()


if __name__ == "__main__":
    comm = Teuchos.DefaultComm.getComm()
    parallelEnv = Utils.createDefaultParallelEnv(comm)
    main(parallelEnv)
Beispiel #2
0
 def setUpClass(cls):
     cls.comm = Teuchos.DefaultComm.getComm()
     cls.parallelEnv = Utils.createDefaultParallelEnv(cls.comm)
Beispiel #3
0
import numpy as np
from PyAlbany import Utils

# As discussed in example_0.py parallelEnv should be destructed
# after the destruction of all the other variables which rely on
# Kokkos.
# A better way to enforce this than calling the destructor explicitly
# for all the variables is to rely on the garbage collector capability
# of python using the scope of a function.

# At the end of the function all the internal objects (all objects which
# are not inputs or outputs) are destructed.
# Therefore, we can create a function which takes parallelEnv as input in which
# all Kokkos-related objects will be created and will not be passed as output;
# they will necessarily be destructed before parallelEnv.


# This example revisits example_0.py with the above-mentioned approach.
def main(parallelEnv):
    filename = 'input_conductivity_dist_paramT.yaml'
    problem = Utils.createAlbanyProblem(filename, parallelEnv)


if __name__ == "__main__":
    comm = Teuchos.DefaultComm.getComm()
    parallelEnv = Utils.createDefaultParallelEnv(comm,
                                                 n_threads=-1,
                                                 n_numa=-1,
                                                 device_id=-1)
    main(parallelEnv)