use Inline 'C' => Config => BUILD_NOISY => 1; use Inline 'C' => Config => CCFLAGSEX => '-O3 -fopenmp'; use Inline 'C' => config => LIBS => '-lgomp'; use Inline 'C' => <<'END_C', CLEAN_AFTER_BUILD => 0; // C code END_C #### #!/usr/bin/env perl use strict; use warnings; use Inline 'C' => Config => CCFLAGSEX => '-O3'; use Inline 'C' => <<'END_C'; #include #include int escapes( double cr, double ci, int it ) { double zr = 0; double zi = 0; double zrtmp; int i; for(i=0; i 4) { return 1; } } return 0; } SV* mandel( int yc_beg, int yc_end, double xmin, double xmax, int xstep, double ymin, double ymax, int ystep, int iters ) { int yc, len; SV *buf = newSVpvn("", 0); // array of string to store result char *m = (char *) malloc(ystep * (xstep + 1) * sizeof(char)); for(yc = yc_beg; yc <= yc_end; yc++) { double y = yc*(ymax-ymin)/ystep + ymin; int xc; for(xc=0; xc 1, max_workers => $ENV{'MCE_NUM_THREADS'} || 'auto', gather => MCE::Candy::out_iter_fh(\*STDOUT) ); mce_flow_s sub { my ($mce, $sequence_ref, $chunk_id) = @_; my ($yc_beg, $yc_end) = @$sequence_ref; my $buf = mandel($yc_beg, $yc_end, -2.0, 1.0, 256, -1.0, 1.0, 256, 100000); MCE->gather($chunk_id, $buf); }, 0, 255;