From owner-freebsd-hackers@freebsd.org Wed Feb 20 17:35:31 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5C6614FA32A for ; Wed, 20 Feb 2019 17:35:30 +0000 (UTC) (envelope-from farhan@farhan.codes) Received: from mail.farhan.codes (mail.farhan.codes [155.138.165.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6DD188A77B for ; Wed, 20 Feb 2019 17:35:29 +0000 (UTC) (envelope-from farhan@farhan.codes) Received: from mail.farhan.codes (unknown [172.16.0.4]) by mail.farhan.codes (Postfix) with ESMTPSA id 145AB113EB for ; Wed, 20 Feb 2019 12:35:21 -0500 (EST) MIME-Version: 1.0 Date: Wed, 20 Feb 2019 17:35:21 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: RainLoop/1.12.1 From: "Farhan Khan" Message-ID: <2fcd9aee092730e11880c3ae88de4898@farhan.codes> Subject: Optimize execution of processes by CPU core To: freebsd-hackers@freebsd.org X-Rspamd-Queue-Id: 6DD188A77B X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.01 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[farhan.codes:s=mail]; NEURAL_HAM_MEDIUM(-0.94)[-0.941,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_SPAM_SHORT(0.80)[0.803,0]; MX_GOOD(-0.01)[mail.farhan.codes]; DKIM_TRACE(0.00)[farhan.codes:+]; DMARC_POLICY_ALLOW(-0.50)[farhan.codes,reject]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; IP_SCORE(0.14)[asn: 20473(0.75), country: US(-0.07)]; ASN(0.00)[asn:20473, ipnet:155.138.160.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2019 17:35:31 -0000 Hi all,=0A=0AI am trying to optimize the execution of a CPU-intensive wor= kload where I am running multiple instances of a program. The moment the = program ends (expected behavior), the calling shell script verifies the r= esults and if its good it reruns the program. The machines I am running t= his on have 8 cores, but ps reports that some of the processes frequently= run on the same CPU, so I suspect I am not getting optimized performance= . If possible, and if most efficient, I would like to run each process on= its own CPU core.=0A=0AAre there any best practices on how to run someth= ing like this? I understand cpuset can perform some functionality around = this, but I do not understand the tooling (The man page speaks of a CPU s= et?) Would I do something like "cpuset -c -l 0 program arg1 arg2 arg3" in= one script, and then "cpuset -c -l 1 program arg1 arg2 arg3" in the next= up to 7?=0A=0AObviously it would be best to re-write the program to hand= le multiple threads in in an optimized way, but that would take more time= than the optimization would likely save.=0A=0AThanks,=0A=0A---=0AFarhan = Khan