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
build/ops: rpm: set build parallelism based on available memory #19122
Conversation
0a207ec
to
636937a
Compare
9f7ac55
to
107661b
Compare
107661b
to
107616c
Compare
ae4f2ec
to
a292d52
Compare
Sorry for the initial instability - this PR is now ready for review. |
a292d52
to
7f0a1fd
Compare
@sysrich I pulled your recent contribution into this upstream PR (JFYI - thanks). |
b7af483
to
d476ca7
Compare
ceph.spec.in
Outdated
@@ -979,7 +978,6 @@ rm -rf %{buildroot} | |||
%{_sbindir}/ceph-disk | |||
%{_sbindir}/ceph-volume | |||
%{_sbindir}/ceph-volume-systemd | |||
%{_sbindir}/rcceph |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you put more context of this change in the commit messages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
ceph.spec.in
Outdated
@@ -33,6 +33,10 @@ | |||
%bcond_with ceph_test_package | |||
%bcond_with cephfs_java | |||
%bcond_without lowmem_builder | |||
#Compat macro for new _fillupdir macro introduced in Nov 2017 | |||
%if ! %{defined _fillupdir} | |||
%define _fillupdir /var/adm/fillup-templates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we keep using ${_localstatedir}
here? or we cannot define macro using another macro?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smithfarm ping?
ceph.spec.in
Outdated
@@ -35,7 +36,7 @@ | |||
%bcond_without lowmem_builder | |||
#Compat macro for new _fillupdir macro introduced in Nov 2017 | |||
%if ! %{defined _fillupdir} | |||
%define _fillupdir /var/adm/fillup-templates | |||
%global _fillupdir /var/adm/fillup-templates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, this change belongs to another commit.
%if 0%{?suse_version} | ||
# _insert_obs_source_lines_here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smithfarm so, instead of hardwiring to a certain path, OBS will inject another _remote_tarball_prefix
when building rpm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tchaikov No, in the OBS builds the tarball is not downloaded at all, _remote_tarball_prefix
expands to the empty string. In OBS builds, the tarball is generated from the git repo by running make-dist
, before running rpmbuild.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I should have linked to the checkin script: https://build.opensuse.org/package/view_file/filesystems:ceph:mimic/ceph/checkin.sh?expand=1
The # _insert_obs_source_lines_here
is used by pre_checkin.sh
to add some OBS-specific "Source:" lines to the spec file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it! thanks for the explanation. for those who are curious enough, see also https://build.opensuse.org/package/view_file/filesystems:ceph:mimic/ceph/pre_checkin.sh?expand=1, _insert_obs_source_lines_here
is used as a mark there, and will be replaced by "Source99: ceph-rpmlintrc
" by that script.
src/tools/CMakeLists.txt
Outdated
@@ -29,6 +30,7 @@ install(TARGETS ceph-osdomap-tool DESTINATION bin) | |||
add_executable(ceph-monstore-tool ceph_monstore_tool.cc) | |||
target_link_libraries(ceph-monstore-tool os global Boost::program_options) | |||
install(TARGETS ceph-monstore-tool DESTINATION bin) | |||
if(WITH_TESTS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please just move https://github.com/ceph/ceph/blob/master/src/tools/CMakeLists.txt#L25-L33 out of the WITH_TEST
block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
ceph.spec.in
Outdated
# extract the number of processors for use with cmake | ||
%define _smp_ncpus %(echo %{_smp_mflags} | sed 's/-j//') | ||
export CEPH_PARALLEL_BUILD | ||
export CEPH_SMP_NCPUS=$(echo "$CEPH_PARALLEL_BUILD" | sed 's/-j//') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to export
these two variables. we pass them to cmake
and make
explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm exporting them so they appear in env
so the user can see their values in the build log.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think the export is dangerous in this case? If not, I would argue that it's beneficial to see the values in the build log...
ceph.spec.in
Outdated
# Parallel build settings ... | ||
# unlimit _smp_mflags in system macro | ||
%global _smp_ncpus_max 0 | ||
CEPH_PARALLEL_BUILD="%{?_smp_mflags}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just set _smp_mflags
? we are practically overriding it here. also the CEPH_PARALLEL_BUILD
is confusing, might want to use something like CEPH_MFLAGS_JOBS
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tchaikov Good question. I tried, but failed, to create the equivalent of CEPH_MFLAGS_JOBS="-j$lo_jobs"
as an RPM macro definition. That doesn't mean there is no way to get an expanded shell variable into a macro definition - just that I don't know how.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed CEPH_PARALLEL_BUILD
to CEPH_MFLAGS_JOBS
.
dca0dcb
to
ef1cf1e
Compare
022e5a2
to
651877e
Compare
34e1e50
to
9d42bd4
Compare
Here is what the parallelism-reduction codepath looks like - taken from OBS build log https://build.opensuse.org/public/build/home:smithfarm:branches:filesystems:ceph:mimic/openSUSE_Tumbleweed/x86_64/ceph/_log
|
@b-ranto Re-worked and re-tested. |
@smithfarm looks great to me, thanks a lot! I did suspect this might even help us speed up the builds on machines with enough cores/memory like the 16-core centos builder you mentioned. |
@b-ranto Not sure about the speed-up. |
The purpose of the patch is to avoid OOM condition on machines with high numbers of cores, but low memory. If you like, I can have it set |
Reinstating "needs-qa" because the PR has been completely re-worked. |
I am happy with the PR at its current state. We override the _smp_mflags option only when we need to which is imo the best approach. If there is no speed up then I suppose we are hitting I/O limits but that is no reason to limit this. The expected speed up with 12 compared to 8 cores would also be relatively small (~25% maybe?). Thanks again for doing this! |
2c81055
to
18255ad
Compare
Disable java build completely. Enable lttng build on SLES only, and only for certain architectures. Signed-off-by: Nathan Cutler <ncutler@suse.com>
Replace references to /var/adm/fillup-templates with new %_fillupdir macro Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1069468 Signed-off-by: Richard Brown <rbrown@suse.com>
With this macro, we can use a single Source0 line for all supported distros. RH/CentOS/Fedora needs the prefix, while SUSE builds in the OBS use a local tarball. Signed-off-by: Nathan Cutler <ncutler@suse.com>
18255ad
to
705eb95
Compare
Fixes RPMLINT warning "non-standard-group Development/Libraries" Also, the Group: line is only needed for SUSE so put it in an appropriate distro conditional. Signed-off-by: Nathan Cutler <ncutler@suse.com>
Sometimes the build machine has lots of processor cores and not enough memory to successfully build Ceph on all of them at once. Calculate how many parallel build processes we can sustain with the memory we have and set a lower build parallelism if necessary. Never exceed the value set by %_smp_mflags even if memory is aplenty. Credits to Tomáš Chvátal for the original idea and implementation. Signed-off-by: Nathan Cutler <ncutler@suse.com>
Signed-off-by: Nathan Cutler <ncutler@suse.com>
As a follow-up to d7b493a we need to stop guarding ceph-osdomap-tool ceph-monstore-tool with WITH_TESTS because they have been moved out of the ceph-test package. (N.B. ceph-kvstore-tool was also moved out of ceph-test, but apparently never had the guard.) Signed-off-by: Nathan Cutler <ncutler@suse.com>
705eb95
to
e020ec3
Compare
Rebased to fix wrong Group name in "build/ops: rpm: fix Group for rados-objclass-devel subpackage" |
This PR passed a rados run here: http://pulpito.ceph.com/smithfarm-2018-01-24_19:46:55-rados-wip-smithfarm-testing-distro-basic-smithi/ 197 of 202 tests passed. Failed tests:
Two tests are still running. |
Set build parallelism based on available memory (avoids OOM on machines that have lots of cores, but little memory) and other changes needed to build master in the openSUSE Build Service (OBS).