Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pykokkos/core/module_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ def get_entity_dir(self, main: Path, metadata: EntityMetadata) -> Path:
"""

filename: str = metadata.path.split("/")[-1].split(".")[0]
dirname: str = f"{filename}_{metadata.name}"
# the compilation paths do not have concurrent safety without a unique
# identifier because i.e., compilation units can share
# the same module/class; try using the memory loc of the Python
# metadata object
mem_id = id(metadata)
dirname: str = f"{filename}_{metadata.name}_{mem_id}"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There must be a scheme that's both fast and safe? Giving each "compilation unit" its own specific directory was the easiest approach I could think of, but presumably the serial test run is so much faster on develop because sharing a directory either allows reuse of some previously-compiled code and/or of some shared common compiled bits between different workunits/kernels?


return self.get_main_dir(main) / Path(dirname)

Expand Down Expand Up @@ -180,4 +185,4 @@ def is_compiled(self) -> bool:
Check if this module is compiled for its execution space
"""

return CppSetup.is_compiled(self.get_output_dir(self.main, self.metadata, self.space))
return CppSetup.is_compiled(self.get_output_dir(self.main, self.metadata, self.space))