Skip to content

Problem with dimension of size 1 #67

@clementval

Description

@clementval

There is a weird read behavior when you have a multi-dimensional field with some dimensions of size 1. In the example below, we just serialize a 2d field with the first dimension of size 1.
The serialized data seems to be right but when they are read again they are wrong. I suspect a problem in the Fortran interface.

PROGRAM main_producer
  IMPLICIT NONE
  REAL(KIND=8), DIMENSION(1,256) :: a
  INTEGER :: i

  DO i = 1, 256
    a(1,i) = i
  END DO

  PRINT *, 'CALL serialize with sum(a)=', sum(a)

  !$ser init directory='.' prefix='SerialboxTest'
  !$ser savepoint sp1
  !$ser mode write
  !$ser data ser_a=a

END PROGRAM main_producer
PROGRAM main_consumer
  IMPLICIT NONE
  REAL(KIND=8), DIMENSION(1,256) :: a

  a(1,:) = 0.0

  PRINT*,'Before read from serializer: sum(a)=', sum(a)

  !$ser init directory='.' prefix='SerialboxTest-output' prefix_ref='SerialboxTest'
  !$ser savepoint sp1
  !$ser mode read
  !$ser data ser_a=a
  !$ser mode write
  !$ser data ser_a=a

  PRINT*,'After read from serializer: sum(a)=', sum(a)
END PROGRAM main_consumer

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions