Open vfdev-5 opened 3 years ago
@vfdev-5 any idea how can we import yaml inside yaml ? I found out that circleci yaml is just vanilla yaml, so we can't do normally.
Two options I found out currently
config.yml
just like pytorch and domain repos are usingcircleci
cli to generate valid config.yml
using circleci config pack
commandI haven't tried option 1, but have tried option 2: Dir Structure
.circleci/src
├── commands
│ ├── install_dependencies.yml
│ ├── install_latest_nvidia.yml
│ ├── pull_pytorch_stable_devel_image.yml
│ ├── pull_pytorch_stable_image.yml
│ ├── run_pytorch_container.yml
│ └── run_pytorch_devel_container.yml
├── config.yml
├── executors
│ ├── one_gpu.yml
│ ├── one_gpu_windows.yml
│ └── two_gpus.yml
└── jobs
├── build_publish_docker_images.yml
├── one_gpu_tests.yml
├── one_gpu_windows_tests.yml
├── two_gpus_check_dist_cifar10_example.yml
├── two_gpus_hvd_tests.yml
└── two_gpus_tests.yml
3 directories, 16 files
The folder names define the names we defined in .circleci/config.yml
(jobs
is jobs
which will contain the jobs we will run, same to commands, executors). What I don't like is this creates many files which only contains a small amount of commands. But what do you think tho ? @vfdev-5 @trsvchn
What's inside above config.yml
:
Here's option 2 output:
any idea how can we import yaml inside yaml ?
I think only GitLab has that feature
Gitlab has a similar feature using the include keyword to include workflow templates; and in addition the extends keyword can be used to share small bits of yaml within the same yaml file
@ydcjeff thanks for providing these options! Yes, there are pros/cons in all those approaches. Maybe, a third approach is to read docker values similarly to
python -c "import yaml; f=open('.circleci/config.yml'); d=yaml.safe_load(f); print(d['parameters']['build_docker_image_pytorch_version']['default'])"
@trsvchn or @ydcjeff would you like to solve this issue. I'd like to build new docker images this week.
EDIT: Probably, we can do that manually for now, before the issue has been solved
@vfdev-5 I have another idea, but I have zero experience with circleci, can we do smth like this?
Simply use Makefile with defined versions:
# Makefile
BUILD_DOCKER_IMAGE_PYTORCH_VERSION = 1.8.1-cuda11.1-cudnn8
BUILD_DOCKER_IMAGE_HVD_VERSION = v0.21.3
BUILD_DOCKER_IMAGE_MSDP_VERSION = v0.3.10
get_build_docker_image_pytorch_version:
@echo $(BUILD_DOCKER_IMAGE_PYTORCH_VERSION)
get_build_docker_image_hvd_version:
@echo $(BUILD_DOCKER_IMAGE_HVD_VERSION)
get_build_docker_image_msdp_version:
@echo $(BUILD_DOCKER_IMAGE_MSDP_VERSION)
Then use it inside circleci.config
(if possible)
# to get pytorch verison
build_docker_image_pytorch_version = make get_build_docker_image_pytorch_version
...
And the same for GHA:
export PTH_VERSION=`make get_build_docker_image_pytorch_version`
Yes, we can do something like that but I'm not a fan of using another scripting langs in addition to bash and python... We can think of https://github.com/pydoit/doit or python for that if needed.
Yeah, agree Makefile
is not very obvious tool, There is "the strangely familiar workflow utility " from Ken Reitz:
https://github.com/kenreitz42/bake
No, let's keep things without new deps
@ydcjeff thanks for providing these options! Yes, there are pros/cons in all those approaches. Maybe, a third approach is to read docker values similarly to
python -c "import yaml; f=open('.circleci/config.yml'); d=yaml.safe_load(f); print(d['parameters']['build_docker_image_pytorch_version']['default'])"
Another idea is to add these lines to new docker.cfg
ini file, then no need to use pyaml, and we have strings here
[DEFAULT]
build_docker_image_pytorch_version = 1.8.1-cuda11.1-cudnn8
build_docker_image_hvd_version = v0.21.3
build_docker_image_msdp_version = v0.3.10
Then:
python -c "import configparser; print(configparser.ConfigParser().read('docker.cfg')['DEFAULT']['build_docker_image_pytorch_version'])"
Sounds good @trsvchn
cc @trsvchn @ydcjeff