Skip to content

Issue with copy behavior in spiner EOS #482

@jhp-lanl

Description

@jhp-lanl

In #375 , a test was added that looks like this:

  portableFor(
      "Positive temperature test", 0, n_eos, PORTABLE_LAMBDA(const int i) {
        const auto &this_eos = v_EOS[i];

        // Find the reference state (really we just want the density :shrug:)
        Real rho_ref;
        Real temp_ref;
        Real sie_ref;
        Real press_ref;
        Real cv_ref;
        Real bmod_ref;
        Real dpde_ref;
        Real dvdt_ref;
        this_eos.ValuesAtReferenceState(rho_ref, temp_ref, sie_ref, press_ref, cv_ref,
                                        bmod_ref, dpde_ref, dvdt_ref);

        // Sanity check on the density to make sure we don't screw this up
        PORTABLE_ALWAYS_REQUIRE(rho_ref > 0, "Zero reference density");

Before this, a host array of EOS objects was created and GetOnDevice() was called for each model (even if it technically wasn't necessary). Then the array was copied into the device array, v_EOS.

If instead I create a copy of the EOS in v_EOS by removing the auto & from the above code so that this_eos is now

        const auto this_eos = v_EOS[i];

then the PORTABLE_ALWAYS_REQUIRE statement above fails for the spiner EOS. It passes for all other EOS though.

This also happens when the const qualifier is removed:

       auto this_eos = v_EOS[i];

or when using the EOS type instead of auto.

I interpret this as the copied spiner EOS having an uninitialized state somehow, but I don't fully understand this issue.

Metadata

Metadata

Assignees

Labels

RobustnessEnsures that existing features work as intendedbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions