Skip to content

Support for Windows development environment#33021

Merged
scheibelp merged 47 commits intospack:developfrom
johnwparent:win/external-find-drivers
Nov 22, 2022
Merged

Support for Windows development environment#33021
scheibelp merged 47 commits intospack:developfrom
johnwparent:win/external-find-drivers

Conversation

@johnwparent
Copy link
Copy Markdown
Contributor

This establishes a base of support for a Windows development environment and introduces some fundamental Windows tools to Spack as packages and externally locatable components. This will support packages relying on low level Windows development components such as the Windows OpenGL driver, third party GL drivers, the driver development kit, and the Windows software development kit. This components will introduce new support or expand support for such packages as MSMPI, HDF5, Glew, Paraview, and VTK.

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Oct 5, 2022

Hi @johnwparent! I noticed that the following package(s) don't yet have maintainers:

  • wdk
  • wgl
  • win-sdk
  • win-wdk

Are you interested in adopting any of these package(s)? If so, simply add the following to the package class:

    maintainers = ['johnwparent']

If not, could you contact the developers of this package and see if they are interested? You can quickly see who has worked on a package with spack blame:

$ spack blame wdk

Thank you for your help! Please don't add maintainers without their consent.

You don't have to be a Spack expert or package developer in order to be a "maintainer," it just gives us a list of users willing to review PRs or debug issues relating to this package. A package can have multiple maintainers; just add a list of GitHub handles of anyone who wants to volunteer.

Copy link
Copy Markdown
Member

@scheibelp scheibelp left a comment

Choose a reason for hiding this comment

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

I mostly have comments about readability, although there appears to be a couple issues (more detail in comments).

def install(self, spec, prefix):
install_args = ["/features", "+", "/quiet", "/installpath", self.prefix]
with working_dir(self.stage.source_path):
Executable("wdksetup.exe")(*install_args)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You mentioned that users can't install wdk if it's already on the system: could the error message be augmented with a suggestion to run spack external find --not-buildable wdk?

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.

Will do

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.

I tested this, and the installer will report that scenario to the users prior to closure without Spack needing to do so. When spack runs Executable("wdksetup.exe")(*install_args) execution is handed over to the Windows installer and gui, which then detects other installations of the WDK and reports to that effect. Context is not returned to spack until a user acknowledges that scenario, so I don't believe reporting that would be necessary. Additionally, I don't know if the installer returns enough info to Spack via stdout that we would be able to differentiate that failure from another.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Now that this PR includes windows_registry could this be updated? That doesn't have to happen in this PR, I just wanted to check if that made this possible (I assume that for this to make sense, it would also need to run -unattended, if that or an equivalent option is available for the install).

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.

Yes, we would be able to search for the registry key and report the already installed version. Windows installer APIs are not consistent across packages, each package creates their own. The WDK does not have the -unattended flag, instead the -quiet flag that I've already added handled both the normal interface and any error messages that may crop up. There are two to dos here, the first is the registry stuff, and the second is piping errors to the spack log file. I'll try to do both in this PR.

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.

If you point the log at spack's log it blows things away, that will be saved for a later PR.

@johnwparent johnwparent marked this pull request as ready for review November 3, 2022 19:01
Copy link
Copy Markdown
Member

@scheibelp scheibelp left a comment

Choose a reason for hiding this comment

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

Some preliminary comments. Some are more straightforward changes and others might merit discussion. Let me know if you agree.

def install(self, spec, prefix):
install_args = ["/features", "+", "/quiet", "/installpath", self.prefix]
with working_dir(self.stage.source_path):
Executable("wdksetup.exe")(*install_args)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Now that this PR includes windows_registry could this be updated? That doesn't have to happen in this PR, I just wanted to check if that made this possible (I assume that for this to make sense, it would also need to run -unattended, if that or an equivalent option is available for the install).

Copy link
Copy Markdown
Member

@scheibelp scheibelp left a comment

Choose a reason for hiding this comment

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

Additional requests - hopefully all minor. Let me know if you disagree.

Update spack external find heuristics to account for Windows drivers

Update external find for Windows kits
@spackbot-app spackbot-app bot added commands tests General test capability(ies) labels Nov 18, 2022
Copy link
Copy Markdown
Member

@scheibelp scheibelp left a comment

Choose a reason for hiding this comment

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

Some additional requests: if any of them don't seem minor let me know.

scheibelp
scheibelp previously approved these changes Nov 19, 2022
@scheibelp

This comment was marked as outdated.

@spackbot-app

This comment was marked as outdated.

@scheibelp
Copy link
Copy Markdown
Member

Seems like the build tests are still hitting some intermittent download issues. I'll retry the pipeline.

@scheibelp
Copy link
Copy Markdown
Member

@spackbot run pipeline

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Nov 22, 2022

I've started that pipeline for you!

@scheibelp scheibelp merged commit 793a7bc into spack:develop Nov 22, 2022
"""
if not is_windows or _win32_can_symlink():
os.symlink(real_path, link_path)
os.symlink(real_path, link_path, target_is_directory=os.path.isdir(real_path))
Copy link
Copy Markdown
Member

@haampie haampie Dec 5, 2022

Choose a reason for hiding this comment

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

Why was this added? It's a really bad idea, cause this way dangling symlinks cannot be created. Ok, I mistakenly thought isdir throws if the file doesn't exist. In any case, I submitted #34321.

In general I'd like to ask you to never introduce changes for Windows support that cause performance regressions for non-Windows. Just assume that every file system operation is the bottleneck in some part of Spack, whether it's views, post-install hooks, buildcaches, ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In general I'd like to ask you to never introduce changes for Windows support that cause performance regressions for non-Windows.

This request is impossible to satisfy, or even to break down into something realistic or manageable. It is equivalent to saying "don't introduce bugs" (I'm already trying to do that).

As for the specific issue, I personally think a mistake at this level is unavoidable. Even if your original complaint was true. We have this code, and then we have you noticing and making an adjustment that avoids the issue (presumably because you have a benchmark which detects that something started slowing down). If you're worried about dangling symlinks and the tests don't have it, then they should have it; if you think there should be a benchmark for tracking this type of slowdown and we don't have it, then we should have one.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess what I'm saying is: be mindful about filesystem operations.

amd-toolchain-support pushed a commit to amd-toolchain-support/spack that referenced this pull request Feb 16, 2023
* Add a WindowsRegistryView class, which can query for existing
  package installations on Windows. This is particularly important
  because some Windows packages (including those added here)
  do not allow two simultaneous installs, and this can be
  queried in order to provide a clear error message.
* Consolidate external path detection logic for Windows into
  WindowsKitExternalPaths and WindowsCompilerExternalPaths objects.
* Add external-only packages win-sdk and wgl
* Add win-wdk (including external detection) which depends on
  win-sdk
* Replace prior msmpi implementation with a source-based install
  (depends on win-wdk). This install can control the install
  destination (unlike the binary installation).
* Update MSVC compiler to choose vcvars based on win-sdk dependency
* Provide "msbuild" module-level variable to packages during build
* When creating symlinks on Windows, need to explicitly specify when
  a symlink target is a directory
* executables_in_path no-longer defaults to using PATH (this is
  now expected to be taken care of by the caller)
Comment on lines +270 to +275
return []
program_files = os.environ["PROGRAMFILES(x86)"]
kit_base = os.path.join(
program_files, "Windows Kits", WindowsKitExternalPaths.plat_major_ver
)
return kit_base
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there any reason this function returns either an empty list or a string?

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.

Nope, and that's definitely a mistake we missed. IMO we should actually always be returning a list from a glob over the base kits directory so we can support SDK 10 and SDK 11.
I'll refactor, PR, and tag you.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No worries, I stumbled on this while doing #39803

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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants