Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Data dimensions: silent unroll #43

Open
1 task
FlorianDeconinck opened this issue May 1, 2024 · 0 comments
Open
1 task

[Bug] Data dimensions: silent unroll #43

FlorianDeconinck opened this issue May 1, 2024 · 0 comments

Comments

@FlorianDeconinck
Copy link
Collaborator

FlorianDeconinck commented May 1, 2024

This code fails because the data dims get unrolled

import numpy as np
from gt4py.cartesian import gtscript
from gt4py.cartesian.gtscript import (
    PARALLEL,
    computation,
    interval,
)
from gt4py import storage as gt_storage

backend = "numpy"
full_shape = (1, 1, 1)
aligned_index = (0, 0, 0)

datadim_len = 4

FLOAT64_NDDIM = (np.float64, (datadim_len,))


@gtscript.stencil(backend=backend)
def stencil(
    out_vec_field: gtscript.Field[FLOAT64_NDDIM],
    vec_field: gtscript.Field[FLOAT64_NDDIM],
):
    with computation(PARALLEL), interval(...):
        # The indexation doesn't work, it will silently unrolls for all dims
        # instead of failing because out_vect_field is not indexed properly
        out_vec_field[0, 0, 0] = vec_field[0, 0, 0][2]


out_vec_field = gt_storage.ones(
    full_shape, backend=backend, aligned_index=aligned_index, dtype=FLOAT64_NDDIM
)

vec_field = gt_storage.ones(
    full_shape, backend=backend, aligned_index=aligned_index, dtype=FLOAT64_NDDIM
)
vec_field[:] = 2.0

stencil(
    out_vec_field,
    vec_field,
    origin=(0, 0, 0),
    domain=full_shape,
)

Parent: GEOS-ESM/SMT-Nebulae#36


@FlorianDeconinck FlorianDeconinck changed the title Data dimensions: wrong unroll [Bug] Data dimensions: wrong unroll May 1, 2024
@FlorianDeconinck FlorianDeconinck changed the title [Bug] Data dimensions: wrong unroll [:zap:] Data dimensions: wrong unroll May 1, 2024
@FlorianDeconinck FlorianDeconinck changed the title [:zap:] Data dimensions: wrong unroll [Bug] Data dimensions: wrong unroll May 1, 2024
@FlorianDeconinck FlorianDeconinck changed the title [Bug] Data dimensions: wrong unroll [Bug] Data dimensions: silent unroll May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant