Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge tag 'v3_10_rc2'
[simgrid.git] / examples / smpi / energy / f77 / sef.f
1       program main
2       include 'mpif.h'
3
4       integer ierr
5       integer rank, pstates
6       integer i
7       double precision p, t, e
8
9       call MPI_Init(ierr)
10       call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierr)
11
12       pstates = smpi_get_host_nb_pstates()
13
14       t = MPI_Wtime()
15
16       print *, '[', t, '] [rank ', rank, ']',
17      &     pstates, 'pstates available'
18
19       do i = 0, pstates - 1
20          p = smpi_get_host_power_peak_at(i)
21          print *, '[', t, '] [rank ', rank, '] Power: ', p
22       end do
23
24       do i = 0, pstates - 1
25          call smpi_set_host_power_peak_at(i)
26          t = MPI_Wtime()
27          p = smpi_get_host_current_power_peak()
28          print *, '[', t, '] [rank ', rank, '] Current pstate: ', i,
29      &        '; Current power: ', p
30
31          e = 1e9
32          call smpi_execute_flops(e)
33
34          t = MPI_Wtime()
35          e = smpi_get_host_consumed_energy()
36          print *, '[', t, '] [rank ', rank, ']',
37      &        'Energy consumed (Joules): ', e
38       end do
39
40       call MPI_Finalize(ierr)
41
42       end program main