From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id CLCQFuLxcmUVOgEAauVa8A:P1 (envelope-from ) for ; Fri, 08 Dec 2023 11:37:22 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id CLCQFuLxcmUVOgEAauVa8A (envelope-from ) for ; Fri, 08 Dec 2023 11:37:22 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1C7B825D02 for ; Fri, 8 Dec 2023 11:37:22 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=free.fr header.s=smtp-20201208 header.b=c9ifzLHz; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=free.fr ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1702031842; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=NWzd6GwPREAshBLwScTvj+Y0/Y5CWjndp2/XZRH/jFw=; b=mp/7oUI6tqs/5iqgpFeqFHMW/nYld7m36tymcKWvJuO9cQA1D2M0hPaibr7vGKiqDV67Jr wvalUpZAy/fE+w16VxSiwGafZgA3mEqNYKD6eSnQib5A+AacBvlPdmli2N3dBlu/knGNZJ JRtYvSjdNNR0UDFnGdC40CBka3GYyd33MIE0OzgHkbNA7oduOaBb37olRklzK+nyEnFyr6 6ps1Z5Po1V9HpMyXlPygi5G5o5wcygMQIkqXP3FfStj+uHmXQuCj1H/i9VELinStJOisAM 6wK1/McKj08E33hucrlBfW7BE0X+UVacvtH9slea+8+J58EFwNIqKcrjKtuxcA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=free.fr header.s=smtp-20201208 header.b=c9ifzLHz; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=free.fr ARC-Seal: i=1; s=key1; d=yhetil.org; t=1702031842; a=rsa-sha256; cv=none; b=ZKc2DNEEWgXiITlKktJsncwmdZ5favy/qJgr0Si9CL9yWfGH76/YN4eedDhF93YCRTek2j 1DWB7wjebmq0rY1LxO020BZ6zUhZ0+7ULFB28tsRboe8BMIVSGl2Zx90Atw2yln4T+kqy5 FGxsIh3XV1xqpW4Fdy6MQBNtlPgLGY1q4+OMgE9msZGR8KV1q2i2dezsYTRfvEaxr8AJvA 2t0kuqwdTIAhuoBZxju9XM4fbOloKEol2SW0yBWVo+m/GiC9mGLp+2d/RprV09uJcleIuA VFdvaad2CxczrWzyx9tK/ygKF4H7TvgnQ1g+o8Q21SKH47ZmI9QwxiyrbYZIGQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rBYDM-0006Cw-FV; Fri, 08 Dec 2023 05:36:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBYDK-0006CV-9r for emacs-orgmode@gnu.org; Fri, 08 Dec 2023 05:36:10 -0500 Received: from smtp2-g21.free.fr ([212.27.42.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBYDH-00022n-PM for emacs-orgmode@gnu.org; Fri, 08 Dec 2023 05:36:10 -0500 Received: from [IPV6:2a01:e35:39f3:4610:87d5:ffdc:add8:65a9] (unknown [IPv6:2a01:e35:39f3:4610:87d5:ffdc:add8:65a9]) (Authenticated sender: tbanelwebmin@free.fr) by smtp2-g21.free.fr (Postfix) with ESMTPSA id 0ECA52003D3 for ; Fri, 8 Dec 2023 11:36:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=free.fr; s=smtp-20201208; t=1702031763; bh=9ZoLRKkPiubTjnyOvbP4NfG/qp3eJFssmXkjHV4RCq4=; h=Date:Subject:To:References:From:In-Reply-To:From; b=c9ifzLHzKDIiiIWEC9/YhCJnI2pwq9JonBAX/rDpGpQ8ndXTHNKoUcMnYhRvDLI1N FfhSm4P1Gs6+9Y60Fav4fQ9TyCcZ6ltQG4HkZBheIwoXlrvpoYz1Yv6sfM7MNF0UEl VInF9tLrGeQqcILIEzx7wu0iVlmoBHzLbJwcJJlxwg8RWsTU/Y73vlyEXC3XeGEWZ7 c3TyOmFXuCbOFW+hqOOkllm7auHRwKlA4oMLYqqpWdVfx8bgL1pi6SolA9Vcd8kRzg 5kEB7oTlGukq6h7eSceoG4ou2e8MBcHhPfsBBTgJMVK5eS024RxsctA6UaQmdTB27Q WPtshPFJzgsWQ== Message-ID: <6efe8fc4-c12f-e128-8d7e-9e32887b127c@free.fr> Date: Fri, 8 Dec 2023 11:36:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: How to use mpirun with C or C++ Org-babel? To: emacs-orgmode@gnu.org References: <1819406926.505980.1701990611441@fidget.co-bxl> Content-Language: fr, en-US From: tbanelwebmin In-Reply-To: <1819406926.505980.1701990611441@fidget.co-bxl> Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=212.27.42.2; envelope-from=tbanelwebmin@free.fr; helo=smtp2-g21.free.fr X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, MIME_HTML_ONLY=0.1, NICE_REPLY_A=-2.264, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -7.43 X-Spam-Score: -7.43 X-Migadu-Queue-Id: 1C7B825D02 X-Migadu-Scanner: mx12.migadu.com X-TUID: 7rE9Ddnmw1pt On 23-12-08 00:10, Edgar Lux wrote:
Hello, I found [1][2] that it is possible to change the compiler for C and C++ source blocks. I would like to know if there is a way to add =mpirun -np 2= (where 2 can be any other number) to run the resulting executable. Thanks! [1] https://orgmode.org/worg//org-contrib/babel/languages/ob-doc-C.html [2] https://github.com/gheber/literate-hdf5

I guess you want to run the executable after it has been compiled, with a command like this one:

mpirun -np 2 /tmp/babel-ad2pdk/C-bin-JTvjS4

Currently it is not possible.


There is the :cmdline specifier which adds parameters to the executable, like this:

#+begin_src C++ :cmdline AAA BBB CCC
int main (int nargs, char** argv)
{
   // argv will be {
   //   "/tmp/babel-ad2pdk/C-bin-JTvjS4",
   //   "AAA",
   //   "BBB",
   //   "CCC"
   // }
}
#+end_src

Those parameters come AFTER the executable, whereas mpirun should come BEFORE the executable.

An extension may be written in ob-C.el, in the org-babel-C-execute function.
The relevant line is:
  (concat tmp-bin-file cmdline)

If you want to contribute...