File: bpStepsWriteReadKokkos.F90

package info (click to toggle)
adios2 2.10.2%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,764 kB
  • sloc: cpp: 175,964; ansic: 160,510; f90: 14,630; yacc: 12,668; python: 7,275; perl: 7,126; sh: 2,825; lisp: 1,106; xml: 1,049; makefile: 579; lex: 557
file content (80 lines) | stat: -rw-r--r-- 3,138 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
program TestBPWriteReadHeatMap2D use mpi use adios2

    implicit none

        integer(kind = 8)::sum_i1,
    sum_i2 type(adios2_adios)::adios type(adios2_io)::ioPut, ioGet type(adios2_engine)::bpWriter,
    bpReader type(adios2_variable), dimension(1)::var_g,
    var_gIn

    integer(kind = 2),
    dimension(
        :,
        :),
    allocatable ::g, &sel_g integer(kind = 8),
    dimension(2)::ishape, istart, icount integer(kind = 8),
    dimension(2)::sel_start, sel_count integer ::ierr, irank, isize,
    step_status integer ::in1, in2 integer ::i1,
    i2

    call MPI_INIT(ierr) call MPI_COMM_RANK(MPI_COMM_WORLD, irank, ierr) call
    MPI_COMM_SIZE(MPI_COMM_WORLD, isize, ierr)

        in1 = 3 in2 = 4 icount = (/ in1, in2 /) istart = (/ 0, in2 *irank /) ishape = (/ in1,
                                                                                       in2 *isize /)

            allocate(g(in1, in2)) do i2 = 1,
        in2 do i1 = 1,
        in1 g(i1, i2) = irank + i1 end do end do

                        !Start adios2 Writer call adios2_init(adios, MPI_COMM_WORLD, ierr) call
                        adios2_declare_io(ioPut, adios, 'WriteIO', ierr)

                            call adios2_define_variable(var_g(1), ioPut, &'bpFloats',
                                                        adios2_type_integer2, &2, ishape, istart,
                                                        icount, &adios2_constant_dims, ierr)

                                call
                        adios2_open(bpWriter, ioPut, 'BPFortranKokkos.bp', adios2_mode_write, &ierr)

                            call adios2_put(bpWriter, var_g(1), g, ierr)

                                call adios2_close(bpWriter, ierr)

                                    if (allocated(g)) deallocate(g)

                                        !Start adios2 Reader in rank 0 if (irank == 0) then

                        call adios2_declare_io(ioGet, adios, 'ReadIO', ierr)

                            call adios2_open(bpReader, ioGet, 'BPFortranKokkos.bp',
                                             &adios2_mode_read, MPI_COMM_SELF, ierr)

                                call
                        adios2_begin_step(bpReader, adios2_step_mode_read, -1., &step_status, ierr)

                            call adios2_inquire_variable(var_gIn(1), ioGet, &'bpFloats', ierr)

                                sel_start = (/ 0, 0 /) sel_count = (/ ishape(1), ishape(2) /)

                            allocate(sel_g(ishape(1), ishape(2))) sel_g = 0

        call adios2_set_selection(var_gIn(1), 2, sel_start, sel_count, &ierr) call
        adios2_get(bpReader, var_gIn(1), sel_g, ierr)

            call adios2_end_step(bpReader, ierr)

                call adios2_close(bpReader, ierr)

                    do i2 = 1,
        INT(sel_count(2), 4) do i1 = 1,
        INT(sel_count(1), 4) write(6, "(i8)", advance = "no") sel_g(i1, i2) end do write(6, *) end
    do

    if (allocated(sel_g)) deallocate(sel_g)

        end if

    call adios2_finalize(adios, ierr) call MPI_Finalize(ierr)

        end program TestBPWriteReadHeatMap2D