From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 226A66ECE3; Wed, 6 Jul 2022 00:22:56 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 226A66ECE3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1657056176; bh=SEYwl7c1uuy50ESXxgFLRvl85V5LMoOHSSwH3KOVpus=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=DJ5oZi0UbWQLMxQo0NF3tzRCqztOF7VrCQNZG5ZVQ2x83zZ6/sdYW6o3io6DOgHLd /yr0b2E8xQPCRrVTotGeIuUG70CIotzfc7z+kpVFgh7hBJ79uZ5deWJTqVDa3o5CGz XvQlQFPQgV2KRyzkdqKFp8ow4bvxXQK44OM+Dr3g= Received: from smtpng2.i.mail.ru (smtpng2.i.mail.ru [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 734A56ECE3 for ; Wed, 6 Jul 2022 00:22:54 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 734A56ECE3 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1o8q0T-0001JP-DQ; Wed, 06 Jul 2022 00:22:53 +0300 Date: Wed, 6 Jul 2022 00:22:51 +0300 To: Sergey Bronnikov Message-ID: References: <62acf609d9e1ea43d95cb27213e1b8f1331b57a7.1656685987.git.sergeyb@tarantool.org> <721f8709-cf2b-b2df-0672-cfd6f9cf1efb@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <721f8709-cf2b-b2df-0672-cfd6f9cf1efb@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD987C0EE6E7F0A597D66D9C984A0F8A3F6AB0D5DEDD89A6EB3CD62213F67905E7A67A721FE29474207FEA899EEEFD323701C9A6CE7051F60152D5CFE12AD13DA04 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE705B093C0FC4B30B9EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006375D8840FA58F505298638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8AFA12EED5732BACB8F44E052B9F7C35A117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6D0C9BB9AE6BD5D69089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-8FC586DF: 6EFBBC1D9D64D975 X-C1DE0DAB: 9604B64F49C60606AD91A466A1DEF99B296C473AB1E142185AC9E3593CE4B31AB1881A6453793CE9274300E5CE05BD4401A9E91200F654B0085D06609CA6A4F7699E857C12730288FB7C741B914B24EC90EA52875FF89AF69C2B6934AE262D3EE7EAB7254005DCED8DA55E71E02F9FC08E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34AC632F0BE69382F3FBC827D9225A821BEC1A6F415BCB4E061C36B2889CA06C3952FAC58993FF99011D7E09C32AA3244CE2D34C992E2D3435C0ED32E376C98F233FD9C8CA1B0515E083B48618A63566E0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojDSjrPsecpvof8wZWnTQjzQ== X-Mailru-Sender: 689FA8AB762F7393CC2E0F076E87284E655B87B0FD25E79A89876CADAD634114A7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E3365FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH] build: configure parallel jobs X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Sergey, Thanks for the fixes. LGTM, with a couple more nits. On 04.07.22, Sergey Bronnikov wrote: > Igor, thanks for review! > > On 04.07.2022 13:12, Igor Munkin wrote: > > Sergey, > > > > Thanks for the patch! Please consider my several nits below. > > > > On 01.07.22, Sergey Bronnikov wrote: > >> diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt > >> index ba25af54..fc4ffc51 100644 > >> --- a/test/CMakeLists.txt > >> +++ b/test/CMakeLists.txt > >> @@ -43,6 +43,19 @@ endif() > >> set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]") > >> separate_arguments(LUAJIT_TEST_COMMAND) > >> > > I guess all code below can be moved to a function somewhere in cmake/ > > and its usage -- to the root CMakeLists.txt. Thoughts? > > Agree. Initial idea was to parallelize tests only, > > but with CMAKE_BUILD_PARALLEL_LEVEL it works for building process too. > > Moved hunk to the root CMakeLists.txt right after building compile options > > and flags and before adding subdirectories, because code in lower levels > can depend on this option. I still believe this should be moved to a separate module in cmake/ directory (like it's done for SetVersion). Please, also move it's usage to "Fine-tuning cmake environment" section in root CMakeLists.txt to group most of includes there. > > >> +set(CMAKE_BUILD_PARALLEL_LEVEL $ENV{CMAKE_BUILD_PARALLEL_LEVEL}) > >> +if(NOT CMAKE_BUILD_PARALLEL_LEVEL) > >> + include(ProcessorCount) > >> + ProcessorCount(N) > >> + # Function ProcessorCount() is guaranteed to return a positive integer (>=1) > >> + # if it succeeds. It returns 0 if there's a problem determining the processor > >> + # count. > >> + if(NOT N EQUAL 0) > >> + set(CMAKE_BUILD_PARALLEL_LEVEL ${N}) > > I believe we need else branch here to set CMAKE_BUILD_PARALLEL_LEVEL, if > > ProcessorCount yields zero. > > I would do it without additional branch. Like this: > >   set(CMAKE_BUILD_PARALLEL_LEVEL 1) >   if(NOT N EQUAL 0) >     set(CMAKE_BUILD_PARALLEL_LEVEL ${N}) >   endif() > > Are you ok with this? Great, thanks! > > > >> -- > >> 2.25.1 > >> All in all, if you've introduced the machinery to control parallel level of CMake jobs, we can also fix our workflows in a separate commit by changing --parallel parameter with CMAKE_BUILD_PARALLEL_LEVEL envvar. So the following approach... | $ cmake . | $ cmake . --build --parallel $(nproc) --target test ... is replaced with the next one... | $ CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) cmake . | $ cmake . --build --parallel ... considering the comment[1] in CMAKE_BUILD_PARALLEL_LEVEL manual. [1]: https://cmake.org/cmake/help/latest/envvar/CMAKE_BUILD_PARALLEL_LEVEL.html -- Best regards, IM