OPM / opm-simulators

Simulator programs and utilities for automatic differentiation.
http://www.opm-project.org
GNU General Public License v3.0
111 stars 121 forks source link

Error when running EclFile on aws machine #5622

Closed flammmes closed 3 hours ago

flammmes commented 4 hours ago

Hello, I noticed a very weird bug when I tried running a code on an aws environment. On my local wsl machine the outputs of the operations below run fine. In my local machine I have a recent version of flow, built from the source files from like 3-4 months ago.

I tried installing flow today from source again on an aws machine. Below are the lines that cause the bug.

  summary = ESmry(f'{self.env_id}/{step}/DECKOLDBO{self.env_id}_{step}.SMSPEC')
  rst = ERst(f'{self.env_id}/{step}/DECKOLDBO{self.env_id}_{step}.UNRST')
  init = EclFile(f'{self.env_id}/{step}/DECKOLDBO{self.env_id}_{step}.INIT')
  porv = init['PORV']
  active = porv > 0

  report_step = rst.report_steps[-1]
  sw = np.zeros_like(porv)
  pressure = np.zeros_like(porv)
  sw[active] = 1 - rst['SGAS', report_step]
  pressure[active] = rst['PRESSURE', report_step]

On aws the "active" mask contains zero elements while it should have 9212 same as the number of total active cells. This is very strange and I thought that something was wrong with the output files. So I took the output files from wsl and pasted them to my local wsl environment and they were fine. The lines above run fine.

What I also noticed by using perm = Init['PERM'] (or PERMX whatever works) was that the first value of the sequence was copied throughout the whole array, therefore since the first value of PORV was 0 (inactive cell) it was copied everywhere. For permeability this doesn't happen since the array only contains values of active cells however it was still wrong.

Once again I have to say that on my local machine the code works fine, I only needed to transition to aws for more computational power.

So my first question is whether or not EclFile was changed in the last 2-3 months to cause an issue like that since this is the difference between my local version of flow and the one I installed today.

Secondly, is there any reason to suspect that .INIT files can't be read properly on a aws machine?

Finally, is there any way to circumvent this issue besides hard copying a static keyword from the deck as a string and turning it into a numpy array which is what would suit me?

 Traceback (most recent call last):
  File "/home/ubuntu/drl/env.py", line 242, in <module>
    obs, _ = env.reset()
  File "/home/ubuntu/drl/env.py", line 71, in reset
    obs = self.get_observation(0)
  File "/home/ubuntu/drl/env.py", line 154, in get_observation
    sw[active] = rst['SGAS', report_step]
ValueError: NumPy boolean array indexing assignment cannot assign 9212 input values to the 0 output values where the mask is true
akva2 commented 4 hours ago

you have to downgrade numpy to v1.xx, e.g. pip3 install numpy==1.26

flammmes commented 3 hours ago

thank you very much for your reply. I will close the issue now and if I encounter anything else I will reopen.