diff --git a/pykokkos/core/module_setup.py b/pykokkos/core/module_setup.py index 3f294d02..d0d55005 100644 --- a/pykokkos/core/module_setup.py +++ b/pykokkos/core/module_setup.py @@ -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}" return self.get_main_dir(main) / Path(dirname) @@ -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)) \ No newline at end of file + return CppSetup.is_compiled(self.get_output_dir(self.main, self.metadata, self.space))