GEOS-ESM / ESMA_cmake

Custom CMake macros for the GEOS Earth System Model
Apache License 2.0
4 stars 9 forks source link

Add detection of Azure #307

Closed mathomp4 closed 1 year ago

mathomp4 commented 1 year ago

This is an attempt to add detection of Azure machines in ESMA_cmake. It's a bit hacky[^1], but it does seem work on Azure, but I need to make sure I didn't just break NCCS, etc. So I'll keep draft for now.

Also, I don't have access to GCE at the moment but I'm guessing it'll be something similar following:

https://cloud.google.com/compute/docs/instances/detect-compute-engine

[^1]: I'm sure at some point I'll find the post on the @scivision blog that has nice elegant code for this sort of thing 😄

scivision commented 1 year ago

There's no cmake_minimum_required in this project, which is fine. You may be aware this file(DOWNLOAD ...) syntax without filename requires CMake >= 3.19.

At a high level, likewise to identify machines I typically use environment variables that the system owners set as a de facto standard they've decided. For machines like this where they provide an HTTP API instead, I think this kind of file(DOWNLOAD) query is a good approach. If it became necessary, you could regex the API response.

I think your approach of having this separate CMake module Git project that can be FetchContent'ed by many of your other CMake projects is a good one and suggested by expert CMake developers like Craig Scott.

In my own work with specialized systems like Cray that provide their own compiler frontend with multiple compiler backends, and for which institutions may have multiple large machines each with their own quirks and bugs over time, I have also made CMake modules that handle the quirks of each machine I know. There are a finite number of important machines as in your work. We can't tell the sysadmins what to do, but we can patch around per-machine quirks with CMake this way.