Changes between Version 58 and Version 59 of DRM4G/Tutorial


Ignore:
Timestamp:
Jun 28, 2016 9:10:57 AM (6 years ago)
Author:
carlos
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DRM4G/Tutorial

    v58 v59  
    214214== Single Job ==
    215215
    216 * C code :
    217 {{{
    218 #!cpp
    219 #include <stdio.h>
    220 #include <string.h>
    221 #include <stdlib.h>
    222 
    223 int main (int argc, char** args)
    224 {
    225   int task_id;
    226   int total_tasks;
    227   long long int n;
    228   long long int i;
    229 
    230   double l_sum, x, h;
    231 
    232   task_id = 0;
    233   total_tasks = 100;
    234   n = atoll(args[1]);
    235 
    236   fprintf(stderr, "task_id=%d total_tasks=%d n=%lld\n", task_id, total_tasks, n);
    237 
    238   h = 1.0/n;
    239 
    240   l_sum = 0.0;
    241 
    242   for (i = task_id; i < n; i += total_tasks)
    243   {
    244     x = (i + 0.5)*h;
    245     l_sum += 4.0/(1.0 + x*x);
    246   }
    247 
    248   l_sum *= h;
    249 
    250   printf("%0.12g\n", l_sum);
    251 
    252   return 0;
    253 }
    254 }}}
     216* C binary
    255217
    256218* DRM4G job template :
    257219{{{
    258220EXECUTABLE  = pi.sh
    259 ARGUMENTS   = 100000000
     221ARGUMENTS   = 0 1 100000000
    260222STDOUT_FILE = stdout_file.${JOB_ID}
    261223STDERR_FILE = stderr_file.${JOB_ID}
     
    267229#!sh
    268230#!/bin/bash
    269 gcc -o pi pi.c
    270231chmod +x ./pi
    271 ./pi
     232./pi @
    272233}}}
    273234== Array Job ==