Skip to content

Commit 90681ed

Browse files
authored
Merge branch 'develop' into feature/taylor/shroud-0.14.0
2 parents 03f9883 + fd427ba commit 90681ed

File tree

10 files changed

+2931
-95
lines changed

10 files changed

+2931
-95
lines changed

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/
2121
### Added
2222
- Adds the `AXOM_ENABLE_TUTORIALS` configuration variable (`ON` by default)
2323
- Adds a tutorial on shaping in Axom and associated infrastructure in `quest`, `klee`, `inlet` and `sidre`.
24+
- Added iterators and Attribute class to the Python interface for sidre.
2425

2526
### Changed
2627
- Treatment of materials on strided-structured Blueprint meshes has changed in `axom::mir`.

scripts/spack/packages/axom/package.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -378,23 +378,20 @@ def initconfig_hardware_entries(self):
378378
)
379379
hip_link_flags += "-lmpi_gtl_hsa "
380380

381+
if spec.satisfies("^[email protected]:"):
382+
hip_link_flags += "-L{0}/lib/llvm/lib -Wl,-rpath,{0}/lib/llvm/lib ".format(rocm_root)
383+
else:
384+
hip_link_flags += "-L{0}/llvm/lib -Wl,-rpath,{0}/llvm/lib ".format(rocm_root)
385+
# Only amdclang requires this path; cray compiler fails if this is included
386+
if spec.satisfies("%llvm-amdgpu"):
387+
hip_link_flags += "-L{0}/lib -Wl,-rpath,{0}/lib ".format(rocm_root)
388+
hip_link_flags += "-lpgmath -lompstub "
389+
381390
# Fixes for mpi for rocm until wrapper paths are fixed
382391
# These flags are already part of the wrapped compilers on TOSS4 systems
383392
if spec.satisfies("+fortran") and self.is_fortran_compiler("amdflang"):
384-
385393
hip_link_flags += "-Wl,--disable-new-dtags "
386-
387-
if spec.satisfies("^[email protected]:"):
388-
hip_link_flags += "-L{0}/lib/llvm/lib -Wl,-rpath,{0}/lib/llvm/lib ".format(
389-
rocm_root
390-
)
391-
else:
392-
hip_link_flags += "-L{0}/llvm/lib -Wl,-rpath,{0}/llvm/lib ".format(rocm_root)
393-
394-
# Only amdclang requires this path; cray compiler fails if this is included
395-
hip_link_flags += "-L{0}/lib -Wl,-rpath,{0}/lib ".format(rocm_root)
396-
397-
hip_link_flags += "-lpgmath -lflang -lflangrti -lompstub "
394+
hip_link_flags += "-lflang -lflangrti "
398395

399396
# Additional library path for cray compiler
400397
if self.spec.satisfies("%cce"):

src/axom/sidre/examples/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,15 @@ if(NANOBIND_FOUND)
157157
foreach(example_source ${Py_example_sources})
158158
get_filename_component(exe_name ${example_source} NAME_WE)
159159

160+
# Copy python example file to build
161+
axom_configure_file ("${example_source}"
162+
"${EXAMPLE_OUTPUT_DIRECTORY}/${example_source}" COPYONLY)
163+
160164
# Use convenience script to run python examples
161165
if(AXOM_ENABLE_PYTHON_TESTS)
162166
axom_add_test (
163167
NAME ${exe_name}
164-
COMMAND ${PROJECT_BINARY_DIR}/bin/run_python_with_axom.sh ${CMAKE_CURRENT_SOURCE_DIR}/${example_source}
168+
COMMAND ${PROJECT_BINARY_DIR}/bin/run_python_with_axom.sh ${EXAMPLE_OUTPUT_DIRECTORY}/${example_source}
165169
)
166170
endif()
167171
endforeach()

src/axom/sidre/examples/sidre_createdatastore_Py.py

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ def create_datastore(region):
1414
ds = pysidre.DataStore()
1515
root = ds.getRoot()
1616

17-
# TODO - Implement Attributes for python
1817
# Create two attributes
18+
ds.createAttributeScalar("vis", 0)
19+
ds.createAttributeScalar("restart", 1)
1920

2021
# Create group children of root group
2122
state = root.createGroup("state")
@@ -56,6 +57,10 @@ def create_datastore(region):
5657
temp = fields.createViewAndAllocate("temp", pysidre.TypeID.DOUBLE_ID, eltcount)
5758
rho = fields.createViewAndAllocate("rho", pysidre.TypeID.DOUBLE_ID, eltcount)
5859

60+
# Explicitly set values for the "vis" Attribute on the "temp" and "rho" buffers.
61+
temp.setAttributeScalar("vis", 1)
62+
rho.setAttributeScalar("vis", 1)
63+
5964
# The "fields" Group also contains a child Group "ext" which holds a pointer
6065
# to an externally owned integer array. Although Sidre does not own the
6166
# data, the data can still be described to Sidre.
@@ -101,8 +106,48 @@ def access_datastore(ds):
101106

102107
return ds
103108

109+
def iterate_datastore(ds):
110+
fill_line = "=" * 80
111+
print(fill_line)
112+
113+
# iterate through the attributes in ds
114+
print("The datastore has the following attributes:")
115+
for attr in ds.attributes():
116+
print(f"* [{attr.getIndex()}] '{attr.getName()}' of type "
117+
f"{attr.getTypeID()} "
118+
119+
# Requires conduit::Node information
120+
# f"and default value: {attr.getDefaultNodeRef().to_yaml()}\n"
121+
)
122+
123+
# iterate through the buffers in ds
124+
print(fill_line)
125+
print("The datastore has the following buffers:")
126+
for buff in ds.buffers():
127+
print(f"* [{buff.getIndex()}] "
128+
f"{'Allocated' if buff.isAllocated() else 'Unallocated'} buffer with "
129+
f"{buff.getNumElements()} elements of type {buff.getTypeID()} with "
130+
f"{buff.getNumViews()} views")
131+
print(fill_line)
132+
133+
# iterate through the groups of the root group
134+
print("The root group has the following groups:")
135+
for grp in ds.getRoot().groups():
136+
print(f"* [{grp.getIndex()}] '{grp.getName()}' with "
137+
f"{grp.getNumGroups()} groups and {grp.getNumViews()} views")
138+
print(fill_line)
139+
140+
# iterate through the views of the 'state' group
141+
print("The 'state' group has the following views:")
142+
for view in ds.getRoot().getGroup("state").views():
143+
print(f"* [{view.getIndex()}] '{view.getName()}' -- "
144+
f"{'Allocated' if view.isAllocated() else 'Unallocated'} view of type "
145+
f"{view.getTypeID()} and {view.getNumElements()} elements")
146+
print(fill_line)
147+
104148

105149
if __name__=="__main__":
106150
region = np.zeros(3375, dtype = int)
107151
ds = create_datastore(region)
108152
access_datastore(ds)
153+
iterate_datastore(ds)

0 commit comments

Comments
 (0)