Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix code for xps, xas, and update the code resources #711

Merged
merged 4 commits into from
Apr 30, 2024

Conversation

superstar54
Copy link
Member

@superstar54 superstar54 commented Apr 30, 2024

Update codes of plugin XAS and XPS:

  • Fix the code
  • Update the resources for the builder
  • Select xas and xps in the test

@@ -13,6 +13,21 @@
xch_elements = PSEUDO_TOC["xas_xch_elements"]


def update_resources(builder, codes):
Copy link
Member

@AndresOrtegaGuerrero AndresOrtegaGuerrero Apr 30, 2024

Choose a reason for hiding this comment

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

What if you use an extra function ?

def set_component_resources(component, code_info):
    if code_info:  # Ensure code_info is not None or empty
        component.metadata.options.resources = {
            "num_machines": code_info["nodes"],
            "num_mpiprocs_per_machine": code_info["ntasks_per_node"],
            "num_cores_per_mpiproc": code_info["cpus_per_task"],
        }
        if "parallelization" in code_info:
            component.parallelization = orm.Dict(dict=code_info["parallelization"])

and then in update_resources , you call this function ?

Choose a reason for hiding this comment

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

Actually , we are calling these lines plenty of times you can make like this function so it can be called by the other plugins , like ,

def update_resources(builder, codes):
    # Update resources for 'scf.pw'
    scf_pw_code_info = codes.get("pw")
    if scf_pw_code_info:
        set_component_resources(builder.core.scf.pw, scf_pw_code_info)

Then all the plugin can call this "util" function , set_component_resources ?? what do you think ?

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks for the suggestions, we can do this for the moment. In the future, we better use the options keyword to set up the resource when creating the builder.

Choose a reason for hiding this comment

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

the thing with options is that is restricted to the workchain and if it has the options, you rather use the override

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree that options depends on how the plugin developer writes their WorkChain.

@superstar54
Copy link
Member Author

superstar54 commented Apr 30, 2024

Thanks for the review. @AndresOrtegaGuerrero . I made the changes as you suggested.
I unselect xas and xps from the test, because they require special settings on the pseudo etc. For the moment, I have decided not to touch this. Will come back to the test in the future.

I tested xas and xps locally, and they work well.

Copy link
Member

@AndresOrtegaGuerrero AndresOrtegaGuerrero left a comment

Choose a reason for hiding this comment

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

LGTM!

@superstar54 superstar54 merged commit 83e5928 into aiidalab:main Apr 30, 2024
14 checks passed
@superstar54 superstar54 deleted the fix_code_xas_xps branch April 30, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants