简体   繁体   English

Unix命令行提示符下的GNU并行安装

[英]GNU Parallel Setup on Unix command line prompt

I have ac program that takes an input through either the standard input main(argc) or an input via a scanf() call. 我有一个ac程序,它通过标准输入main(argc)或通过scanf()调用来输入。

It is setup such that if there is no suitable standard input that it uses scanf() calls to ask for an input. 它的设置方式是,如果没有合适的标准输入,它将使用scanf()调用来请求输入。

I am trying to use gnu parallel to launch multiple versions of this program with different input values. 我正在尝试使用gnu parallel启动具有不同输入值的该程序的多个版本。 The program takes 2 integers as inputs, so for example: 该程序将2个整数作为输入,因此:

printf("\nEnter Start Line (0 for first line) :");
scanf ("%d",&startline);

printf("\nEnter End Line:");
scanf ("%d",&endline);

The inputs would also be incremental, so if the inputs to the first file were 0 10 then the second file inputs would be 10 20 third file 20 30 etc. 输入也将是增量输入,因此,如果第一个文件的输入为0 10,那么第二个文件的输入将为10 20第三个文件20 30等等。

I am just having difficulty constructing the right call to make what I want happen. 我只是在构建正确的电话以实现我想要的事情方面遇到困难。 Does anyone have any thoughts on this? 有人对此有任何想法吗?

Thanks 谢谢

So your program reads from STDIN and you want the input chopped up in 2 line chunks that are each passed to your program: 因此,您的程序从STDIN读取数据,并且希望将输入切成两行,分别传递给您的程序:

cat your_input | parallel --pipe -N2 your_program

Example: 例:

seq 10 | parallel --pipe -N2 echo "NEW"\; cat

Spend an hour walking through the tutorial. 花一个小时来完成本教程。 Your command line will love you for it. 您的命令行会为此而爱您。 http://www.gnu.org/software/parallel/parallel_tutorial.html#gnu_parallel_tutorial http://www.gnu.org/software/parallel/parallel_tutorial.html#gnu_parallel_tutorial

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM