You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some recent changes (f7be394?) seem to have slowed down manipulating field data (by orders of magnitude!).
Steps To Reproduce
This is a minimal script to reproduce the issue. Using uv I could easily run it with different "versions" of PyDPF-Core and compare timings.
Using the latest released version (0.13.6) it takes ~20ms to run. With current main it instead takes >5s.
Note: I'm aware the operations tested here could be done in a different way, by setting the field data and scoping outside of the loop. But still, I feel like this could indicate some bigger problem.
# /// script# requires-python = "==3.12.9"# dependencies = [# "numpy==2.2.4",# "ansys-dpf-core==0.13.6", #fast# #"ansys-dpf-core @ git+https://[email protected]/ansys/pydpf-core.git@e2a1cf0caa01d3376e956cbea026590a40ccbf48", #fast# #"ansys-dpf-core @ git+https://[email protected]/ansys/pydpf-core.git@f7be394515266766b6208ef4f341a5fdfec558db", #slow# ]# ///"""Script to measure performance of creating a DPF field.How to:1. Install uv if not already installed: pip install uv See https://docs.astral.sh/uv/getting-started/installation/#standalone-installer2. Save this code as, say, `create_field.py` and run it: uv run create_field.py3. Change the ansys-dpf-core version in the script header and re-run the script: uv run create_field.py"""importtimeimportnumpyasnpfromansys.dpf.coreimportfields_factoryfromansys.dpfimportcoreasdpfserver=dpf.start_local_server(
context=dpf.AvailableServerContexts.premium,
config=dpf.AvailableServerConfigs.InProcessServer,
as_global=True,
)
num_entities=int(1e+6)
field=fields_factory.create_scalar_field(
num_entities=num_entities, location=dpf.locations.elemental, server=server
)
field.name="my_field"field.data=np.zeros(num_entities, dtype=np.int32)
field.scoping.ids=np.zeros(num_entities, dtype=np.int32)
all_indices=np.arange(num_entities)
chunks=np.array_split(all_indices, 200)
start_time=time.perf_counter()
forindex, chunkinenumerate(chunks):
field.data[chunk] =int(index)
field.scoping.ids[chunk] =chunkprint(
f"Filling DPF field done in {(time.perf_counter() -start_time):.3f} s"
)
Which Operating System causes the issue?
Windows
Which DPF/Ansys version are you using?
DPF Server 2025.2.pre0
Which Python version causes the issue?
3.12
Installed packages
See script above
The text was updated successfully, but these errors were encountered:
Before submitting the issue
Description of the bug
Some recent changes (f7be394?) seem to have slowed down manipulating field data (by orders of magnitude!).
Steps To Reproduce
This is a minimal script to reproduce the issue. Using
uv
I could easily run it with different "versions" of PyDPF-Core and compare timings.Using the latest released version (0.13.6) it takes ~20ms to run. With current main it instead takes >5s.
Note: I'm aware the operations tested here could be done in a different way, by setting the field data and scoping outside of the loop. But still, I feel like this could indicate some bigger problem.
Which Operating System causes the issue?
Windows
Which DPF/Ansys version are you using?
DPF Server 2025.2.pre0
Which Python version causes the issue?
3.12
Installed packages
See script above
The text was updated successfully, but these errors were encountered: