Skip to content

Commit

Permalink
Add unique hash to icon uenv (only on a100 so far) (#76)
Browse files Browse the repository at this point in the history
* add(icon, balfrin): compute hash at post-install stage
  • Loading branch information
leclairm authored Apr 17, 2024
1 parent 9ad0d80 commit bf0baa6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions recipes/wcp/icon/v1/a100/post-install
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
#!/usr/bin/python3

import yaml
import hashlib


# Add cuda_arch to packages.yaml
with open("{{ env.mount }}/config/packages.yaml", mode='r') as file:
packages = yaml.safe_load(file)

packages['packages']['all'] = {'variants': 'cuda_arch=80'}

with open("{{ env.mount }}/config/packages.yaml", mode='w') as file:
yaml.dump(packages, file)


# Generate a hash to make the uenv uniquely identifiable
with open("{{ env.mount }}/meta/configure.json", mode='rb') as f:
sha = hashlib.sha256(f.read()).hexdigest()

with open("{{ env.mount }}/meta/hash", mode='w') as f:
f.write(sha)

0 comments on commit bf0baa6

Please sign in to comment.