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

pumi: fix path to smoketest input data #32446

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open

Conversation

cwsmith
Copy link
Contributor

@cwsmith cwsmith commented Aug 30, 2022

This PR fixes the path to the input data needed to successfully run spack test run pumi.

SCOREC/core#370

@spackbot-app
Copy link

spackbot-app bot commented Aug 30, 2022

It looks like you had an issue with style checks! I can help with that if you ask me! Just say:

@spackbot fix style

... and I'll try to fix style and push a commit to your fork with the fix.

Alternatively, you can run:

$ spack style --fix

And then update the pull request here.

1 similar comment
@spackbot-app
Copy link

spackbot-app bot commented Aug 30, 2022

It looks like you had an issue with style checks! I can help with that if you ask me! Just say:

@spackbot fix style

... and I'll try to fix style and push a commit to your fork with the fix.

Alternatively, you can run:

$ spack style --fix

And then update the pull request here.

@cwsmith cwsmith marked this pull request as ready for review August 31, 2022 01:23
Copy link
Contributor

@tldahlgren tldahlgren left a comment

Choose a reason for hiding this comment

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

Looks good though testing in the install prefix creates a problem for some use cases.

Comment on lines 111 to 115
exe = "uniform"
options = ["../testdata/pipe.dmg", "../testdata/pipe.smb", "pipe_unif.smb"]
options = ["../share/testdata/pipe.dmg", "../share/testdata/pipe.smb", "pipe_unif.smb"]
expected = "mesh pipe_unif.smb written"
description = "testing pumi uniform mesh refinement"
self.run_test(exe, options, expected, purpose=description, work_dir=self.prefix.bin)
Copy link
Contributor

Choose a reason for hiding this comment

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

Stand-alone tests should not be run from the prefix due to issues with permissions in read-only installations. This can be avoided by either providing the full path to the files in the prefix or by copying the test data to the test stage and using the full path to executable(s). For example,

Suggested change
exe = "uniform"
options = ["../testdata/pipe.dmg", "../testdata/pipe.smb", "pipe_unif.smb"]
options = ["../share/testdata/pipe.dmg", "../share/testdata/pipe.smb", "pipe_unif.smb"]
expected = "mesh pipe_unif.smb written"
description = "testing pumi uniform mesh refinement"
self.run_test(exe, options, expected, purpose=description, work_dir=self.prefix.bin)
data_dir = self.prefix.share.testdata
exe = self.prefix.bin.uniform
options = [
join_path(data_dir, "pipe.dmg"),
join_path(data_dir, "pipe.smb"),
join_path(self.prefix.bin, "pipe_unif.smb"),
]
expected = "pipe_unif.smb written"
description = "testing pumi uniform mesh refinement"
self.run_test(exe, options, expected, purpose=description)

@@ -109,15 +109,15 @@ def test(self):
if self.spec.version <= Version("2.2.6"):
return
exe = "uniform"
options = ["../testdata/pipe.dmg", "../testdata/pipe.smb", "pipe_unif.smb"]
options = ["../share/testdata/pipe.dmg", "../share/testdata/pipe.smb", "pipe_unif.smb"]
expected = "mesh pipe_unif.smb written"
description = "testing pumi uniform mesh refinement"
self.run_test(exe, options, expected, purpose=description, work_dir=self.prefix.bin)

mpiexec = Executable(join_path(self.spec["mpi"].prefix.bin, "mpiexec")).command
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to pass an executable to run_test so you could simply set this to:

Suggested change
mpiexec = Executable(join_path(self.spec["mpi"].prefix.bin, "mpiexec")).command
mpiexec = self.spec["mpi"].prefix.bin.mpiexec

expected = "mesh pipe_unif.smb written"
description = "testing pumi uniform mesh refinement"
self.run_test(exe, options, expected, purpose=description, work_dir=self.prefix.bin)

mpiexec = Executable(join_path(self.spec["mpi"].prefix.bin, "mpiexec")).command
mpiopt = ["-n", "2"]
exe = ["split"]
options = ["../testdata/pipe.dmg", "../testdata/pipe.smb", "pipe_2_.smb", "2"]
options = ["../share/testdata/pipe.dmg", "../share/testdata/pipe.smb", "pipe_2_.smb", "2"]
expected = "mesh pipe_2_.smb written"
description = "testing pumi mesh partitioning"
self.run_test(
Copy link
Contributor

Choose a reason for hiding this comment

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

As stated above, the test should not be executed in the installation directory so you want to remove the work_dir argument.

expected = "mesh pipe_unif.smb written"
description = "testing pumi uniform mesh refinement"
self.run_test(exe, options, expected, purpose=description, work_dir=self.prefix.bin)

mpiexec = Executable(join_path(self.spec["mpi"].prefix.bin, "mpiexec")).command
mpiopt = ["-n", "2"]
exe = ["split"]
options = ["../testdata/pipe.dmg", "../testdata/pipe.smb", "pipe_2_.smb", "2"]
options = ["../share/testdata/pipe.dmg", "../share/testdata/pipe.smb", "pipe_2_.smb", "2"]
Copy link
Contributor

Choose a reason for hiding this comment

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

You can provide full paths here:

Suggested change
options = ["../share/testdata/pipe.dmg", "../share/testdata/pipe.smb", "pipe_2_.smb", "2"]
options = [
join_path(data_dir, "pipe.dmg"),
join_path(data_dir, "pipe.smb"),
"pipe_2_.smb",
"2",
]

@tldahlgren tldahlgren self-assigned this Aug 31, 2022
Copy link
Contributor

@tldahlgren tldahlgren left a comment

Choose a reason for hiding this comment

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

See prior suggestions and comments.

@cwsmith
Copy link
Contributor Author

cwsmith commented Nov 23, 2022

Hi @tldahlgren,

I made the suggested edits (outside github) and was able to run spack test run pumi@2.2.7 without any obvious issues.

exe = ["split"]
options = ["../testdata/pipe.dmg", "../testdata/pipe.smb", "pipe_2_.smb", "2"]
expected = "mesh pipe_2_.smb written"
mpiexec = self.spec["mpi"].prefix.bin.mpiexec
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a case where the full path to the mpi executable is necessary? There are software environments where only the mpi compilers are provided in the mpi bin directory and the executors are located elsewhere. This test is breaking for us in that situation. Also, mpiexec is not always available. I recommend using something like this:

        mpiexe_list = ["mpirun", "mpiexec", "srun"]
        for mpiexe in mpiexe_list:
            if which(mpiexe) is not None:
                mpiexec = Executable(mpiexe).command
                break

Copy link
Contributor Author

@cwsmith cwsmith Jan 18, 2023

Choose a reason for hiding this comment

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

I'm not sure. If the full path was not set, how would the spack test mechanism locate the mpi executor that matches the mpi install used for the build? I haven't tried mixing an mpi executor from one mpi install with libraries/headers from another.

Copy link
Contributor

Choose a reason for hiding this comment

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

The correct mpi environment would have to be loaded for the test to run successfully so it would pick up the executor from the path. I think that is generally how spack smoke tests are implemented. This isn't to support mixing and matching mpi components but a single mpi with an atypical directory structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. Thank you. I'll make the change.

Copy link
Contributor Author

@cwsmith cwsmith Jan 18, 2023

Choose a reason for hiding this comment

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

Quick spack/python question. Should we handle the case where mpirun, mpiexec or srun is not found? If so, what is the clean way to report the error and exit?

Copy link
Contributor

Choose a reason for hiding this comment

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

That would be safer. Maybe skip the mpi test with a warning rather than a failure in that case? Ideally we should have an mpi executor method provided by spack so every mpi enabled test doesn't have to reimplement this...

Copy link
Contributor

Choose a reason for hiding this comment

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

We have tests that pick the first of those executables it finds and runs with it. If you want to demonstrate running with all available, you could do that.

(FYI. I'm refactoring stand-alone testing support so maybe I can sneak this in. 😉 )

@alecbcs
Copy link
Member

alecbcs commented Nov 19, 2023

@cwsmith did you get a chance to take a look at the review feedback. Is this PR still something you'd like to pursue?

@cwsmith
Copy link
Contributor Author

cwsmith commented Nov 21, 2023

@alecbcs Yes. Sorry. I'll get back to this after the holiday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants