./PaxHeaders.30520/parallel-3.1.30000644000000000000000000000013213331003466013117 xustar0030 mtime=1533282102.530477418 30 atime=1533282233.633065964 30 ctime=1533282233.633065964 parallel-3.1.3/0000755000175000017500000000000013331003466013235 5ustar00olafolaf00000000000000parallel-3.1.3/PaxHeaders.30520/INDEX0000644000000000000000000000013013331003466013627 xustar0029 mtime=1533282102.52247726 29 atime=1533282102.52247726 30 ctime=1533282233.633065964 parallel-3.1.3/INDEX0000644000175000017500000000041013331003466014022 0ustar00olafolaf00000000000000parallel >> Parallel Computing Single Machine parcellfun pararrayfun Clusters psend precv reval pserver pconnect sclose select_sockets parallel_generate_srp_data network_get_info network_set rfeval install_vars netcellfun netarrayfun General select parallel-3.1.3/PaxHeaders.30520/Makefile0000644000000000000000000000013213331003466014477 xustar0030 mtime=1533282102.526477339 30 atime=1533282102.526477339 30 ctime=1533282233.633065964 parallel-3.1.3/Makefile0000644000175000017500000002064313331003466014702 0ustar00olafolaf00000000000000## Copyright 2015-2016 Carnë Draug ## Copyright 2015-2016 Oliver Heimlich ## Copyright 2017 Julien Bect ## Copyright 2017 Olaf Till ## ## Copying and distribution of this file, with or without modification, ## are permitted in any medium without royalty provided the copyright ## notice and this notice are preserved. This file is offered as-is, ## without any warranty. ## Some basic tools (can be overriden using environment variables) SED ?= sed TAR ?= tar GREP ?= grep CUT ?= cut TR ?= tr ## Note the use of ':=' (immediate set) and not just '=' (lazy set). ## http://stackoverflow.com/a/448939/1609556 package := $(shell $(GREP) "^Name: " DESCRIPTION | $(CUT) -f2 -d" " | \ $(TR) '[:upper:]' '[:lower:]') version := $(shell $(GREP) "^Version: " DESCRIPTION | $(CUT) -f2 -d" ") ## These are the paths that will be created for the releases. target_dir := target release_dir := $(target_dir)/$(package)-$(version) release_tarball := $(target_dir)/$(package)-$(version).tar.gz html_dir := $(target_dir)/$(package)-html html_tarball := $(target_dir)/$(package)-html.tar.gz ## Using $(realpath ...) avoids problems with symlinks due to bug ## #50994 in Octaves scripts/pkg/private/install.m. But at least the ## release directory above is needed in the relative form, for 'git ## archive --format=tar --prefix=$(release_dir). real_target_dir := $(realpath .)/$(target_dir) installation_dir := $(real_target_dir)/.installation package_list := $(installation_dir)/.octave_packages install_stamp := $(installation_dir)/.install_stamp ## These can be set by environment variables which allow to easily ## test with different Octave versions. ifndef OCTAVE OCTAVE := octave endif OCTAVE := $(OCTAVE) --no-gui --silent --norc MKOCTFILE ?= mkoctfile ## Command used to set permissions before creating tarballs FIX_PERMISSIONS ?= chmod -R a+rX,u+w,go-w,ug-s ## Detect which VCS is used vcs := $(if $(wildcard .hg),hg,$(if $(wildcard .git),git,unknown)) ifeq ($(vcs),hg) release_dir_dep := .hg/dirstate endif ifeq ($(vcs),git) release_dir_dep := .git/index endif ## .PHONY indicates targets that are not filenames ## (https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html) .PHONY: help ## make will display the command before runnning them. Use @command ## to not display it (makes specially sense for echo). help: @echo "Targets:" @echo " dist - Create $(release_tarball) for release." @echo " html - Create $(html_tarball) for release." @echo " release - Create both of the above and show md5sums." @echo " install - Install the package in $(installation_dir), where it is not visible in a normal Octave session." @echo " check - Execute package tests." @echo " doctest - Test the help texts with the doctest package." @echo " run - Run Octave with the package installed in $(installation_dir) in the path." @echo " clean - Remove everything made with this Makefile." ## ## Recipes for release tarballs (package + html) ## .PHONY: release dist html clean-tarballs clean-unpacked-release ## To make a release, build the distribution and html tarballs. release: dist html md5sum $(release_tarball) $(html_tarball) @echo "Upload @ https://sourceforge.net/p/octave/package-releases/new/" @echo " and note the changeset the release corresponds to" ## dist and html targets are only PHONY/alias targets to the release ## and html tarballs. dist: $(release_tarball) html: $(html_tarball) ## An implicit rule with a recipe to build the tarballs correctly. %.tar.gz: % $(TAR) -c -f - --posix -C "$(target_dir)/" "$(notdir $<)" | gzip -9n > "$@" clean-tarballs: @echo "## Cleaning release tarballs (package + html)..." -$(RM) $(release_tarball) $(html_tarball) @echo ## Create the unpacked package. ## ## Notes: ## * having ".hg/dirstate" (or ".git/index") as a prerequesite means it is ## only rebuilt if we are at a different commit. ## * the variable RM usually defaults to "rm -f" ## * having this recipe separate from the one that makes the tarball ## makes it easy to have packages in alternative formats (such as zip) ## * note that if a commands needs to be run in a specific directory, ## the command to "cd" needs to be on the same line. Each line restores ## the original working directory. $(release_dir): $(release_dir_dep) -$(RM) -r "$@" ifeq (${vcs},hg) hg archive --exclude ".hg*" --type files "$@" endif ifeq (${vcs},git) git archive --format=tar --prefix="$@/" HEAD | $(TAR) -x $(RM) "$@/.gitignore" endif ## Don't fall back to run the supposed necessary contents of ## 'bootstrap' here. Users are better off if they provide ## 'bootstrap'. Administrators, checking build reproducibility, can ## put in the missing 'bootstrap' file if they feel they know its ## necessary contents. ifneq (,$(wildcard src/bootstrap)) cd "$@/src" && ./bootstrap && $(RM) -r "autom4te.cache" endif ## Uncomment this if your src/Makefile.in has these targets for ## pre-building something for the release (e.g. documentation). cd "$@/src" && ./configure && $(MAKE) prebuild && \ $(MAKE) distclean && $(RM) Makefile ## ${FIX_PERMISSIONS} "$@" run_in_place = $(OCTAVE) --eval ' pkg ("local_list", "$(package_list)"); ' \ --eval ' pkg ("load", "$(package)"); ' # html_options = --eval 'options = get_html_options ("octave-forge");' ## Uncomment this for package documentation. html_options = --eval 'options = get_html_options ("octave-forge");' \ --eval 'options.package_doc = "$(package).texi";' $(html_dir): $(install_stamp) $(RM) -r "$@"; $(run_in_place) \ --eval ' pkg load generate_html; ' \ $(html_options) \ --eval ' generate_package_html ("$(package)", "$@", options); '; $(FIX_PERMISSIONS) "$@"; clean-unpacked-release: @echo "## Cleaning unpacked release tarballs (package + html)..." -$(RM) -r $(release_dir) $(html_dir) @echo ## ## Recipes for installing the package. ## .PHONY: install clean-install octave_install_commands = \ ' llist_path = pkg ("local_list"); \ mkdir ("$(installation_dir)"); \ load (llist_path); \ local_packages(cellfun (@ (x) strcmp ("$(package)", x.name), local_packages)) = []; \ save ("$(package_list)", "local_packages"); \ pkg ("local_list", "$(package_list)"); \ pkg ("prefix", "$(installation_dir)", "$(installation_dir)"); \ pkg ("install", "-local", "-verbose", "$(release_tarball)"); ' ## Install unconditionally. Maybe useful for testing installation with ## different versions of Octave. install: $(release_tarball) @echo "Installing package under $(installation_dir) ..." $(OCTAVE) --eval $(octave_install_commands) touch $(install_stamp) ## Install only if installation (under target/...) is not current. $(install_stamp): $(release_tarball) @echo "Installing package under $(installation_dir) ..." $(OCTAVE) --eval $(octave_install_commands) touch $(install_stamp) clean-install: @echo "## Cleaning installation under $(installation_dir) ..." -$(RM) -r $(installation_dir) @echo ## ## Recipes for testing purposes ## .PHONY: run doctest check ## Start an Octave session with the package directories on the path for ## interactice test of development sources. run: $(install_stamp) $(run_in_place) --persist ## Test example blocks in the documentation. Needs doctest package ## https://octave.sourceforge.io/doctest/index.html doctest: $(install_stamp) $(run_in_place) --eval 'pkg load doctest;' \ --eval "targets = '$(shell (ls inst; ls src | $(GREP) .oct) | $(CUT) -f2 -d@ | $(CUT) -f1 -d.)';" \ --eval "targets = strsplit (targets, ' '); doctest (targets);" ## Test package. octave_test_commands = \ ' dirs = {"inst", "src"}; \ dirs(cellfun (@ (x) ! isdir (x), dirs)) = []; \ if (isempty (dirs)) error ("no \"inst\" or \"src\" directory"); exit (1); \ else __run_test_suite__ (dirs, {}); endif ' ## the following works, too, but provides no overall summary output as ## __run_test_suite__ does: ## ## else cellfun (@runtests, horzcat (cellfun (@ (dir) ostrsplit (([~, dirs] = system (sprintf ("find %s -type d", dir))), "\n\r", true), dirs, "UniformOutput", false){:})); endif ' check: $(install_stamp) $(run_in_place) --eval $(octave_test_commands) ## ## CLEAN ## .PHONY: clean clean: clean-tarballs clean-unpacked-release clean-install @echo "## Removing target directory (if empty)..." -rmdir $(target_dir) @echo @echo "## Cleaning done" @echo parallel-3.1.3/PaxHeaders.30520/inst0000644000000000000000000000013213331003466013737 xustar0030 mtime=1533282102.530477418 30 atime=1533282233.633065964 30 ctime=1533282233.633065964 parallel-3.1.3/inst/0000755000175000017500000000000013331003466014212 5ustar00olafolaf00000000000000parallel-3.1.3/inst/PaxHeaders.30520/__parallel_package_version__.m0000644000000000000000000000013213331003466022002 xustar0030 mtime=1533282102.526477339 30 atime=1533282227.396942838 30 ctime=1533282233.633065964 parallel-3.1.3/inst/__parallel_package_version__.m0000644000175000017500000000044513331003466022203 0ustar00olafolaf00000000000000## This file is granted to the public domain. ## -*- texinfo -*- ## @deftypefn{Function File} {} __parallel_package_version__ () ## ## Internal function, returns version of parallel package. ## ## @end deftypefn function ver = __parallel_package_version__ () ver = "3.0.4"; endfunction parallel-3.1.3/inst/PaxHeaders.30520/parcellfun.m0000644000000000000000000000013213331003466016325 xustar0030 mtime=1533282102.530477418 30 atime=1533282227.396942838 30 ctime=1533282233.633065964 parallel-3.1.3/inst/parcellfun.m0000644000175000017500000004001013331003466016516 0ustar00olafolaf00000000000000## Copyright (C) 2009 VZLU Prague, a.s., Czech Republic ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn{Function File} {[@var{o1}, @var{o2}, @dots{}] =} parcellfun (@var{nproc}, @var{fun}, @var{a1}, @var{a2}, @dots{}) ## @deftypefnx{Function File} {} parcellfun (nproc, fun, @dots{}, "UniformOutput", @var{val}) ## @deftypefnx{Function File} {} parcellfun (nproc, fun, @dots{}, "ErrorHandler", @var{errfunc}) ## @deftypefnx{Function File} {} parcellfun (nproc, fun, @dots{}, "VerboseLevel", @var{val}) ## @deftypefnx{Function File} {} parcellfun (nproc, fun, @dots{}, "ChunksPerProc", @var{val}) ## @deftypefnx{Function File} {} parcellfun (nproc, fun, @dots{}, "CumFunc", @var{cumfunc}) ## Evaluates a function for multiple argument sets using multiple processes. ## @var{nproc} should specify the number of processes. A maximum recommended value is ## equal to number of CPUs on your machine or one less. ## @var{fun} is a function handle pointing to the requested evaluating function. ## @var{a1}, @var{a2} etc. should be cell arrays of equal size. ## @var{o1}, @var{o2} etc. will be set to corresponding output arguments. ## ## The UniformOutput and ErrorHandler options are supported with meaning identical ## to @dfn{cellfun}. ## A VerboseLevel option controlling the level output is supported. ## A value of 0 is quiet, 1 is normal, and 2 or more enables ## debugging output. ## The ChunksPerProc option control the number of chunks which contains elementary jobs. This ## option particularly useful when time execution of function is small. Setting this option ## to 100 is a good choice in most cases. ## ## Instead of returning a result for each argument, parcellfun returns ## only one cumulative result if "CumFunc" is non-empty. @var{cumfunc} ## must be a function which performs an operation on two sets of ## outputs of @var{fun} and returnes as many outputs as @var{fun}. If ## @var{nout} is the number of outputs of @var{fun}, @var{cumfunc} ## gets a previous output set of @var{fun} or of @var{cumfunc} as ## first @var{nout} arguments and the current output of @var{fun} as ## last @var{nout} arguments. The performed operation must be ## mathematically commutative and associative. If the operation is ## e.g. addition, the result will be the sum(s) of the outputs of ## @var{fun} over all calls of @var{fun}. Since floating point ## addition and multiplication are only approximately associative, the ## cumulative result will not be exactly reproducible. ## ## Notice that jobs are served from a single first-come first-served queue, ## so the number of jobs executed by each process is generally unpredictable. ## This means, for example, that when using this function to perform Monte-Carlo ## simulations one cannot expect results to be exactly reproducible. The pseudo ## random number generators of each process are initialised with a unique state. ## This currently works only for new style generators. ## ## NOTE: this function is implemented using "fork" and a number of pipes for IPC. ## Suitable for systems with an efficient "fork" implementation (such as GNU/Linux), ## on other systems (Windows) it should be used with caution. ## Also, if you use a multithreaded BLAS, it may be wise to turn off multi-threading ## when using this function. ## ## CAUTION: This function should be regarded as experimental. Although all subprocesses ## should be cleared in theory, there is always a danger of a subprocess hanging up, ## especially if unhandled errors occur. Under GNU and compatible systems, the following ## shell command may be used to display orphaned Octave processes: ## ps --ppid 1 | grep octave ## ## @end deftypefn ## Author: Jaroslav Hajek ## Several improvements thanks to: Travis Collier ## CumFunc feature added by Olaf Till function varargout = parcellfun (nproc, fun, varargin) ## The list of functions to be seeded in each slave. persistent random_func_list = {@rand, @randn, @rande, @randp, @randg}; if (nargin < 3 || ! isscalar (nproc) || nproc <= 0) print_usage (); endif if (ischar (fun)) fun = str2func (fun); elseif (! isa (fun, "function_handle")) error ("parcellfun: fun must be either a function handle or name") endif [nargs, uniform_output, error_handler, verbose_level, ... chunks_per_proc, cumfunc] = parcellfun_opts ("parcellfun", varargin); accumulate = ifelse (isempty (cumfunc), false, true); args = varargin(1:nargs); if (! all (cellfun ("isclass", args, "cell"))) error ("parcellfun: all non-option arguments except the first one must be cell arrays"); endif if (nargs == 0) print_usage (); elseif (nargs > 1) [err, args{:}] = common_size (args{:}); if (err) error ("parcellfun: arguments size must match"); endif endif njobs = numel (args{1}); if (chunks_per_proc > 0 && chunks_per_proc < njobs / nproc) ## We need chunked evaluation. if (accumulate) chunk_uniform_output = false; else chunk_uniform_output = uniform_output; endif ## Function executed for a chunk. if (isempty (error_handler)) chunk_fun = @(varargin) cellfun (fun, varargin{:}, "UniformOutput", chunk_uniform_output); else chunk_fun = @(varargin) cellfun (fun, varargin{:}, "UniformOutput", chunk_uniform_output, "ErrorHandler", error_handler); endif if (accumulate) chunk_fun = @(varargin) acc_chunk_fun (cumfunc, chunk_fun, varargin{:}); endif [varargout{1:nargout}] = chunk_parcellfun (nproc, chunks_per_proc, chunk_fun, [], verbose_level, cumfunc, uniform_output, args{:}); return endif nproc = min (nproc, numel (args{1})); ## create communication pipes. cmdr = cmdw = resr = resw = zeros (nproc, 1); err = 0; for i = 1:nproc ## command pipes [cmdr(i), cmdw(i), err, msg] = pipe (); if (err) break; endif ## result pipes [resr(i), resw(i), err, msg] = pipe (); if (err) break; endif endfor if (! err) ## status pipe [statr, statw, err, msg] = pipe (); endif if (err) error ("failed to open pipe: %s", msg); endif iproc = 0; # the parent process nsuc = 0; # number of processes succesfully forked. fflush (stdout); # prevent subprocesses from inheriting buffered output ## get a seed and change state seed = rand; pids = zeros (nproc, 1); ## fork subprocesses for i = 1:nproc [pid, msg] = fork (); if (pid > 0) ## parent process. fork succeded. nsuc ++; pids(i) = pid; if (verbose_level > 1) fprintf (stderr,"parcellfun: child process %d created\n", pids(i)); fflush (stderr); endif elseif (pid == 0) ## child process. iproc = i; break; elseif (pid < 0) ## parent process. fork failed. err = 1; break; endif endfor if (iproc) ## child process. close unnecessary pipe ends. fclose (statr); for i = 1:nproc ## we won't write commands and read results fclose (cmdw (i)); fclose (resr (i)); if (i != iproc) ## close also those pipes that don't belong to us. fclose (cmdr (i)); fclose (resw (i)); endif endfor else ## parent process. close unnecessary pipe ends. fclose (statw); for i = 1:nproc ## we won't read commands and write results fclose (cmdr (i)); fclose (resw (i)); endfor if (nproc) if (nsuc) ## we forked some processes. if this is less than we opted ## for, gripe but continue. if (nsuc < nproc) warning ("parcellfun: only %d out of %d processes forked", nsuc, nproc); nproc = nsuc; endif else ## this is bad. error ("parcellfun: failed to fork processes"); endif endif endif ## At this point, everything should be OK (?) if (iproc) ## the border patrol. we really don't want errors escape after the forks. unwind_protect try ## re-seed random number states, adjusted for each process seed *= iproc * (flintmax () - 1); # backwards compatibility cellfun (@ (fun) fun ("state", seed), random_func_list); ## child process. indicate ready state. fwrite (statw, -iproc, "double"); fflush (statw); do ## get command cmd = fread (cmdr(iproc), 1, "double"); if (cmd) ## we've got a job to do. prepare argument and return lists. res = cell (1, nargout); argsc = cell (1, nargs); for i = 1:nargs argsc{i} = args{i}{cmd}; endfor if (isempty (error_handler)) ## unguarded evaluation. [res{:}] = fun (argsc{:}); else ## guarded evaluation try [res{:}] = fun (argsc{:}); catch errs = lasterror (); # fields 'message', 'identifier', 'stack' errs.index = cmd; [res{:}] = error_handler (errs, argsc{:}); end_try_catch endif ## indicate ready state. fwrite (statw, iproc, "double"); fflush (statw); ## write the result. ## FIXME: this can fail. fsave (resw(iproc), res); fflush (resw(iproc)); endif until (cmd == 0) catch ## just indicate the error. don't quit this function !!!! fputs (stderr, "\n"); warning ("parcellfun: unhandled error in subprocess %d", iproc); ## send a termination notice. fwrite (statw, -iproc, "double"); fflush (statw); end_try_catch unwind_protect_cleanup ## This is enclosed in another handler to prevent errors from escaping. ## If something goes wrong, we'll get a broken pipe signal, but anything ## is better than skipping the following __exit__. try fclose (statw); fclose (resw(iproc)); fclose (cmdr(iproc)); end_try_catch ## no more work for us. We call __exit__, which bypasses termination sequences. __exit__ (); ## we should never get here. exit (); end_unwind_protect else ## parent process. if (accumulate) res = cell (nargout, 1); else res = cell (nargout, njobs); endif firstresult = true; pjobs = 0; stop = false; pending = zeros (1, nproc); ## we need these flags additionally to 'pending' because 1) a child ## might send a result (so pending is set to false) and yet signal ## failure and exit due to an error in sending (which would be ## mistaken for a 'ready' signal if only 'pending' is checked) and ## 2) a child might not signal to be ready until all jobs are ## finished, so pending never gets true (see where the flags are ## used) ready = false (1, nproc); terminated = false (1, nproc); unwind_protect while ((pjobs < njobs && ! stop) || any (pending)) ## wait for a process state. isubp = fread (statr, 1, "double"); ## if pipe contained no more data, that's bad if (feof (statr)) warning ("parcellfun: premature exit due to closed pipe"); break; endif if (isubp > 0) ijob = pending(isubp); ## we have a result ready. if (accumulate) if (firstresult) res(:, 1) = fload (resr(isubp)); firstresult = false; else [res{:, 1}] = cumfunc (res{:}, fload (resr(isubp)){:}); endif else res(:, ijob) = fload (resr(isubp)); endif ## clear pending state pending(isubp) = 0; else isubp = -isubp; if (ready(isubp)) ## premature exit means an unhandled error occurred in a subprocess. ## the process should have griped, we just try to exit gracefully. pending(isubp) = 0; terminated(isubp) = true; ## no more jobs to start. stop = true; ## skip the rest; don't send commands to the process. fclose(cmdw(isubp)); continue; else ready(isubp) = true; endif endif if (pjobs < njobs && ! stop) ijob = ++pjobs; ## send the next job to the process. fwrite (cmdw(isubp), ijob, "double"); fflush (cmdw(isubp)); ## set pending state pending(isubp) = ijob; else ## send terminating signal fwrite (cmdw(isubp), 0, "double"); fclose (cmdw(isubp)); terminated(isubp) = true; endif if (verbose_level > 0) fprintf (stderr, "\rparcellfun: %d/%d jobs done", pjobs - sum (pending != 0), njobs); fflush (stderr); endif endwhile if (verbose_level > 0) fputs (stderr, "\n"); fflush (stderr); endif unwind_protect_cleanup ## send termination signals to active processes. for isubp = find (! terminated) ## send terminating signal fwrite (cmdw(isubp), 0, "double"); fclose (cmdw(isubp)); endfor ## explicitly recognize all terminated processes. for i = 1:nproc if (verbose_level > 1) fprintf(stderr,"parcellfun: waiting for child process %d to close\n", pids(i)); fflush (stderr); endif [pid, status] = waitpid (pids(i)); endfor ## FIXME: I think order is possibly important here, and this is correct. ## close all pipe ends fclose (statr); for i = 1:nproc fclose (resr(i)); endfor end_unwind_protect ## we're finished. transform the result. if (accumulate) if (uniform_output) varargout = res; else varargout = num2cell (res); endif else varargout = cell (1, nargout); shape = size (varargin{1}); for i = 1:nargout ## reshape is done after cell2mat because of bug #51448 if (uniform_output) varargout{i} = cell2mat (res(i, :)); else varargout{i} = res(i, :); endif varargout{i} = reshape (varargout{i}, shape); endfor endif endif endfunction function varargout = acc_chunk_fun (cumfunc, chunk_fun, varargin) [chunk_out{1:nargout}] = chunk_fun (varargin{:}); nel = numel (chunk_out{1}); chunk_out = horzcat (chunk_out{:}); res = chunk_out(1, :); for (id = 2 : nel) [res{:}] = cumfunc (res{:}, chunk_out{id, :}); endfor varargout = res; endfunction %!test %! assert (res = parcellfun (4, @ (x, y) x * y, {1, 2, 3, 4}, {2, 3, 4, 5}, "VerboseLevel", 0), [2, 6, 12, 20]) %!test %! assert (res = parcellfun (4, @ (x, y) x * y, {1, 2, 3, 4}, {2, 3, 4, 5}, "VerboseLevel", 0, "UniformOutput", false), {2, 6, 12, 20}) %!test %! assert (res = parcellfun (2, @ (x, y) x * y, {1, 2, 3, 4}, {2, 3, 4, 5}, "VerboseLevel", 0, "ChunksPerProc", 2), [2, 6, 12, 20]) %!test %! assert (res = parcellfun (4, @ (x, y) x * y, {1, 2, 3, 4}, {2, 3, 4, 5}, "VerboseLevel", 0, "CumFunc", @ (a, b) a + b), 40) %!test %! assert (res = parcellfun (2, @ (x, y) x * y, {1, 2, 3, 4}, {2, 3, 4, 5}, "VerboseLevel", 0, "ChunksPerProc", 2, "CumFunc", @ (a, b) a + b), 40) parallel-3.1.3/inst/PaxHeaders.30520/__internal_exit__.m0000644000000000000000000000013213331003466017633 xustar0030 mtime=1533282102.526477339 30 atime=1533282227.396942838 30 ctime=1533282233.633065964 parallel-3.1.3/inst/__internal_exit__.m0000644000175000017500000000042213331003466020027 0ustar00olafolaf00000000000000## This code is in the public domain. ## -*- texinfo -*- ## @deftypefn {Function File} {} __internal_exit__ (@var{status}) ## Wrapper for __exit__ for backwards compatibility. ## @end deftypefn function __internal_exit__ (varargin) __exit__ (varargin{:}); endfunction parallel-3.1.3/inst/PaxHeaders.30520/pararrayfun.m0000644000000000000000000000013213331003466016524 xustar0030 mtime=1533282102.530477418 30 atime=1533282227.396942838 30 ctime=1533282233.633065964 parallel-3.1.3/inst/pararrayfun.m0000644000175000017500000001144713331003466016731 0ustar00olafolaf00000000000000## Copyright (C) 2009 Jaroslav Hajek ## Copyright (C) 2009 VZLU Prague, a.s., Czech Republic ## Copyright (C) 2009 Travis Collier ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn{Function File} {[@var{o1}, @var{o2}, @dots{}] =} pararrayfun (@var{nproc}, @var{fun}, @var{a1}, @var{a2}, @dots{}) ## @deftypefnx{Function File} {} pararrayfun (nproc, fun, @dots{}, "UniformOutput", @var{val}) ## @deftypefnx{Function File} {} pararrayfun (nproc, fun, @dots{}, "ErrorHandler", @var{errfunc}) ## Evaluates a function for corresponding elements of an array. ## Argument and options handling is analogical to @code{parcellfun}, except that ## arguments are arrays rather than cells. If cells occur as arguments, they are treated ## as arrays of singleton cells. ## Arrayfun supports one extra option compared to parcellfun: "Vectorized". ## This option must be given together with "ChunksPerProc" and it indicates ## that @var{fun} is able to operate on vectors rather than just scalars, and returns ## a vector. The same must be true for @var{errfunc}, if given. ## In this case, the array is split into chunks which are then directly served to @var{func} ## for evaluation, and the results are concatenated to output arrays. ## If "CumFunc" is also specified (see @code{parcellfun}), @var{fun} is ## expected to return the result of the same cumulative operation ## instead of vectors. ## @c Will be cut out in parallels info file and replaced with the same ## @c references explicitely there, since references to core Octave ## @c functions are not automatically transformed from here to there. ## @c BEGIN_CUT_TEXINFO ## @seealso{parcellfun, arrayfun} ## @c END_CUT_TEXINFO ## @end deftypefn function varargout = pararrayfun (nproc, func, varargin) if (nargin < 3) print_usage (); endif [nargs, uniform_output, error_handler, verbose_level, ... chunks_per_proc, cumfunc, vectorized] = parcellfun_opts ... ("pararrayfun", varargin); args = varargin(1:nargs); opts = varargin(nargs+1:end); if (nargs == 0) print_usage (); elseif (nargs > 1) [err, args{:}] = common_size (args{:}); if (err) error ("pararrayfun: arguments size must match"); endif endif njobs = numel (args{1}); if (vectorized && chunks_per_proc > 0 && ... chunks_per_proc < njobs / nproc) ## If "Vectorized" is on, we apply the function directly on chunks of ## arrays. if (! uniform_output && isempty (cumfunc)) func = @ (varargin) num2cell (func (varargin{:})); endif [varargout{1:nargout}] = chunk_parcellfun (nproc, chunks_per_proc, func, error_handler, verbose_level, cumfunc, uniform_output, args{:}); else args = cellfun (@num2cell, args, "UniformOutput", false, "ErrorHandler", @arg_class_error); if (chunks_per_proc == 0) chunks_per_proc = []; endif [varargout{1:nargout}] = parcellfun (nproc, func, args{:}, "UniformOutput", uniform_output, "ErrorHandler", error_handler, "VerboseLevel", verbose_level, "ChunksPerProc", chunks_per_proc, "CumFunc", cumfunc); endif endfunction function arg_class_error (S, X) error ("arrayfun: invalid argument of class %s", class (X)) endfunction %!test %! assert (res = pararrayfun (4, @ (x, y) x * y, [1, 2, 3, 4], [2, 3, 4, 5], "VerboseLevel", 0), [2, 6, 12, 20]) %!test %! assert (res = pararrayfun (4, @ (x, y) x * y, [1, 2, 3, 4], [2, 3, 4, 5], "VerboseLevel", 0, "UniformOutput", false), {2, 6, 12, 20}) %!test %! assert (res = pararrayfun (2, @ (x, y) x * y, [1, 2, 3, 4], [2, 3, 4, 5], "VerboseLevel", 0, "ChunksPerProc", 2), [2, 6, 12, 20]) %!test %! assert (res = pararrayfun (4, @ (x, y) x * y, [1, 2, 3, 4], [2, 3, 4, 5], "VerboseLevel", 0, "CumFunc", @ (a, b) a + b), 40) %!test %! assert (res = pararrayfun (2, @ (x, y) x * y, [1, 2, 3, 4], [2, 3, 4, 5], "VerboseLevel", 0, "ChunksPerProc", 2, "CumFunc", @ (a, b) a + b), 40) parallel-3.1.3/inst/PaxHeaders.30520/__bw_psend__.m0000644000000000000000000000013213331003466016567 xustar0030 mtime=1533282102.526477339 30 atime=1533282227.396942838 30 ctime=1533282233.633065964 parallel-3.1.3/inst/__bw_psend__.m0000644000175000017500000000043113331003466016763 0ustar00olafolaf00000000000000## This code is in the public domain. ## -*- texinfo -*- ## @deftypefn {Function File} {} __bw_psend__ (@var{fd}, @var{var}) ## Wrapper for fload for backwards compatibility (optim package). ## @end deftypefn function __bw_psend__ (varargin) fsave (varargin{:}); endfunction parallel-3.1.3/inst/PaxHeaders.30520/__bw_prcv__.m0000644000000000000000000000013213331003466016430 xustar0030 mtime=1533282102.526477339 30 atime=1533282227.396942838 30 ctime=1533282233.633065964 parallel-3.1.3/inst/__bw_prcv__.m0000644000175000017500000000044713331003466016633 0ustar00olafolaf00000000000000## This code is in the public domain. ## -*- texinfo -*- ## @deftypefn {Function File} {ret =} __bw_prcv__ (@var{fd}) ## Wrapper for fload for backwards compatibility (optim package). ## @end deftypefn function ret = __bw_prcv__ (varargin) ret.psend_var = fload (varargin{:}); endfunction parallel-3.1.3/inst/PaxHeaders.30520/private0000644000000000000000000000013213331003466015411 xustar0030 mtime=1533282102.530477418 30 atime=1533282233.633065964 30 ctime=1533282233.633065964 parallel-3.1.3/inst/private/0000755000175000017500000000000013331003466015664 5ustar00olafolaf00000000000000parallel-3.1.3/inst/private/PaxHeaders.30520/parcellfun_opts.m0000644000000000000000000000013213331003466021044 xustar0030 mtime=1533282102.530477418 30 atime=1533282102.530477418 30 ctime=1533282233.633065964 parallel-3.1.3/inst/private/parcellfun_opts.m0000644000175000017500000000634113331003466021246 0ustar00olafolaf00000000000000## Copyright (C) 2010 VZLU Prague, a.s., Czech Republic ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn{Function File} {} parcellfun_opts (args) ## Undocumented internal function. ## @end deftypefn function [nargs, uniform_output, error_handler, verbose_level, ... chunks_per_proc, cumfunc, vectorized, ... chunk_size] = parcellfun_opts (caller, args) uniform_output = true; error_handler = []; verbose_level = 1; # default to normal output level chunks_per_proc = 0; # 0 means than size of chunk is 1 vectorized = false; cumfunc = []; chunk_size = 1; nargs = length (args); ## parse options while (nargs > 1) opt = args{nargs-1}; if (! ischar (opt)) break; else optl = tolower (opt); val = args{nargs}; endif switch (optl) case "uniformoutput" uniform_output = logical (val); if (! isscalar (uniform_output)) error ("%s: UniformOutput must be a logical scalar", caller); endif case "errorhandler" error_handler = val; if (! (isempty (error_handler) || isa (error_handler, "function_handle"))) error ("%s: ErrorHandler must be a function handle", caller); endif case "verboselevel" verbose_level = val; if (! isscalar (verbose_level)) error ("%s: VerboseLevel must be a numeric scalar", caller); endif case "chunksperproc" if (! isempty (val)) chunks_per_proc = round (val); if (! isscalar (chunks_per_proc) || chunks_per_proc <= 0) error ("%s: ChunksPerProc must be a positive scalar", caller); endif endif case "vectorized" vectorized = logical (val); if (! isscalar (vectorized)) error ("%s: Vectorized must be a logical scalar", caller); endif case "cumfunc" cumfunc = val; if (! (isempty (cumfunc) || is_function_handle (cumfunc))) error ("%s: CumFunc must be empty or a function handle", caller); endif case "chunksize" chunk_size = round (val); if (! isscalar (chunk_size) || chunk_size <= 0) error ("%s: ChunkSize must be a positive scalar", caller); endif otherwise error ("%s: invalid option ""%s""", caller, opt); endswitch nargs -= 2; endwhile if (vectorized) if (any (strcmp (caller, {"parcellfun", "netcellfun"}))) error ("%s: ""Vectorized"" option not accepted by %s", caller, caller); elseif (chunks_per_proc <= 0 && strcmp (caller, "pararrayfun")) error ("%s: the ""Vectorized"" option requires also ""ChunksPerProc""", caller); endif endif endfunction parallel-3.1.3/inst/private/PaxHeaders.30520/chunk_parcellfun.m0000644000000000000000000000013213331003466021167 xustar0030 mtime=1533282102.530477418 30 atime=1533282102.530477418 30 ctime=1533282233.633065964 parallel-3.1.3/inst/private/chunk_parcellfun.m0000644000175000017500000000447713331003466021401 0ustar00olafolaf00000000000000## Copyright (C) 2010 VZLU Prague, a.s., Czech Republic ## Copyright (C) 2010 Jean-Benoist Leger ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn{Function File} {} chunk_parcellfun (@dots{:}) ## Undocumented internal function. ## @end deftypefn function varargout = chunk_parcellfun (nproc, chunks_per_proc, func, error_handler, verbose_level, cumfunc, uniform_output, varargin) args = varargin; nchunks = chunks_per_proc * nproc; ## Compute optimal chunk sizes. N = numel (args{1}); len_chunk = ceil (N/nchunks); chunk_sizes = len_chunk (ones(1, nchunks)); chunk_sizes(1:nchunks*len_chunk - N) -= 1; ## Split argument arrays into chunks (thus making arrays of arrays). chunked_args = cellfun (@(arg) mat2cell (arg(:), chunk_sizes), args, ... "UniformOutput", false); ## Attach error handler if present. if (! isempty (error_handler)) chunked_args = [chunked_args, {"ErrorHandler", error_handler}]; endif ## Main call. [out_brut{1:nargout}] = parcellfun (nproc, func, chunked_args{:}, "UniformOutput", false, "VerboseLevel", verbose_level, "CumFunc", cumfunc); ## Concatenate output args and reshape them to correct size. if (isempty (cumfunc)) true_size = size (args{1}); varargout = cellfun (@(arg) reshape (vertcat (arg{:}), true_size), out_brut, "UniformOutput", false); elseif (uniform_output) varargout = cellfun (@(arg) arg{:}, out_brut, "UniformOutput", false); else varargout = out_brut; endif endfunction parallel-3.1.3/inst/private/PaxHeaders.30520/netcellfun_worker.m0000644000000000000000000000013213331003466021374 xustar0030 mtime=1533282102.530477418 30 atime=1533282102.530477418 30 ctime=1533282233.633065964 parallel-3.1.3/inst/private/netcellfun_worker.m0000644000175000017500000002135013331003466021573 0ustar00olafolaf00000000000000## Copyright (C) 2015, 2016 Olaf Till ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn{Function File} {} netcellfun_worker (@var{in_arrays} @var{connections}, @var{fun}, @dots{}) ## ## Undocumented internal function. ## ## @end deftypefn function varargout = netcellfun_worker (in_arrays, conns, func, varargin) fname = ifelse (in_arrays, "netarrayfun", "netcellfun"); ## nargin () >= 4 has been assured by caller (netcellfun or netarrayfun) if (! isa (conns, "pconnections")) error ("%s: `connections' must be a parallel connections object", fname); endif info = network_get_info (conns); ## delete local machine, if present, from connections and from info server_idx = ! [info.local_machine]; conns = conns(server_idx); info = info(server_idx); if ((nhosts = numel (conns)) == 0) error ("%s: connections object contains no servers", fname); endif nout = nargout (); ## options are similar to for parcellfun/pararrayfun [nargs, uniform_output, error_handler, verbose_level, ... ~, cumfunc, vectorized, chunk_size] = parcellfun_opts (fname, varargin); accumulate = ifelse (isempty (cumfunc), false, true); args = varargin(1:nargs); if (nargs > 1) [err, args{:}] = common_size (args{:}); if (err) error ("%s: arguments size must match", fname); endif endif argdims = size (args{1}); args_are_columns = iscolumn (args{1}); if (! args_are_columns) args = cellfun (@ (x) x(:), args, "UniformOutput", false); endif ## configured or default number of processes at each machine rnproc = ifelse ([info.nlocaljobs] == 0, [info.nproc], [info.nlocaljobs]); ## number of jobs per call at each machine rnjobs = rnproc * chunk_size; ## The anonymous functions for remote function calls had to be defined ## without using "varargin", since (up to Octave 4.0.0 at least) ## anonymous functions with varargin were not saved/loaded ## (sent/received) correctly. if (any (rnjobs == 1)) ## There will be (some) single function calls (without parallelity ## within one machine and not via cellfun). Prepare function for ## single function calls. See below why the 'eh' argument is ## necessary. if (isempty (error_handler)) if (in_arrays) single_func = @ (idx, eh, varargs) func (varargs{:}); else single_func = @ (idx, eh, varargs) func (vertcat (varargs{:}){:}); endif else if (in_arrays) single_func = @ (idx, eh, varargs) __netcellfun_guardfun__ ... (func, error_handler, idx, varargs{:}); else single_func = @ (idx, eh, varargs) __netcellfun_guardfun__ ... (func, error_handler, idx, vertcat (varargs{:}){:}); endif endif endif ## (For function calls via parcell/arrayfun, the possibly specified ## error handler must be wrapped to add a base to errs.index.) ## construct function calls specific to each server funs = cell (nhosts, 1); ## this caused some difficulties (4.0.0) with visibility of private functions ## rem_parfun = ifelse (in_arrays, @ pararrayfun, @ parcellfun); rem_parfun = ifelse (in_arrays, "pararrayfun", "parcellfun"); ## (number of argument sets in remote call will be rnproc * ## chunk_size, while ChunksPerProc will be 1) for (id = 1:nhosts) if (rnjobs(id) == 1) funs{id} = single_func; else ## If (rnproc(id) == 1), this will lead to a single call of ## cellfun via parcell/arrayfun. This case could be treated more ## efficiently. But then we'd have to care for CumFunc here. ## We use eval() to shorten the logic, since a function handle for ## rem_parfun did not work (see comment above). See next comment ## for why the second argument 'eh' is necessary. if (isempty (error_handler)) eval (sprintf ("funs{id} = @ (idx, eh, varargs) %s \ (rnproc(id), func, varargs{:}, \ 'ChunksPerProc', 1, \ 'UniformOutput', false, \ 'VerboseLevel', 0, \ 'Vectorized', vectorized, \ 'CumFunc', cumfunc, \ 'ErrorHandler', eh);", ... rem_parfun)); else ## The eval() with explicitely named anonymous function ## arguments is necessary due to the above mentioned issue with ## save/loading anonymous functions with varargin. Also, Octave ## doesn't seem to save the context of an anonymous function ## defined within another anonymous function -- it doesn't save ## the original error handler within the defined error handler ## wrapper; for this reason, the error handler has to be passed ## as an additional (second) argument to the funcion funs{id}, ## an argument which could be dropped otherwise. arg_list = sprintf (", _%i", 1:nargs); eval (sprintf ("funs{id} = @ (idx, eh, varargs) %s \ (rnproc(id), func, varargs{:}, \ 'ChunksPerProc', 1, \ 'UniformOutput', false, \ 'VerboseLevel', 0, \ 'Vectorized', vectorized, \ 'CumFunc', cumfunc, \ 'ErrorHandler', \ @ (err %s) eh \ (setfield (err, 'index', idx(err.index)) \ %s));", rem_parfun, arg_list, arg_list)); endif endif endfor ## the scheduler njobs = numel (args{1}); busy_hosts_lidx = false (1, nhosts); busy_hosts_jobs = cell (1, nhosts); # will contain index vectors # into jobs left_lidx = true (njobs, 1); firstresult = true; first_rfeval = true; error_in_first_rfeval = false; ready = false; if (! accumulate) varargout = cell (njobs, nout); endif orig_size = size (args{1}); unwind_protect while (any (left_lidx) || any (busy_hosts_lidx)) ## create remote jobs if jobs are left ## go through all free hosts, there are some (first time or select ## returned) for host_nid = find (! busy_hosts_lidx) ## index vector into jobs for that host, stop creating remote ## jobs if no job is left if (isempty (job_idxv = find (left_lidx, rnjobs(host_nid)))) break; endif ## cargs will contain _column_ arrays cargs = cellfun (@ (x) x(job_idxv), args, "UniformOutput", false); try rfeval (funs{host_nid}, job_idxv, error_handler, cargs, nout, [], conns(host_nid)); catch if (first_rfeval) error_in_first_rfeval = true; endif error (lasterr ()); end_try_catch first_rfeval = false; busy_hosts_lidx(host_nid) = true; busy_hosts_jobs{host_nid} = job_idxv; left_lidx(job_idxv) = false; endfor ## ready creating jobs, now collect some results ## there are busy hosts, if not directly due to the enclosing ## while-condition, then due to creating jobs above ready_nidx = select_sockets (conns, -1); for id = ready_nidx ## a cell-array of the outputs, outputs are columns res = precv (conns(id)); ## distinguish between single function and others if (rnjobs(id) > 1) ## the outputs are in cell-arrays res = horzcat (res{:}); endif if (accumulate) if (firstresult) varargout = res; firstresult = false; else [varargout{:}] = cumfunc (varargout{:}, res{:}); endif else varargout(busy_hosts_jobs{id}, :) = res; endif busy_hosts_lidx(id) = false; left_lidx(busy_hosts_jobs{id}) = false; endfor endwhile ready = true; unwind_protect_cleanup if (! (ready || error_in_first_rfeval)) sclose (conns); # might already be closed endif end_unwind_protect ## transform the result if (uniform_output) varargout = cell2mat (varargout); endif varargout = mat2cell (varargout, rows (varargout), ones (1, nout)); if (! (accumulate || args_are_columns)) varargout = cellfun (@ (x) reshape (x, argdims), varargout, "UniformOutput", false); endif endfunction parallel-3.1.3/inst/PaxHeaders.30520/parallel_doc.m0000644000000000000000000000013213331003466016613 xustar0030 mtime=1533282102.530477418 30 atime=1533282227.396942838 30 ctime=1533282233.633065964 parallel-3.1.3/inst/parallel_doc.m0000644000175000017500000000512113331003466017010 0ustar00olafolaf00000000000000## Copyright (C) 2014-2016 Olaf Till ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn {Function File} {} parallel_doc () ## @deftypefnx {Function File} {} parallel_doc (@var{keyword}) ## Show parallel package documentation. ## ## Runs the info viewer Octave is configured with on the documentation ## in info format of the installed parallel package. Without argument, ## the top node of the documentation is displayed. With an argument, ## the respective index entry is searched for and its node displayed. ## ## @end deftypefn function parallel_doc (keyword) if ((nargs = nargin ()) > 1) print_usage () endif ## locate installed documentation persistent infopath = ""; if (isempty (infopath)) [local_list, global_list] = pkg ("list"); if (! isempty (idx = ... find (strcmp ("parallel", {structcat(1, local_list{:}).name}), 1))) idir = local_list{idx}.dir; elseif (! isempty (idx = ... find (strcmp ("parallel", {structcat(1, global_list{:}).name}), 1))) idir = global_list{idx}.dir; else error ("no installed parallel package found"); endif infopath = fullfile (idir, "doc/", "parallel.info"); ## allow for .gz if (! exist (infopath, "file")) infopath = strcat (infopath, ".gz"); endif endif ## display info INFO = info_program (); if (nargs) error_hint = ", maybe the keyword was not found in the index"; status = system (sprintf ("%s %s --index-search \"%s\"", INFO, infopath, keyword)); else error_hint = ""; status = system (sprintf ("%s %s", INFO, infopath)); endif if (status) if (status == 127) error ("unable to find info program `%s'", INFO); else error ("info program `%s' returned error code %i%s", INFO, status, error_hint); endif endif endfunction parallel-3.1.3/PaxHeaders.30520/octave-parallel.metainfo.xml0000644000000000000000000000013213331003466020435 xustar0030 mtime=1533282102.530477418 30 atime=1533282102.530477418 30 ctime=1533282233.633065964 parallel-3.1.3/octave-parallel.metainfo.xml0000644000175000017500000000216413331003466020636 0ustar00olafolaf00000000000000 octave-parallel www.octave.org-octave.desktop Parallel Parallel Computing

Parallel execution package.

multicore computing local parallel computing network parallel computing beowulf cluster http://octave.sourceforge.net/parallel https://savannah.gnu.org/bugs/?func=additem&group=octave GPL-3.0+ Octave-Forge Community octave-maintainers@gnu.org FSFAP
parallel-3.1.3/PaxHeaders.30520/DESCRIPTION0000644000000000000000000000013113331003466014544 xustar0029 mtime=1533282102.52247726 30 atime=1533282232.585045272 30 ctime=1533282233.633065964 parallel-3.1.3/DESCRIPTION0000644000175000017500000000056213331003466014746 0ustar00olafolaf00000000000000Name: parallel Version: 3.1.3 Date: 2018-08-03 Author: Hayato Fujiwara, Jaroslav Hajek, Olaf Till Maintainer: Olaf Till Title: Parallel Computing. Description: Parallel execution package. See also package mpi, maintained by Carlo de Falco. Depends: octave (>= 4.0.0), struct (>= 1.0.12) BuildRequires: libgnutls..-dev Autoload: no License: GPLv3+ parallel-3.1.3/PaxHeaders.30520/COPYING0000644000000000000000000000013013331003466014070 xustar0029 mtime=1533282102.52247726 29 atime=1533282102.52247726 30 ctime=1533282233.633065964 parallel-3.1.3/COPYING0000644000175000017500000011114513331003466014273 0ustar00olafolaf00000000000000Appendix G GNU GENERAL PUBLIC LICENSE ************************************* Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. `http://fsf.org/' Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble ======== The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS ==================== 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a. The work must carry prominent notices stating that you modified it, and giving a relevant date. b. The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c. You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d. If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a. Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b. Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c. Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d. Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e. Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a. Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b. Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c. Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d. Limiting the use for publicity purposes of names of licensors or authors of the material; or e. Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f. Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS =========================== How to Apply These Terms to Your New Programs ============================================= If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. Copyright (C) YEAR NAME OF AUTHOR This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see `http://www.gnu.org/licenses/'. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: PROGRAM Copyright (C) YEAR NAME OF AUTHOR This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see `http://www.gnu.org/licenses/'. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read `http://www.gnu.org/philosophy/why-not-lgpl.html'. parallel-3.1.3/PaxHeaders.30520/NEWS0000644000000000000000000000013213331003466013536 xustar0030 mtime=1533282102.526477339 30 atime=1533282102.526477339 30 ctime=1533282233.633065964 parallel-3.1.3/NEWS0000644000175000017500000001116113331003466013734 0ustar00olafolaf00000000000000parallel 3.1.3 -------------- ** Fixed building with newer gnutls versions. ** Fixed building with Octave 4.0. ** Change formal dependency on Octave to versions >= 4.0. parallel 3.1.2 -------------- ** Build fixes and tests. Builds with Octave 4.4. parallel 3.1.1 -------------- ** Some build fixes. Builds with Octave 4.2. ** Links to core Octave documentation work now in html version of package documentation. parallel 3.1.0 -------------- ** Added general package documentation, accessible with function 'parallel_doc'. ** Introduced dependency on package 'struct'. ** Fixed handling of argument and output dimensions in netcellfun and netarrayfun. ** In connecting a cluster, package version and connection protocol are checked. Will work only with packages from this version upwards. ** Variables are transferred more efficiently. ** Build fixes for new Octave versions. ** If cluster functions are to be disabled at configure time, this has to be done always explicitely now. parallel 3.0.4 -------------- ** Building of cluster functions disabled by default for platforms on which they currently can't be built or used. This enables building of at least the functions for local parallel computation on these platforms. ** Fix issue in package building if gnutls headers are not present. ** Make compatible with Octaves new exception-based error handling. Compatibility with old error handling up to Octave-4.0 is retained. ** Fix bug for usage with 64bit indexing. parallel 3.0.3 -------------- ** Fix bug in package building if SRP is not provided by gnutls. ** Documentation spelling and typo fixes. parallel 3.0.2 -------------- ** Functions 'send()' and 'recv()' have been renamed to 'psend()' and 'precv()', respectively, since previous names are used by the sockets package. parallel 3.0.1 -------------- ** Fix some issues in package building, e.g. in building if libgnutls is not present. Note that a libgnutls library (including its "development package" on some systems) which supports the SRP protocol is needed to build the 'parallel' package with TLS-based connections enabled. parallel 3.0.0 -------------- ** 'parcellfun' and 'pararrayfun' accept an option "CumFunc" for cumulative results. ** Fix handling of option "UniformOutput" with option "Vectorized" in 'pararrayfun'. ** Function 'connect()' has been renamed to 'pconnect()' since the previous name is used by the control package. ** New functions 'netcellfun' and 'netarrayfun' for remote parallel execution. ** New convenience function 'rfeval' for single remote function execution. ** New function 'install_vars' to distribute named variables over the parallel cluster. ** Better documentation of cluster functions. Start with the function documentation of 'pconnect()' and 'pserver()', and go on with the documentation of the functions referenced therein. The README.parallel file has been removed. ** The value returned by pconnect and the variable 'sockets' held by pserver, holding the network connections, are now opaque. Indexing the connections in this value should work as with the matrix used before. ** Connections can be based on TLS-SRP, which is now the default. New function parallel_generate_srp_data generates authorization data. ** Parallel cluster commands hanging in system calls (e.g. trying to read data that was not sent) can be interrupted with Ctrl-C (invalidating the network connections in most cases, so that information within server memory will be lost). ** New functions 'network_get_info' and 'network_set'. ** Within a particular parallel network, servers are supposed to be unique now. But a server can be a part of several parallel networks, and successful connection attempts of such overlapping networks should now be possible even if initiated from different client machines or client processes at the same time. ** Removed deprecated bw_... group of functions. parallel 2.2.1 -------------- ** The bw_... group of functions has been deprecated and will be removed in the future. ** Made compatible with Octave 4.0. ** Made parcellfun/pararrayfun a bit more stable. parallel 2.2.0 -------------- ** Included functions parcellfun and pararrayfun from package general. parallel 2.1.1 -------------- ** Bugfix for installation on Windows. parallel 2.1.0, summary of user-visible changes: ------------------------------------------------ ** Connections with equal hostnames are now allowed. ** Fix: avoids zombie processes in server if connection is closed. parallel-3.1.3/PaxHeaders.30520/src0000644000000000000000000000013213331003671013547 xustar0030 mtime=1533282233.629065885 30 atime=1533282233.633065964 30 ctime=1533282233.633065964 parallel-3.1.3/src/0000755000175000017500000000000013331003671014022 5ustar00olafolaf00000000000000parallel-3.1.3/src/PaxHeaders.30520/select_sockets.cc0000644000000000000000000000013213331003466017147 xustar0030 mtime=1533282102.574478286 30 atime=1533282229.492984222 30 ctime=1533282233.633065964 parallel-3.1.3/src/select_sockets.cc0000644000175000017500000001525413331003466017354 0ustar00olafolaf00000000000000/* Copyright (C) 2015-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ // PKG_ADD: autoload ("select_sockets", "parallel_interface.oct"); // PKG_DEL: autoload ("select_sockets", "parallel_interface.oct", "remove"); #include #include #include #include #include #include #include #include #include #include #include "parallel-gnutls.h" DEFUN_DLD (select_sockets, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} select_sockets (@var{connections}, @var{timeout})\n\ @deftypefnx {Loadable Function} {} select_sockets (@var{connections}, @var{timeout}, @var{nfds})\n\ Calls Unix @code{select} for data connections in a parallel cluster.\n\ \n\ This function is for advanced usage (and therefore has minimal\n\ documentation), typically the programming of schedulers. It can be\n\ called at the client or at a server.\n\ \n\ @var{connections}: valid connections object (see @code{pconnect} and\n\ @code{pserver}, possibly indexed).\n\ \n\ @var{timeout}: seconds, negative for infinite.\n\ \n\ @var{nfds}: Passed to Unix @code{select} as first argument, see\n\ documentation of Uix @code{select}. Default: @code{FD_SETSIZE}\n\ (platform specific).\n\ \n\ An error is returned if nfds or a watched filedescriptor plus one\n\ exceeds FD_SETSIZE.\n\ \n\ Returns an index vector to @var{connections} indicating connections\n\ with pending input, readable with @code{precv}.\n\ \n\ If called at the client, the command connections are included into the\n\ UNIX @code{select} call and checked for error flags, and\n\ @code{select_sockets} returns an error if a flag for a remote error is\n\ received.\n\ \n\ @seealso{pconnect, pserver, reval, psend, precv, sclose, parallel_generate_srp_data}\n\ @end deftypefn") { std::string fname ("select_sockets"); octave_value retval; if (args.length () < 2 || args.length () > 3 || args(0).type_id () != octave_parallel_connections::static_type_id ()) { print_usage (); return retval; } double atimeout = args(1).double_value (); int nfds = FD_SETSIZE; bool err = false; if (args.length () == 3) { SET_ERR (nfds = args(2).int_value (), err); } if (err) { print_usage (); return retval; } if (nfds <= 0) { error ("%s: 'nfds' must be a positive integer", fname.c_str ()); return retval; } if (nfds > FD_SETSIZE) { error ("%s: 'nfds' exceeds systems maximum given by FD_SETSIZE", fname.c_str ()); return retval; } const octave_base_value &rep = args(0).get_rep (); const octave_parallel_connections &cconns = dynamic_cast (rep); octave_parallel_connections_rep *conns = cconns.get_rep (); int nconns = conns->get_connections ().numel (); if (conns->get_whole_network ()->is_closed ()) { error ("%s: network is closed", fname.c_str ()); return retval; } if (nconns < conns->get_all_connections ().numel ()) // it's a subnet for (int i = 0; i < nconns; i++) if (conns->get_connections ()(i)->is_pseudo_connection ()) { error ("%s: using a subnet and local machine was given as one of the connections (index %i)", fname.c_str (), i + 1); return retval; } timeval tout; timeval *timeout = &tout; if (atimeout < 0) timeout = NULL; else { double ipart, fpart; fpart = modf (atimeout, &ipart); tout.tv_sec = lrint (ipart); tout.tv_usec = lrint (fpart * 1000); } fd_set rfds, wfds, efds; FD_ZERO (&rfds); FD_ZERO (&wfds); FD_ZERO (&efds); inthandler_dont_restart_syscalls __inthandler_guard__; for (int i = 0; i < nconns; i++) { if (conns->get_connections ()(i)->is_pseudo_connection ()) continue; int fid = conns->get_connections ()(i)->get_data_stream ()-> get_strbuf ()->get_fid (); if (fid >= nfds) { error ("%s: file descriptor >= nfds or FD_SETSIZE", fname.c_str ()); return retval; } FD_SET (fid, &rfds); if (! conns->is_server ()) { fid = conns->get_connections ()(i)->get_cmd_stream ()-> get_strbuf ()->get_fid (); if (fid >= nfds) { error ("%s: file descriptor >= nfds or FD_SETSIZE", fname.c_str ()); return retval; } FD_SET (fid, &rfds); } } // don't restart interrupted select() int n = select (nfds, &rfds, &wfds, &efds, timeout); if (n == -1) { error ("%s: select system call returned an error", fname.c_str ()); return retval; } bool command_errors = false; RowVector ridx (n); double *fvec; int i; for (i = 0, fvec = ridx.fortran_vec (); i < nconns; i++) { if (conns->get_connections ()(i)->is_pseudo_connection ()) continue; if (FD_ISSET (conns->get_connections ()(i)->get_data_stream ()-> get_strbuf ()->get_fid (), &rfds)) { *fvec = double (i + 1); fvec++; } if (! conns->is_server ()) { if (FD_ISSET (conns->get_connections ()(i)->get_cmd_stream ()-> get_strbuf ()->get_fid (), &rfds)) { int err; if ((err = conns->get_connections ()(i)->poll_for_errors ()) < 0) { conns->close (); error ("%s: communication error with server with index %i", fname.c_str (), i + 1); return retval; } else if (err > 0) { _p_error ("%s: a previous command at server with index %i caused an error", fname.c_str (), i + 1); command_errors = true; } } } } if (command_errors) { error ("command error"); return retval; } return octave_value (ridx); } parallel-3.1.3/src/PaxHeaders.30520/sensitive-data.cc0000644000000000000000000000013213331003466017055 xustar0030 mtime=1533282102.574478286 30 atime=1533282102.574478286 30 ctime=1533282233.633065964 parallel-3.1.3/src/sensitive-data.cc0000644000175000017500000000434513331003466017261 0ustar00olafolaf00000000000000/* Copyright (C) 2015-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ #include "parallel-gnutls.h" void sensitive_string::fill (int n, bool lock) { valid = false; bool err = false; if (internally_allocated || locked_length) { _p_error ("internal error in filling"); return; } val.data = new unsigned char[n + 1]; if (val.data) { internally_allocated = true; val.size = n; if (lock) { if (mlock (val.data, n)) { _p_error ("could not lock memory pages"); return; } else locked_length = n; } } else { val.size = 0; _p_error ("could not allocate memory"); return; } int rfd; if ((rfd = open ("/dev/random", O_RDONLY)) == -1) { _p_error ("could not open /dev/random"); return; } // gnutls nowadays checks if the password is valid UTF8, so many // bytes larger than 0x7F are invalid. Also, bytes < 0x20 are // probably invalid, even if not 0x00. We provide bytes with // probability evenly distributed between 0x20 and 0x7F (96 values). for (int i = 0; i < n; i++) { do { if (read (rfd, &(val.data[i]), 1) != 1) { _p_error ("could not read from /dev/random"); err = true; break; } val.data[i] >>= 1; } while (val.data[i] < 0x20); if (err) break; } val.data[n] = '\0'; if (close (rfd)) { _p_error ("could not close /dev/random"); err = true; } if (! err) valid = true; } parallel-3.1.3/src/PaxHeaders.30520/psend.cc0000644000000000000000000000013213331003466015246 xustar0030 mtime=1533282102.570478207 30 atime=1533282229.144977351 30 ctime=1533282233.633065964 parallel-3.1.3/src/psend.cc0000644000175000017500000001221513331003466015445 0ustar00olafolaf00000000000000// Copyright (C) 2002 Hayato Fujiwara // Copyright (C) 2010-2018 Olaf Till // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; If not, see . // PKG_ADD: autoload ("psend", "parallel_interface.oct"); // PKG_DEL: autoload ("psend", "parallel_interface.oct", "remove"); #include #include #include #include #include #include #include #include #if HAVE_UNISTD_H #include #endif #include "parallel-gnutls.h" DEFUN_DLD (psend, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} psend (@var{value}, @var{connections})\n\ Send the value in variable @var{value} to all parallel cluster machines specified by @var{connections}.\n\ \n\ This function can be called both at the client machine and (with\n\ @code{reval}) at a server machine. See @code{pconnect} for a\n\ description of the @var{connections} variable, and @code{pserver} for\n\ a description of this variable (named @code{sockets}) at the server\n\ side. @var{connections} can contain all connections of the network, a\n\ subset of them, or a single connection. The machine at which\n\ @code{psend} was called (client or server), if contained in the\n\ @var{connections} variable, is ignored.\n\ \n\ The value sent with @code{psend} must be received with @code{precv} at\n\ the target machine. Note that values can be sent to each machine, even\n\ from a server machine to a different server machine.\n\ \n\ If @code{psend} is called at the client machine, a corresponding\n\ @code{precv} should have been called before at the target machine,\n\ otherwise the client will hang if @var{value} contains large data\n\ (which can not be held by the operating systems socket buffers).\n\ \n\ @seealso{pconnect, pserver, reval, precv, sclose, parallel_generate_srp_data, select_sockets}\n\ @end deftypefn") { std::string fname ("psend"); octave_value retval; if (args.length () != 2 || args(1).type_id () != octave_parallel_connections::static_type_id ()) { print_usage (); return retval; } const octave_base_value &rep = args(1).get_rep (); const octave_parallel_connections &cconns = dynamic_cast (rep); octave_parallel_connections_rep *conns = cconns.get_rep (); int nconns = conns->get_connections ().numel (); if (conns->get_whole_network ()->is_closed ()) { error ("%s: network is closed", fname.c_str ()); return retval; } inthandler_dont_restart_syscalls __inthandler_guard__; // check each connection before a command is sent over any if (nconns < conns->get_all_connections ().numel ()) // it's a subnet for (int i = 0; i < nconns; i++) if (conns->get_connections ()(i)->is_pseudo_connection ()) { error ("%s: using a subnet and own node was given as one of the receivers (index %i)", fname.c_str (), i + 1); return retval; } if (! conns->is_server ()) { bool command_errors = false, stream_errors = false; int err; for (int i = 0; i < nconns; i++) { if (conns->get_connections ()(i)->is_pseudo_connection ()) continue; if ((err = conns->get_connections ()(i)->poll_for_errors ())) { if (err > 0) { _p_error ("%s: a previous command at server with index %i caused an error", fname.c_str (), i + 1); command_errors = true; } else // err < 0 { _p_error ("%s: communication error with server with index %i", fname.c_str (), i + 1); stream_errors = true; } } } if (stream_errors) conns->close (); if (stream_errors || command_errors) { error ("error in psend"); return retval; } } // args(0) is const, make copy octave_value val = args(0); for (int i = 0; i < nconns; i++) { if (conns->get_connections ()(i)->is_pseudo_connection ()) continue; if (minimal_write_data (conns->get_connections ()(i)-> get_data_stream ()->get_ostream (), val) || ! conns->get_connections ()(i)->get_data_stream ()->good ()) { conns->close (); error ("%s: communication error", fname.c_str ()); return retval; } } return retval; } parallel-3.1.3/src/PaxHeaders.30520/custom.h0000644000000000000000000000013213331003466015311 xustar0030 mtime=1533282102.534477496 30 atime=1533282227.604946945 30 ctime=1533282233.633065964 parallel-3.1.3/src/custom.h0000644000175000017500000000043013331003466015504 0ustar00olafolaf00000000000000// Olaf Till // This file is granted to the public domain. #ifdef HAVE_OCTAVE_INTERPRETER_H // >= octave-4.2 #include #include #include #else // <= octave-4.0.. #include #endif parallel-3.1.3/src/PaxHeaders.30520/__netcellfun_guardfun__.copy_to_m0000644000000000000000000000013213331003466022366 xustar0030 mtime=1533282102.534477496 30 atime=1533282227.396942838 30 ctime=1533282233.633065964 parallel-3.1.3/src/__netcellfun_guardfun__.copy_to_m0000644000175000017500000000230113331003466022560 0ustar00olafolaf00000000000000## Copyright (C) 2015, 2016 Olaf Till ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn{Function File} {} __netcellfun_guardfun__ (@dots{}) ## ## Undocumented internal function. ## ## @end deftypefn function varargout = __netcellfun_guardfun__ (func, errh, idx, varargin) ## This must be an extra function file to be visible at the remote ## side. nout = nargout (); try [varargout{1:nout}] = func (varargin{:}); catch errs = lasterror (); errs.index = idx; [varargout{1:nout}] = errh (errs, varargin{:}); end_try_catch endfunction parallel-3.1.3/src/PaxHeaders.30520/m40000644000000000000000000000013213331003466014071 xustar0030 mtime=1533282102.554477891 30 atime=1533282233.633065964 30 ctime=1533282233.633065964 parallel-3.1.3/src/m4/0000755000175000017500000000000013331003466014344 5ustar00olafolaf00000000000000parallel-3.1.3/src/m4/PaxHeaders.30520/octave-forge.m40000644000000000000000000000013213331003466016771 xustar0030 mtime=1533282102.554477891 30 atime=1533282103.350493609 30 ctime=1533282233.633065964 parallel-3.1.3/src/m4/octave-forge.m40000644000175000017500000000575313331003466017201 0ustar00olafolaf00000000000000# Copyright (C) 2017 Olaf Till # Modifications to print what is searching for by JohnD # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # arguments of OF_OCTAVE_ALT_SYMS (see also description of # OF_OCTAVE_LIST_ALT_SYMS below): # # $1: symbol version 1 # $2: symbol version 2 # $3: test for symbol version 2 # $4: macro name to access alternative symbols # $5: include directives for symbol version 1 # $6: include directives for symbol version 2 # (a list of lists of args 1--6 is $1 of OF_OCTAVE_LIST_ALT_SYMS) # $7: name of generated include file with alternatives of Octave headers # (arg7 is $2 of OF_OCTAVE_LIST_ALT_SYMS) AC_DEFUN([OF_OCTAVE_ALT_SYMS], [ AC_MSG_CHECKING([$1 or $2]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include ] $6], [$3])], [AC_DEFINE($4, [[$2]], [macro for alternative Octave symbols]) AC_MSG_RESULT([$2]) echo '$6' >> $7], [AC_DEFINE($4, [[$1]], [macro for alternative Octave symbols]) AC_MSG_RESULT([$1]) echo '$5' >> $7] ) ]) # OF_OCTAVE_LIST_ALT_SYMS is called in the following way: # # OF_OCTAVE_LIST_ALT_SYMS([ # [dnl # [old_octave_symbol], # [new_octave_symbol], # [[compilation test] # [for new_octave_symbol]], # [NAME_OF_GENERATED_MACRO____WILL_EXPAND_TO_OLD_OR_NEW_SYMBOL], # [[include directives] # [except #include ] # [necessary to compile with old_octave_symbol]], # [[include directives] # [except #include ] # [nessary to compile with new_octave_symbol] # [and to compile the test]] # ], # # ... further such lists as the above # # ], # # [name-of-header-file-for-alternative-octave-iclude-directives.h]) # # # This file should be put into src/m4/, and the line # # AC_CONFIG_MACRO_DIRS([m4]) # # should be put into src/configure.ac. The package should use # autoheader to generate config.h.in (src/bootstrap should contain the # lines 'aclocal', 'autoconf', and 'autoheader -f'). Package code # should include config.h and use the generated macros to access the # alternative symbols of Octave. An example of a call to # OF_OCTAVE_LIST_ALT_SYMS in src/configure.ac is available together # with this file. AC_DEFUN([OF_OCTAVE_LIST_ALT_SYMS], [ echo '/* generated by configure */' > $2 m4_foreach([it], [$1], [m4_apply([OF_OCTAVE_ALT_SYMS], [it, $2])]) AH_BOTTOM([#include "$2"]) ]) parallel-3.1.3/src/m4/PaxHeaders.30520/std-gnu11.m40000644000000000000000000000013113331003466016132 xustar0030 mtime=1533282102.554477891 29 atime=1533282103.34649353 30 ctime=1533282233.633065964 parallel-3.1.3/src/m4/std-gnu11.m40000644000175000017500000005762513331003466016350 0ustar00olafolaf00000000000000# Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*- # This implementation is taken from GNU Autoconf lib/autoconf/c.m4 # commit 017d5ddd82854911f0119691d91ea8a1438824d6 # dated Sun Apr 3 13:57:17 2016 -0700 # This implementation will be obsolete once we can assume Autoconf 2.70 # or later is installed everywhere a Gnulib program might be developed. # Copyright (C) 2001-2016 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Written by David MacKenzie, with help from # Akim Demaille, Paul Eggert, # François Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, # Roland McGrath, Noah Friedman, david d zuhn, and many others. # AC_PROG_CC([COMPILER ...]) # -------------------------- # COMPILER ... is a space separated list of C compilers to search for. # This just gives the user an opportunity to specify an alternative # search list for the C compiler. AC_DEFUN_ONCE([AC_PROG_CC], [AC_LANG_PUSH(C)dnl AC_ARG_VAR([CC], [C compiler command])dnl AC_ARG_VAR([CFLAGS], [C compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl _AC_ARG_VAR_LIBS()dnl _AC_ARG_VAR_CPPFLAGS()dnl m4_ifval([$1], [AC_CHECK_TOOLS(CC, [$1])], [AC_CHECK_TOOL(CC, gcc) if test -z "$CC"; then dnl Here we want: dnl AC_CHECK_TOOL(CC, cc) dnl but without the check for a tool without the prefix. dnl Until the check is removed from there, copy the code: if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(CC, [${ac_tool_prefix}cc], [${ac_tool_prefix}cc]) fi fi if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi if test -z "$CC"; then AC_CHECK_TOOLS(CC, cl.exe) fi if test -z "$CC"; then AC_CHECK_TOOL(CC, clang) fi ]) test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH]) # Provide some information about the compiler. _AS_ECHO_LOG([checking for _AC_LANG compiler version]) set X $ac_compile ac_compiler=$[2] for ac_option in --version -v -V -qversion -version; do _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) done m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl _AC_LANG_COMPILER_GNU if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi _AC_PROG_CC_G dnl dnl Set ac_prog_cc_stdc to the supported C version. dnl Also set the documented variable ac_cv_prog_cc_stdc; dnl its name was chosen when it was cached, but it is no longer cached. _AC_PROG_CC_C11([ac_prog_cc_stdc=c11 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11], [_AC_PROG_CC_C99([ac_prog_cc_stdc=c99 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99], [_AC_PROG_CC_C89([ac_prog_cc_stdc=c89 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89], [ac_prog_cc_stdc=no ac_cv_prog_cc_stdc=no])])]) dnl AC_LANG_POP(C)dnl ])# AC_PROG_CC # AC_PROG_CXX([LIST-OF-COMPILERS]) # -------------------------------- # LIST-OF-COMPILERS is a space separated list of C++ compilers to search # for (if not specified, a default list is used). This just gives the # user an opportunity to specify an alternative search list for the C++ # compiler. # aCC HP-UX C++ compiler much better than `CC', so test before. # FCC Fujitsu C++ compiler # KCC KAI C++ compiler # RCC Rational C++ # xlC_r AIX C Set++ (with support for reentrant code) # xlC AIX C Set++ AC_DEFUN([AC_PROG_CXX], [AC_LANG_PUSH(C++)dnl AC_ARG_VAR([CXX], [C++ compiler command])dnl AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl _AC_ARG_VAR_LIBS()dnl _AC_ARG_VAR_CPPFLAGS()dnl _AC_ARG_VAR_PRECIOUS([CCC])dnl if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else AC_CHECK_TOOLS(CXX, [m4_default([$1], [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++])], g++) fi fi # Provide some information about the compiler. _AS_ECHO_LOG([checking for _AC_LANG compiler version]) set X $ac_compile ac_compiler=$[2] for ac_option in --version -v -V -qversion; do _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) done m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl _AC_LANG_COMPILER_GNU if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi _AC_PROG_CXX_G _AC_PROG_CXX_CXX11([ac_prog_cxx_stdcxx=cxx11 ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 ac_cv_prog_cxx_cxx98=$ac_cv_prog_cxx_cxx11], [_AC_PROG_CXX_CXX98([ac_prog_cxx_stdcxx=cxx98 ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98], [ac_prog_cxx_stdcxx=no ac_cv_prog_cxx_stdcxx=no])]) AC_LANG_POP(C++)dnl ])# AC_PROG_CXX # _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST, # ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE) # -------------------------------------------------------------- # Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99') # by trying to compile a program of TEST-PROLOGUE and TEST-BODY. If this fails, # try again with each compiler option in the space-separated OPTION-LIST; if one # helps, append it to CC. If eventually successful, run ACTION-IF-AVAILABLE, # else ACTION-IF-UNAVAILABLE. AC_DEFUN([_AC_C_STD_TRY], [AC_MSG_CHECKING([for $CC option to enable ]m4_translit($1, [c], [C])[ features]) AC_CACHE_VAL(ac_cv_prog_cc_$1, [ac_cv_prog_cc_$1=no ac_save_CC=$CC AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])]) for ac_arg in '' $4 do CC="$ac_save_CC $ac_arg" _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg]) test "x$ac_cv_prog_cc_$1" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC ])# AC_CACHE_VAL ac_prog_cc_stdc_options= case "x$ac_cv_prog_cc_$1" in x) AC_MSG_RESULT([none needed]) ;; xno) AC_MSG_RESULT([unsupported]) ;; *) ac_prog_cc_stdc_options=" $ac_cv_prog_cc_$1" CC=$CC$ac_prog_cc_stdc_options AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;; esac AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6]) ])# _AC_C_STD_TRY # _AC_C_C99_TEST_HEADER # --------------------- # A C header suitable for testing for C99. AC_DEFUN([_AC_C_C99_TEST_HEADER], [[#include #include #include #include #include #include // Check varargs macros. These examples are taken from C99 6.10.3.5. #define debug(...) fprintf (stderr, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK your preprocessor is broken; #endif #if BIG_OK #else your preprocessor is broken; #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\0'; ++i) continue; return 0; } // Check varargs and va_copy. static bool test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str = ""; int number = 0; float fnumber = 0; while (*format) { switch (*format++) { case 's': // string str = va_arg (args_copy, const char *); break; case 'd': // int number = va_arg (args_copy, int); break; case 'f': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); return *str && number && fnumber; }]])# _AC_C_C99_TEST_HEADER # _AC_C_C99_TEST_BODY # ------------------- # A C body suitable for testing for C99, assuming the corresponding header. AC_DEFUN([_AC_C_C99_TEST_BODY], [[ // Check bool. _Bool success = false; // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. success &= test_varargs ("s, d' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' || dynamic_array[ni.number - 1] != 543); ]]) # _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) # ---------------------------------------------------------------- # If the C compiler is not in ISO C99 mode by default, try to add an # option to output variable CC to make it so. This macro tries # various options that select ISO C99 on some system or another. It # considers the compiler to be in ISO C99 mode if it handles _Bool, # // comments, flexible array members, inline, long long int, mixed # code and declarations, named initialization of structs, restrict, # va_copy, varargs macros, variable declarations in for loops and # variable length arrays. AC_DEFUN([_AC_PROG_CC_C99], [_AC_C_STD_TRY([c99], [_AC_C_C99_TEST_HEADER], [_AC_C_C99_TEST_BODY], dnl Try dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999) dnl IBM XL C -qlanglvl=extc1x (V12.1; does not pass C11 test) dnl IBM XL C -qlanglvl=extc99 dnl (pre-V12.1; unused restrictive mode: -qlanglvl=stdc99) dnl HP cc -AC99 dnl Intel ICC -std=c99, -c99 (deprecated) dnl IRIX -c99 dnl Solaris -D_STDC_C99= dnl cc's -xc99 option uses linker magic to define the external dnl symbol __xpg4 as if by "int __xpg4 = 1;", which enables C99 dnl behavior for C library functions. This is not wanted here, dnl because it means that a single module compiled with -xc99 dnl alters C runtime behavior for the entire program, not for dnl just the module. Instead, define the (private) symbol dnl _STDC_C99, which suppresses a bogus failure in . dnl The resulting compiler passes the test case here, and that's dnl good enough. For more, please see the thread starting at: dnl http://lists.gnu.org/archive/html/autoconf/2010-12/msg00059.html dnl Tru64 -c99 dnl with extended modes being tried first. [[-std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc1x -qlanglvl=extc99]], [$1], [$2])[]dnl ])# _AC_PROG_CC_C99 # _AC_PROG_CC_C11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) # ---------------------------------------------------------------- # If the C compiler is not in ISO C11 mode by default, try to add an # option to output variable CC to make it so. This macro tries # various options that select ISO C11 on some system or another. It # considers the compiler to be in ISO C11 mode if it handles _Alignas, # _Alignof, _Noreturn, _Static_assert, UTF-8 string literals, # duplicate typedefs, and anonymous structures and unions. AC_DEFUN([_AC_PROG_CC_C11], [_AC_C_STD_TRY([c11], [_AC_C_C99_TEST_HEADER[ // Check _Alignas. char _Alignas (double) aligned_as_double; char _Alignas (0) no_special_alignment; extern char aligned_as_int; char _Alignas (0) _Alignas (int) aligned_as_int; // Check _Alignof. enum { int_alignment = _Alignof (int), int_array_alignment = _Alignof (int[100]), char_alignment = _Alignof (char) }; _Static_assert (0 < -_Alignof (int), "_Alignof is signed"); // Check _Noreturn. int _Noreturn does_not_return (void) { for (;;) continue; } // Check _Static_assert. struct test_static_assert { int x; _Static_assert (sizeof (int) <= sizeof (long int), "_Static_assert does not work in struct"); long int y; }; // Check UTF-8 literals. #define u8 syntax error! char const utf8_literal[] = u8"happens to be ASCII" "another string"; // Check duplicate typedefs. typedef long *long_ptr; typedef long int *long_ptr; typedef long_ptr long_ptr; // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. struct anonymous { union { struct { int i; int j; }; struct { int k; long int l; } w; }; int m; } v1; ]], [_AC_C_C99_TEST_BODY[ v1.i = 2; v1.w.k = 5; _Static_assert ((offsetof (struct anonymous, i) == offsetof (struct anonymous, w.k)), "Anonymous union alignment botch"); ]], dnl Try dnl GCC -std=gnu11 (unused restrictive mode: -std=c11) dnl with extended modes being tried first. dnl dnl Do not try -qlanglvl=extc1x, because IBM XL C V12.1 (the latest version as dnl of September 2012) does not pass the C11 test. For now, try extc1x when dnl compiling the C99 test instead, since it enables _Static_assert and dnl _Noreturn, which is a win. If -qlanglvl=extc11 or -qlanglvl=extc1x passes dnl the C11 test in some future version of IBM XL C, we'll add it here, dnl preferably extc11. [[-std=gnu11]], [$1], [$2])[]dnl ])# _AC_PROG_CC_C11 # AC_PROG_CC_C89 # -------------- # Do not use AU_ALIAS here and in AC_PROG_CC_C99 and AC_PROG_CC_STDC, # as that'd be incompatible with how Automake redefines AC_PROG_CC. See # . AU_DEFUN([AC_PROG_CC_C89], [AC_REQUIRE([AC_PROG_CC])], [$0 is obsolete; use AC_PROG_CC] ) # AC_PROG_CC_C99 # -------------- AU_DEFUN([AC_PROG_CC_C99], [AC_REQUIRE([AC_PROG_CC])], [$0 is obsolete; use AC_PROG_CC] ) # AC_PROG_CC_STDC # --------------- AU_DEFUN([AC_PROG_CC_STDC], [AC_REQUIRE([AC_PROG_CC])], [$0 is obsolete; use AC_PROG_CC] ) # AC_C_PROTOTYPES # --------------- # Check if the C compiler supports prototypes, included if it needs # options. AC_DEFUN([AC_C_PROTOTYPES], [AC_REQUIRE([AC_PROG_CC])dnl if test "$ac_prog_cc_stdc" != no; then AC_DEFINE(PROTOTYPES, 1, [Define to 1 if the C compiler supports function prototypes.]) AC_DEFINE(__PROTOTYPES, 1, [Define like PROTOTYPES; this can be used by system headers.]) fi ])# AC_C_PROTOTYPES # _AC_CXX_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST, # ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE) # ---------------------------------------------------------------- # Check whether the C++ compiler accepts features of STANDARD (e.g # `cxx98', `cxx11') by trying to compile a program of TEST-PROLOGUE # and TEST-BODY. If this fails, try again with each compiler option # in the space-separated OPTION-LIST; if one helps, append it to CXX. # If eventually successful, run ACTION-IF-AVAILABLE, else # ACTION-IF-UNAVAILABLE. AC_DEFUN([_AC_CXX_STD_TRY], [AC_MSG_CHECKING([for $CXX option to enable ]m4_translit(m4_translit($1, [x], [+]), [a-z], [A-Z])[ features]) AC_LANG_PUSH(C++)dnl AC_CACHE_VAL(ac_cv_prog_cxx_$1, [ac_cv_prog_cxx_$1=no ac_save_CXX=$CXX AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])]) for ac_arg in '' $4 do CXX="$ac_save_CXX $ac_arg" _AC_COMPILE_IFELSE([], [ac_cv_prog_cxx_$1=$ac_arg]) test "x$ac_cv_prog_cxx_$1" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX ])# AC_CACHE_VAL ac_prog_cxx_stdcxx_options= case "x$ac_cv_prog_cxx_$1" in x) AC_MSG_RESULT([none needed]) ;; xno) AC_MSG_RESULT([unsupported]) ;; *) ac_prog_cxx_stdcxx_options=" $ac_cv_prog_cxx_$1" CXX=$CXX$ac_prog_cxx_stdcxx_options AC_MSG_RESULT([$ac_cv_prog_cxx_$1]) ;; esac AC_LANG_POP(C++)dnl AS_IF([test "x$ac_cv_prog_cxx_$1" != xno], [$5], [$6]) ])# _AC_CXX_STD_TRY # _AC_CXX_CXX98_TEST_HEADER # ------------------------- # A C++ header suitable for testing for CXX98. AC_DEFUN([_AC_CXX_CXX98_TEST_HEADER], [[ #include #include #include #include #include #include #include #include #include #include #include #include #include namespace test { typedef std::vector string_vec; typedef std::pair map_value; typedef std::map map_type; typedef std::set set_type; template class printer { public: printer(std::ostringstream& os): os(os) {} void operator() (T elem) { os << elem << std::endl; } private: std::ostringstream& os; }; } ]])# _AC_CXX_CXX98_TEST_HEADER # _AC_CXX_CXX98_TEST_BODY # ----------------------- # A C++ body suitable for testing for CXX98, assuming the corresponding header. AC_DEFUN([_AC_CXX_CXX98_TEST_BODY], [[ try { // Basic string. std::string teststr("ASCII text"); teststr += " string"; // Simple vector. test::string_vec testvec; testvec.push_back(teststr); testvec.push_back("foo"); testvec.push_back("bar"); if (testvec.size() != 3) { throw std::runtime_error("vector size is not 1"); } // Dump vector into stringstream and obtain string. std::ostringstream os; for (test::string_vec::const_iterator i = testvec.begin(); i != testvec.end(); ++i) { if (i + 1 != testvec.end()) { os << teststr << '\n'; } } // Check algorithms work. std::for_each(testvec.begin(), testvec.end(), test::printer(os)); std::string os_out = os.str(); // Test pair and map. test::map_type testmap; testmap.insert(std::make_pair(std::string("key"), std::make_pair(53,false))); // Test set. int values[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; test::set_type testset(values, values + sizeof(values)/sizeof(values[0])); std::list testlist(testset.begin(), testset.end()); std::copy(testset.begin(), testset.end(), std::back_inserter(testlist)); } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << std::endl; // Test fstream std::ofstream of("test.txt"); of << "Test ASCII text\n" << std::flush; of << "N= " << std::hex << std::setw(8) << std::left << 534 << std::endl; of.close(); } std::exit(0); ]]) # _AC_CXX_CXX11_TEST_HEADER # ------------------------- # A C++ header suitable for testing for CXX11. AC_DEFUN([_AC_CXX_CXX11_TEST_HEADER], [[ #include #include #include #include #include #include #include namespace cxx11test { typedef std::shared_ptr sptr; typedef std::weak_ptr wptr; typedef std::tuple tp; typedef std::array int_array; constexpr int get_val() { return 20; } struct testinit { int i; double d; }; class delegate { public: delegate(int n) : n(n) {} delegate(): delegate(2354) {} virtual int getval() { return this->n; }; protected: int n; }; class overridden : public delegate { public: overridden(int n): delegate(n) {} virtual int getval() override final { return this->n * 2; } }; class nocopy { public: nocopy(int i): i(i) {} nocopy() = default; nocopy(const nocopy&) = delete; nocopy & operator=(const nocopy&) = delete; private: int i; }; } ]])# _AC_CXX_CXX11_TEST_HEADER # _AC_CXX_CXX11_TEST_BODY # ----------------------- # A C++ body suitable for testing for CXX11, assuming the corresponding header. AC_DEFUN([_AC_CXX_CXX11_TEST_BODY], [[ { // Test auto and decltype std::deque d; d.push_front(43); d.push_front(484); d.push_front(3); d.push_front(844); int total = 0; for (auto i = d.begin(); i != d.end(); ++i) { total += *i; } auto a1 = 6538; auto a2 = 48573953.4; auto a3 = "String literal"; decltype(a2) a4 = 34895.034; } { // Test constexpr short sa[cxx11test::get_val()] = { 0 }; } { // Test initializer lists cxx11test::testinit il = { 4323, 435234.23544 }; } { // Test range-based for and lambda cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; for (int &x : array) { x += 23; } std::for_each(array.begin(), array.end(), [](int v1){ std::cout << v1; }); } { using cxx11test::sptr; using cxx11test::wptr; sptr sp(new std::string("ASCII string")); wptr wp(sp); sptr sp2(wp); } { cxx11test::tp tuple("test", 54, 45.53434); double d = std::get<2>(tuple); std::string s; int i; std::tie(s,i,d) = tuple; } { static std::regex filename_regex("^_?([a-z0-9_.]+-)+[a-z0-9]+$"); std::string testmatch("Test if this string matches"); bool match = std::regex_search(testmatch, filename_regex); } { cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; cxx11test::int_array::size_type size = array.size(); } { // Test constructor delegation cxx11test::delegate d1; cxx11test::delegate d2(); cxx11test::delegate d3(45); } { // Test override and final cxx11test::overridden o1(55464); } { // Test nullptr char *c = nullptr; } { // Test template brackets std::vector> v1; } { // Unicode literals char const *utf8 = u8"UTF-8 string \u2500"; char16_t const *utf16 = u"UTF-8 string \u2500"; char32_t const *utf32 = U"UTF-32 string \u2500"; } ]]) # _AC_PROG_CXX_CXX98 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) # ------------------------------------------------------------------- # If the C++ compiler is not in ISO C++98 mode by default, try to add # an option to output variable CXX to make it so. This macro tries # various options that select ISO C++98 on some system or another. It # considers the compiler to be in ISO C++98 mode if it handles basic # features of the std namespace including: string, containers (list, # map, set, vector), streams (fstreams, iostreams, stringstreams, # iomanip), pair, exceptions and algorithms. AC_DEFUN([_AC_PROG_CXX_CXX98], [_AC_CXX_STD_TRY([cxx98], [_AC_CXX_CXX98_TEST_HEADER], [_AC_CXX_CXX98_TEST_BODY], dnl Try dnl GCC -std=gnu++98 (unused restrictive mode: -std=c++98) dnl IBM XL C -qlanglvl=extended dnl HP aC++ -AA dnl Intel ICC -std=gnu++98 dnl Solaris N/A (default) dnl Tru64 N/A (default, but -std gnu could be used) dnl with extended modes being tried first. [[-std=gnu++98 -std=c++98 -qlanglvl=extended -AA]], [$1], [$2])[]dnl ])# _AC_PROG_CXX_CXX98 # _AC_PROG_CXX_CXX11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) # ------------------------------------------------------------------- # If the C++ compiler is not in ISO CXX11 mode by default, try to add # an option to output variable CXX to make it so. This macro tries # various options that select ISO C++11 on some system or another. It # considers the compiler to be in ISO C++11 mode if it handles all the # tests from the C++98 checks, plus the following: Language features # (auto, constexpr, decltype, default/deleted constructors, delegate # constructors, final, initializer lists, lambda functions, nullptr, # override, range-based for loops, template brackets without spaces, # unicode literals) and library features (array, memory (shared_ptr, # weak_ptr), regex and tuple types). AC_DEFUN([_AC_PROG_CXX_CXX11], [_AC_CXX_STD_TRY([cxx11], [_AC_CXX_CXX11_TEST_HEADER _AC_CXX_CXX98_TEST_HEADER], [_AC_CXX_CXX11_TEST_BODY _AC_CXX_CXX98_TEST_BODY], dnl Try dnl GCC -std=gnu++11 (unused restrictive mode: -std=c++11) [and 0x variants] dnl IBM XL C -qlanglvl=extended0x dnl (pre-V12.1; unused restrictive mode: -qlanglvl=stdcxx11) dnl HP aC++ -AA dnl Intel ICC -std=c++11 -std=c++0x dnl Solaris N/A (no support) dnl Tru64 N/A (no support) dnl with extended modes being tried first. [[-std=gnu++11 -std=c++11 -std=gnu++0x -std=c++0x -qlanglvl=extended0x -AA]], [$1], [$2])[]dnl ])# _AC_PROG_CXX_CXX11 parallel-3.1.3/src/PaxHeaders.30520/minimal-load-save.h0000644000000000000000000000013013331003466017274 xustar0029 mtime=1533282102.55847797 29 atime=1533282227.62094726 30 ctime=1533282233.633065964 parallel-3.1.3/src/minimal-load-save.h0000644000175000017500000000214113331003466017472 0ustar00olafolaf00000000000000/* Copyright (C) 2016-2018 Olaf Till . */ #include #include #include "config.h" int minimal_read_header (std::istream& is, bool& swap, OCTAVE__MACH_INFO::float_format& flt_fmt); int minimal_read_data (std::istream& is, octave_value& val, bool swap, OCTAVE__MACH_INFO::float_format flt_fmt); void minimal_write_header (std::ostream& os); int minimal_write_data (std::ostream& os, octave_value& val); parallel-3.1.3/src/PaxHeaders.30520/configure0000644000000000000000000000013213331003470015525 xustar0030 mtime=1533282104.710520462 30 atime=1533282105.118528518 30 ctime=1533282233.633065964 parallel-3.1.3/src/configure0000755000175000017500000071513413331003470015741 0ustar00olafolaf00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for parallel 3.1.3. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and i7tiol@t-online.de $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='parallel' PACKAGE_TARNAME='parallel' PACKAGE_VERSION='3.1.3' PACKAGE_STRING='parallel 3.1.3' PACKAGE_BUGREPORT='i7tiol@t-online.de' PACKAGE_URL='' ac_unique_file="pconnect.cc" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS HAVE_GETPASS LIBOBJS HAVE_WINSOCK HAVE_GNUTLS_EXTRA HAVE_GNUTLS PKG_CONFIG REDUCED_BUILD EGREP GREP CPP ac_ct_CC CFLAGS CC CXXCPP OBJEXT EXEEXT ac_ct_CXX CPPFLAGS LDFLAGS CXXFLAGS CXX SED OCTAVE_CONFIG MKOCTFILE target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_cluster ' ac_precious_vars='build_alias host_alias target_alias CXX CXXFLAGS LDFLAGS LIBS CPPFLAGS CCC CXXCPP CC CFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures parallel 3.1.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/parallel] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of parallel 3.1.3:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-cluster build functions for parallelism over clusters (default is yes) Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXXCPP C++ preprocessor CC C compiler command CFLAGS C compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF parallel configure 3.1.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## --------------------------------- ## ## Report this to i7tiol@t-online.de ## ## --------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_find_intX_t LINENO BITS VAR # ----------------------------------- # Finds a signed integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_intX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in int$2_t 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else case $ac_type in #( int$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_intX_t # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link # ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES # --------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_cxx_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## --------------------------------- ## ## Report this to i7tiol@t-online.de ## ## --------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_cxx_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by parallel $as_me 3.1.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" # Avoid warnings for redefining AH-generated preprocessor symbols of # Octave. # Checks for programs. # Extract the first word of "mkoctfile", so it can be a program name with args. set dummy mkoctfile; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MKOCTFILE+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MKOCTFILE"; then ac_cv_prog_MKOCTFILE="$MKOCTFILE" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MKOCTFILE="mkoctfile" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MKOCTFILE=$ac_cv_prog_MKOCTFILE if test -n "$MKOCTFILE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKOCTFILE" >&5 $as_echo "$MKOCTFILE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$MKOCTFILE"; then as_fn_error 1 "mkoctfile not found" "$LINENO" 5; fi # Extract the first word of "octave-config", so it can be a program name with args. set dummy octave-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCTAVE_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCTAVE_CONFIG"; then ac_cv_prog_OCTAVE_CONFIG="$OCTAVE_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OCTAVE_CONFIG="octave-config" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OCTAVE_CONFIG=$ac_cv_prog_OCTAVE_CONFIG if test -n "$OCTAVE_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCTAVE_CONFIG" >&5 $as_echo "$OCTAVE_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$OCTAVE_CONFIG"; then as_fn_error 1 "octave-config not found" "$LINENO" 5; fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed # The same value of CXX as Octave was compiled with is supposed to be # used. CXX=${CXX:-`${MKOCTFILE} -p CXX`} # The AC_PROG_CXX macro is locally defined to a recent version which # checks for C++11. If necessary, a suitable option is appended to # CXX. ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 $as_echo_n "checking whether the C++ compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C++ compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 $as_echo_n "checking for C++ compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 $as_echo_n "checking for $CXX option to enable C++11 features... " >&6; } ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if ${ac_cv_prog_cxx_cxx11+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cxx_cxx11=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include #include #include namespace cxx11test { typedef std::shared_ptr sptr; typedef std::weak_ptr wptr; typedef std::tuple tp; typedef std::array int_array; constexpr int get_val() { return 20; } struct testinit { int i; double d; }; class delegate { public: delegate(int n) : n(n) {} delegate(): delegate(2354) {} virtual int getval() { return this->n; }; protected: int n; }; class overridden : public delegate { public: overridden(int n): delegate(n) {} virtual int getval() override final { return this->n * 2; } }; class nocopy { public: nocopy(int i): i(i) {} nocopy() = default; nocopy(const nocopy&) = delete; nocopy & operator=(const nocopy&) = delete; private: int i; }; } #include #include #include #include #include #include #include #include #include #include #include #include #include namespace test { typedef std::vector string_vec; typedef std::pair map_value; typedef std::map map_type; typedef std::set set_type; template class printer { public: printer(std::ostringstream& os): os(os) {} void operator() (T elem) { os << elem << std::endl; } private: std::ostringstream& os; }; } int main () { { // Test auto and decltype std::deque d; d.push_front(43); d.push_front(484); d.push_front(3); d.push_front(844); int total = 0; for (auto i = d.begin(); i != d.end(); ++i) { total += *i; } auto a1 = 6538; auto a2 = 48573953.4; auto a3 = "String literal"; decltype(a2) a4 = 34895.034; } { // Test constexpr short sa[cxx11test::get_val()] = { 0 }; } { // Test initializer lists cxx11test::testinit il = { 4323, 435234.23544 }; } { // Test range-based for and lambda cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; for (int &x : array) { x += 23; } std::for_each(array.begin(), array.end(), [](int v1){ std::cout << v1; }); } { using cxx11test::sptr; using cxx11test::wptr; sptr sp(new std::string("ASCII string")); wptr wp(sp); sptr sp2(wp); } { cxx11test::tp tuple("test", 54, 45.53434); double d = std::get<2>(tuple); std::string s; int i; std::tie(s,i,d) = tuple; } { static std::regex filename_regex("^_?([a-z0-9_.]+-)+[a-z0-9]+$"); std::string testmatch("Test if this string matches"); bool match = std::regex_search(testmatch, filename_regex); } { cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; cxx11test::int_array::size_type size = array.size(); } { // Test constructor delegation cxx11test::delegate d1; cxx11test::delegate d2(); cxx11test::delegate d3(45); } { // Test override and final cxx11test::overridden o1(55464); } { // Test nullptr char *c = nullptr; } { // Test template brackets std::vector> v1; } { // Unicode literals char const *utf8 = u8"UTF-8 string \u2500"; char16_t const *utf16 = u"UTF-8 string \u2500"; char32_t const *utf32 = U"UTF-32 string \u2500"; } try { // Basic string. std::string teststr("ASCII text"); teststr += " string"; // Simple vector. test::string_vec testvec; testvec.push_back(teststr); testvec.push_back("foo"); testvec.push_back("bar"); if (testvec.size() != 3) { throw std::runtime_error("vector size is not 1"); } // Dump vector into stringstream and obtain string. std::ostringstream os; for (test::string_vec::const_iterator i = testvec.begin(); i != testvec.end(); ++i) { if (i + 1 != testvec.end()) { os << teststr << '\n'; } } // Check algorithms work. std::for_each(testvec.begin(), testvec.end(), test::printer(os)); std::string os_out = os.str(); // Test pair and map. test::map_type testmap; testmap.insert(std::make_pair(std::string("key"), std::make_pair(53,false))); // Test set. int values[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; test::set_type testset(values, values + sizeof(values)/sizeof(values[0])); std::list testlist(testset.begin(), testset.end()); std::copy(testset.begin(), testset.end(), std::back_inserter(testlist)); } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << std::endl; // Test fstream std::ofstream of("test.txt"); of << "Test ASCII text\n" << std::flush; of << "N= " << std::hex << std::setw(8) << std::left << 534 << std::endl; of.close(); } std::exit(0); ; return 0; } _ACEOF for ac_arg in '' -std=gnu++11 -std=c++11 -std=gnu++0x -std=c++0x -qlanglvl=extended0x -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_cxx11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cxx_cxx11" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX fi # AC_CACHE_VAL ac_prog_cxx_stdcxx_options= case "x$ac_cv_prog_cxx_cxx11" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) ac_prog_cxx_stdcxx_options=" $ac_cv_prog_cxx_cxx11" CXX=$CXX$ac_prog_cxx_stdcxx_options { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 $as_echo "$ac_cv_prog_cxx_cxx11" >&6; } ;; esac ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test "x$ac_cv_prog_cxx_cxx11" != xno; then : ac_prog_cxx_stdcxx=cxx11 ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 ac_cv_prog_cxx_cxx98=$ac_cv_prog_cxx_cxx11 else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 $as_echo_n "checking for $CXX option to enable C++98 features... " >&6; } ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if ${ac_cv_prog_cxx_cxx98+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cxx_cxx98=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include #include #include #include #include #include #include #include #include namespace test { typedef std::vector string_vec; typedef std::pair map_value; typedef std::map map_type; typedef std::set set_type; template class printer { public: printer(std::ostringstream& os): os(os) {} void operator() (T elem) { os << elem << std::endl; } private: std::ostringstream& os; }; } int main () { try { // Basic string. std::string teststr("ASCII text"); teststr += " string"; // Simple vector. test::string_vec testvec; testvec.push_back(teststr); testvec.push_back("foo"); testvec.push_back("bar"); if (testvec.size() != 3) { throw std::runtime_error("vector size is not 1"); } // Dump vector into stringstream and obtain string. std::ostringstream os; for (test::string_vec::const_iterator i = testvec.begin(); i != testvec.end(); ++i) { if (i + 1 != testvec.end()) { os << teststr << '\n'; } } // Check algorithms work. std::for_each(testvec.begin(), testvec.end(), test::printer(os)); std::string os_out = os.str(); // Test pair and map. test::map_type testmap; testmap.insert(std::make_pair(std::string("key"), std::make_pair(53,false))); // Test set. int values[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; test::set_type testset(values, values + sizeof(values)/sizeof(values[0])); std::list testlist(testset.begin(), testset.end()); std::copy(testset.begin(), testset.end(), std::back_inserter(testlist)); } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << std::endl; // Test fstream std::ofstream of("test.txt"); of << "Test ASCII text\n" << std::flush; of << "N= " << std::hex << std::setw(8) << std::left << 534 << std::endl; of.close(); } std::exit(0); ; return 0; } _ACEOF for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_cxx98=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cxx_cxx98" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX fi # AC_CACHE_VAL ac_prog_cxx_stdcxx_options= case "x$ac_cv_prog_cxx_cxx98" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) ac_prog_cxx_stdcxx_options=" $ac_cv_prog_cxx_cxx98" CXX=$CXX$ac_prog_cxx_stdcxx_options { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 $as_echo "$ac_cv_prog_cxx_cxx98" >&6; } ;; esac ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test "x$ac_cv_prog_cxx_cxx98" != xno; then : ac_prog_cxx_stdcxx=cxx98 ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 else ac_prog_cxx_stdcxx=no ac_cv_prog_cxx_stdcxx=no fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Require C++11. if test "x$ac_prog_cxx_stdcxx" != "xcxx11"; then as_fn_error $? "could not enforce using C++11 features" "$LINENO" 5 fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 $as_echo_n "checking for $CC option to enable C11 features... " >&6; } if ${ac_cv_prog_cc_c11+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include #include // Check varargs macros. These examples are taken from C99 6.10.3.5. #define debug(...) fprintf (stderr, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK your preprocessor is broken; #endif #if BIG_OK #else your preprocessor is broken; #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\0'; ++i) continue; return 0; } // Check varargs and va_copy. static bool test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str = ""; int number = 0; float fnumber = 0; while (*format) { switch (*format++) { case 's': // string str = va_arg (args_copy, const char *); break; case 'd': // int number = va_arg (args_copy, int); break; case 'f': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); return *str && number && fnumber; } // Check _Alignas. char _Alignas (double) aligned_as_double; char _Alignas (0) no_special_alignment; extern char aligned_as_int; char _Alignas (0) _Alignas (int) aligned_as_int; // Check _Alignof. enum { int_alignment = _Alignof (int), int_array_alignment = _Alignof (int[100]), char_alignment = _Alignof (char) }; _Static_assert (0 < -_Alignof (int), "_Alignof is signed"); // Check _Noreturn. int _Noreturn does_not_return (void) { for (;;) continue; } // Check _Static_assert. struct test_static_assert { int x; _Static_assert (sizeof (int) <= sizeof (long int), "_Static_assert does not work in struct"); long int y; }; // Check UTF-8 literals. #define u8 syntax error! char const utf8_literal[] = u8"happens to be ASCII" "another string"; // Check duplicate typedefs. typedef long *long_ptr; typedef long int *long_ptr; typedef long_ptr long_ptr; // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. struct anonymous { union { struct { int i; int j; }; struct { int k; long int l; } w; }; int m; } v1; int main () { // Check bool. _Bool success = false; // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. success &= test_varargs ("s, d' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' || dynamic_array[ni.number - 1] != 543); v1.i = 2; v1.w.k = 5; _Static_assert ((offsetof (struct anonymous, i) == offsetof (struct anonymous, w.k)), "Anonymous union alignment botch"); ; return 0; } _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL ac_prog_cc_stdc_options= case "x$ac_cv_prog_cc_c11" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) ac_prog_cc_stdc_options=" $ac_cv_prog_cc_c11" CC=$CC$ac_prog_cc_stdc_options { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 $as_echo "$ac_cv_prog_cc_c11" >&6; } ;; esac if test "x$ac_cv_prog_cc_c11" != xno; then : ac_prog_cc_stdc=c11 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 $as_echo_n "checking for $CC option to enable C99 features... " >&6; } if ${ac_cv_prog_cc_c99+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include #include // Check varargs macros. These examples are taken from C99 6.10.3.5. #define debug(...) fprintf (stderr, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK your preprocessor is broken; #endif #if BIG_OK #else your preprocessor is broken; #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\0'; ++i) continue; return 0; } // Check varargs and va_copy. static bool test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str = ""; int number = 0; float fnumber = 0; while (*format) { switch (*format++) { case 's': // string str = va_arg (args_copy, const char *); break; case 'd': // int number = va_arg (args_copy, int); break; case 'f': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); return *str && number && fnumber; } int main () { // Check bool. _Bool success = false; // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. success &= test_varargs ("s, d' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' || dynamic_array[ni.number - 1] != 543); ; return 0; } _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc1x -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL ac_prog_cc_stdc_options= case "x$ac_cv_prog_cc_c99" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) ac_prog_cc_stdc_options=" $ac_cv_prog_cc_c99" CC=$CC$ac_prog_cc_stdc_options { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;; esac if test "x$ac_cv_prog_cc_c99" != xno; then : ac_prog_cc_stdc=c99 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 $as_echo_n "checking for $CC option to enable C89 features... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL ac_prog_cc_stdc_options= case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) ac_prog_cc_stdc_options=" $ac_cv_prog_cc_c89" CC=$CC$ac_prog_cc_stdc_options { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : ac_prog_cc_stdc=c89 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 else ac_prog_cc_stdc=no ac_cv_prog_cc_stdc=no fi fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ## The first AC_CHECK_HEADER should be called unconditionally, since ## this macro arranges some preconditions only the first time it is ## expanded. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default" if test "x$ac_cv_header_gnutls_gnutls_h" = xyes; then : fi ## On some platforms only the functions for local parallelism can be ## installed. # Check whether --enable-cluster was given. if test "${enable_cluster+set}" = set; then : enableval=$enable_cluster; fi if test "x$enable_cluster" = "xno"; then REDUCED_BUILD=yes { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: As requested, the functions for parallelism over clusters will not be built." >&5 $as_echo "$as_me: WARNING: As requested, the functions for parallelism over clusters will not be built." >&2;} else REDUCED_BUILD=no # Checks for gnutls libraries. if test "x$ac_cv_header_gnutls_gnutls_h" = "xyes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_global_init in -lgnutls" >&5 $as_echo_n "checking for gnutls_global_init in -lgnutls... " >&6; } if ${ac_cv_lib_gnutls_gnutls_global_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgnutls $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gnutls_global_init (); int main () { return gnutls_global_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_gnutls_gnutls_global_init=yes else ac_cv_lib_gnutls_gnutls_global_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_gnutls_global_init" >&5 $as_echo "$ac_cv_lib_gnutls_gnutls_global_init" >&6; } if test "x$ac_cv_lib_gnutls_gnutls_global_init" = xyes; then : echo -n "" fi if test "x$ac_cv_lib_gnutls_gnutls_global_init" = "xyes"; then LIBS="-lgnutls $LIBS" # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PKG_CONFIG"; then ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PKG_CONFIG="pkg-config" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PKG_CONFIG=$ac_cv_prog_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$PKG_CONFIG"; then HAVE_GNUTLS=no { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: TLS disabled since pkg-config not found" >&5 $as_echo "$as_me: WARNING: TLS disabled since pkg-config not found" >&2;} else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { printf ("%u", gnutls_srp_2048_group_prime.size); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_LIBGNUTLS 1" >>confdefs.h HAVE_GNUTLS=yes cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { const gnutls_datum_t *dat = NULL; gnutls_datum_t *res = NULL; gnutls_srp_base64_decode2 (dat, res); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define HAVE_GNUTLS_SRP_BASE64_DECODE2 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else HAVE_GNUTLS=no { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: TLS disabled since symbol gnutls_srp_2048_group_prime not found in gnutls library - built with --disable-srp-authentication?" >&5 $as_echo "$as_me: WARNING: TLS disabled since symbol gnutls_srp_2048_group_prime not found in gnutls library - built with --disable-srp-authentication?" >&2;} fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_global_init_extra in -lgnutls-extra" >&5 $as_echo_n "checking for gnutls_global_init_extra in -lgnutls-extra... " >&6; } if ${ac_cv_lib_gnutls_extra_gnutls_global_init_extra+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgnutls-extra $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gnutls_global_init_extra (); int main () { return gnutls_global_init_extra (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_gnutls_extra_gnutls_global_init_extra=yes else ac_cv_lib_gnutls_extra_gnutls_global_init_extra=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_extra_gnutls_global_init_extra" >&5 $as_echo "$ac_cv_lib_gnutls_extra_gnutls_global_init_extra" >&6; } if test "x$ac_cv_lib_gnutls_extra_gnutls_global_init_extra" = xyes; then : echo -n "" fi if test "x$ac_cv_lib_gnutls_extra_gnutls_global_init_extra" = "xyes"; then LIBS="-lgnutls-extra $LIBS" $as_echo "#define HAVE_LIBGNUTLS_EXTRA 1" >>confdefs.h HAVE_GNUTLS_EXTRA=yes else HAVE_GNUTLS_EXTRA=no fi else HAVE_GNUTLS=no { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: TLS disabled since no gnutls library found" >&5 $as_echo "$as_me: WARNING: TLS disabled since no gnutls library found" >&2;} fi else HAVE_GNUTLS=no { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: TLS disabled since gnutls/gnutls.h not found or not compilable" >&5 $as_echo "$as_me: WARNING: TLS disabled since gnutls/gnutls.h not found or not compilable" >&2;} fi fi # Checks for socket libraries. ac_fn_c_check_header_mongrel "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" if test "x$ac_cv_header_sys_socket_h" = xyes; then : fi if test "x$ac_cv_header_sys_socket_h" = "xyes"; then ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket" if test "x$ac_cv_func_socket" = xyes; then : else as_fn_error $? "function socket not found" "$LINENO" 5 fi else # winsock2 stuff ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" if test "x$ac_cv_header_winsock2_h" = xyes; then : fi if test "x$ac_cv_header_winsock2_h" = "xno"; then as_fn_error $? "neither sys/socket.h nor winsock2.h found" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lws2_32" >&5 $as_echo_n "checking for socket in -lws2_32... " >&6; } if ${ac_cv_lib_ws2_32_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lws2_32 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ws2_32_socket=yes else ac_cv_lib_ws2_32_socket=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ws2_32_socket" >&5 $as_echo "$ac_cv_lib_ws2_32_socket" >&6; } if test "x$ac_cv_lib_ws2_32_socket" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBWS2_32 1 _ACEOF LIBS="-lws2_32 $LIBS" fi if test "x$ac_cv_lib_ws2_32_socket" = "xyes"; then HAVE_WINSOCK=yes else as_fn_error $? "found winsock2.h but no corresponding library" "$LINENO" 5 fi fi fi # Checks for header files. for ac_header in arpa/inet.h fcntl.h limits.h malloc.h sys/malloc.h netdb.h netinet/in.h stdio_ext.h stdlib.h string.h sys/time.h termios.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_header_malloc_h" = "xno"; then if test "x$ac_cv_header_sys_malloc_h" = "xno"; then as_fn_error $? "neither malloc.h nor sys/malloc.h found" "$LINENO" 5 fi fi # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h fi ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" case $ac_cv_c_int32_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int32_t $ac_cv_c_int32_t _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define mode_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) $as_echo "#define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac # Checks for library functions. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5 $as_echo_n "checking for error_at_line... " >&6; } if ${ac_cv_lib_error_at_line+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { error_at_line (0, 0, "", 0, "an error occurred"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_error_at_line=yes else ac_cv_lib_error_at_line=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_error_at_line" >&5 $as_echo "$ac_cv_lib_error_at_line" >&6; } if test $ac_cv_lib_error_at_line = no; then case " $LIBOBJS " in *" error.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS error.$ac_objext" ;; esac fi for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" if test "x$ac_cv_header_vfork_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF fi done for ac_func in fork vfork do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if ${ac_cv_func_fork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_fork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_fork_works=yes else ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 $as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if ${ac_cv_func_vfork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vfork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_vfork_works=yes else ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 $as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then $as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h else $as_echo "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5 $as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; } if ${ac_cv_sys_largefile_source+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* for off_t */ #include int main () { int (*fp) (FILE *, off_t, int) = fseeko; return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_sys_largefile_source=no; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGEFILE_SOURCE 1 #include /* for off_t */ #include int main () { int (*fp) (FILE *, off_t, int) = fseeko; return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_sys_largefile_source=1; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_cv_sys_largefile_source=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5 $as_echo "$ac_cv_sys_largefile_source" >&6; } case $ac_cv_sys_largefile_source in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source _ACEOF ;; esac rm -rf conftest* # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug # in glibc 2.1.3, but that breaks too many other things. # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. if test $ac_cv_sys_largefile_source != unknown; then $as_echo "#define HAVE_FSEEKO 1" >>confdefs.h fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF for ac_func in memset mkdir modf select strchr strdup uname do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else as_fn_error $? "required system functions not found" "$LINENO" 5 fi done ac_fn_c_check_func "$LINENO" "getpass" "ac_cv_func_getpass" if test "x$ac_cv_func_getpass" = xyes; then : fi if test "x$ac_cv_func_getpass" = "xyes"; then $as_echo "#define HAVE_GETPASS 1" >>confdefs.h HAVE_GETPASS=yes else HAVE_GETPASS=no fi # Start of checks for Octave features, preparations for checks. OCTLIBDIR=${OCTLIBDIR:-`$OCTAVE_CONFIG -p OCTLIBDIR`} ## We need Octaves include path both with and without '/octave' ## appended. The path without '/octave' is needed to selectively test ## for Octave headers, like octave/....h. The path with '/octave' is ## needed since some Octave headers contain include directives for ## other Octave headers with <> instead of "". OCTINCLUDEDIR=${OCTINCLUDEDIR:-`$MKOCTFILE -p INCFLAGS`} ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu TCXXFLAGS=$CXXFLAGS TLDFLAGS=$LDFLAGS TLIBS=$LIBS TCPPFLAGS=$CPPFLAGS LDFLAGS="-L$OCTLIBDIR $LDFLAGS" LIBS="-loctinterp $LIBS" # CXXFLAGS= CPPFLAGS="$OCTINCLUDEDIR $CPPFLAGS" ## Presence of 'error_state' -- does _not_ indicate no exceptions are ## used. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { printf ("%i", error_state); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : $as_echo "#define HAVE_OCTAVE_ERROR_STATE 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ## Presence of 'verror (octave_execution_exception&, const char *, ## va_list)' cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { octave_execution_exception e; va_list args; verror (e, "test", args); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : $as_echo "#define HAVE_OCTAVE_VERROR_ARG_EXC 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ## Presence of octave/interpreter.h. If present, we assume that ## octave/call-stack.h is also present. Code corresponding to both of ## them was formerly in octave/toplev.h, the latter being now ## deprecated. Setting CPPFLAGS is necessary for the tests in ## OF_OCTAVE_LIST_ALT_SYMS to work correctly without messing up the ## result of the current test. for ac_header in octave/interpreter.h do : ac_fn_cxx_check_header_mongrel "$LINENO" "octave/interpreter.h" "ac_cv_header_octave_interpreter_h" "$ac_includes_default" if test "x$ac_cv_header_octave_interpreter_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_OCTAVE_INTERPRETER_H 1 _ACEOF CPPFLAGS="-include octave/interpreter.h -include octave/call-stack.h $CPPFLAGS" fi done ## Simple symbol alternatives of different Octave versions. echo '/* generated by configure */' > oct-alt-includes.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking octave_execution_exception or octave::execution_exception" >&5 $as_echo_n "checking octave_execution_exception or octave::execution_exception... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { octave::execution_exception (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE__EXECUTION_EXCEPTION octave::execution_exception" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::execution_exception" >&5 $as_echo "octave::execution_exception" >&6; } echo ' ' >> oct-alt-includes.h else $as_echo "#define OCTAVE__EXECUTION_EXCEPTION octave_execution_exception" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave_execution_exception" >&5 $as_echo " octave_execution_exception" >&6; } echo '' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking file_ops or octave::sys::file_ops" >&5 $as_echo_n "checking file_ops or octave::sys::file_ops... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { octave::sys::file_ops::dir_sep_str (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE__SYS__FILE_OPS octave::sys::file_ops" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::sys::file_ops" >&5 $as_echo "octave::sys::file_ops" >&6; } echo '#include ' >> oct-alt-includes.h else $as_echo "#define OCTAVE__SYS__FILE_OPS file_ops" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: file_ops" >&5 $as_echo " file_ops" >&6; } echo '#include ' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking octave::application or octave::interpreter" >&5 $as_echo_n "checking octave::application or octave::interpreter... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { octave::interpreter::the_interpreter (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE__INTERPRETER octave::interpreter" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::interpreter" >&5 $as_echo "octave::interpreter" >&6; } echo ' ' >> oct-alt-includes.h else $as_echo "#define OCTAVE__INTERPRETER octave::application" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::application" >&5 $as_echo " octave::application" >&6; } echo '' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking symbol_table::assign or octave::interpreter::the_interpreter () -> get_symbol_table ().assign" >&5 $as_echo_n "checking symbol_table::assign or octave::interpreter::the_interpreter () -> get_symbol_table ().assign... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { octave::interpreter::the_interpreter () -> get_symbol_table (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE__INTERPRETER__SYMBOL_TABLE__ASSIGN octave::interpreter::the_interpreter () -> get_symbol_table ().assign" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::interpreter::the_interpreter () -> get_symbol_table ().assign" >&5 $as_echo "octave::interpreter::the_interpreter () -> get_symbol_table ().assign" >&6; } echo ' ' >> oct-alt-includes.h else $as_echo "#define OCTAVE__INTERPRETER__SYMBOL_TABLE__ASSIGN symbol_table::assign" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: symbol_table::assign" >&5 $as_echo " symbol_table::assign" >&6; } echo '#include ' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking symbol_table::is_global or octave::interpreter::the_interpreter () -> get_current_scope ().is_global" >&5 $as_echo_n "checking symbol_table::is_global or octave::interpreter::the_interpreter () -> get_current_scope ().is_global... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { octave::interpreter::the_interpreter () -> get_current_scope (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE__INTERPRETER__CURRENT_SCOPE__IS_GLOBAL octave::interpreter::the_interpreter () -> get_current_scope ().is_global" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::interpreter::the_interpreter () -> get_current_scope ().is_global" >&5 $as_echo "octave::interpreter::the_interpreter () -> get_current_scope ().is_global" >&6; } echo ' ' >> oct-alt-includes.h else $as_echo "#define OCTAVE__INTERPRETER__CURRENT_SCOPE__IS_GLOBAL symbol_table::is_global" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: symbol_table::is_global" >&5 $as_echo " symbol_table::is_global" >&6; } echo '#include ' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking oct_mach_info or octave::mach_info" >&5 $as_echo_n "checking oct_mach_info or octave::mach_info... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { std::cout << octave::mach_info::flt_fmt_unknown; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE__MACH_INFO octave::mach_info" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::mach_info" >&5 $as_echo "octave::mach_info" >&6; } echo ' ' >> oct-alt-includes.h else $as_echo "#define OCTAVE__MACH_INFO oct_mach_info" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: oct_mach_info" >&5 $as_echo " oct_mach_info" >&6; } echo '' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking octave_stream_list::get_file_number or octave::interpreter::the_interpreter () -> get_stream_list ().get_file_number" >&5 $as_echo_n "checking octave_stream_list::get_file_number or octave::interpreter::the_interpreter () -> get_stream_list ().get_file_number... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { octave::interpreter::the_interpreter () -> get_stream_list (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE__INTERPRETER__STREAM_LIST__GET_FILE_NUMBER octave::interpreter::the_interpreter () -> get_stream_list ().get_file_number" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::interpreter::the_interpreter () -> get_stream_list ().get_file_number" >&5 $as_echo "octave::interpreter::the_interpreter () -> get_stream_list ().get_file_number" >&6; } echo '#include ' >> oct-alt-includes.h else $as_echo "#define OCTAVE__INTERPRETER__STREAM_LIST__GET_FILE_NUMBER octave_stream_list::get_file_number" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave_stream_list::get_file_number" >&5 $as_echo " octave_stream_list::get_file_number" >&6; } echo '#include ' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking octave_stream_list::lookup or octave::interpreter::the_interpreter () -> get_stream_list ().lookup" >&5 $as_echo_n "checking octave_stream_list::lookup or octave::interpreter::the_interpreter () -> get_stream_list ().lookup... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { octave::interpreter::the_interpreter () -> get_stream_list (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE__INTERPRETER__STREAM_LIST__LOOKUP octave::interpreter::the_interpreter () -> get_stream_list ().lookup" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::interpreter::the_interpreter () -> get_stream_list ().lookup" >&5 $as_echo "octave::interpreter::the_interpreter () -> get_stream_list ().lookup" >&6; } echo '#include ' >> oct-alt-includes.h else $as_echo "#define OCTAVE__INTERPRETER__STREAM_LIST__LOOKUP octave_stream_list::lookup" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave_stream_list::lookup" >&5 $as_echo " octave_stream_list::lookup" >&6; } echo '#include ' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking octave_child_list:: or octave::interpreter::the_interpreter () -> get_child_list ()." >&5 $as_echo_n "checking octave_child_list:: or octave::interpreter::the_interpreter () -> get_child_list ().... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { octave::interpreter::the_interpreter () -> get_child_list (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE_CHILD_LIST octave::interpreter::the_interpreter () -> get_child_list ()." >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::interpreter::the_interpreter () -> get_child_list ()." >&5 $as_echo "octave::interpreter::the_interpreter () -> get_child_list ()." >&6; } echo '#include ' >> oct-alt-includes.h else $as_echo "#define OCTAVE_CHILD_LIST octave_child_list::" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave_child_list::" >&5 $as_echo " octave_child_list::" >&6; } echo '#include ' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking octave_call_stack::goto_caller_frame or octave::interpreter::the_interpreter () -> get_call_stack ().goto_caller_frame" >&5 $as_echo_n "checking octave_call_stack::goto_caller_frame or octave::interpreter::the_interpreter () -> get_call_stack ().goto_caller_frame... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { octave::interpreter::the_interpreter () -> get_call_stack (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE__INTERPRETER__CALL_STACK__GOTO_CALLER_FRAME octave::interpreter::the_interpreter () -> get_call_stack ().goto_caller_frame" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::interpreter::the_interpreter () -> get_call_stack ().goto_caller_frame" >&5 $as_echo "octave::interpreter::the_interpreter () -> get_call_stack ().goto_caller_frame" >&6; } echo ' ' >> oct-alt-includes.h else $as_echo "#define OCTAVE__INTERPRETER__CALL_STACK__GOTO_CALLER_FRAME octave_call_stack::goto_caller_frame" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave_call_stack::goto_caller_frame" >&5 $as_echo " octave_call_stack::goto_caller_frame" >&6; } echo '' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking unwind_protect or octave::unwind_protect" >&5 $as_echo_n "checking unwind_protect or octave::unwind_protect... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { octave::unwind_protect frame; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE__UNWIND_PROTECT octave::unwind_protect" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::unwind_protect" >&5 $as_echo "octave::unwind_protect" >&6; } echo ' ' >> oct-alt-includes.h else $as_echo "#define OCTAVE__UNWIND_PROTECT unwind_protect" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: unwind_protect" >&5 $as_echo " unwind_protect" >&6; } echo '' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking is_empty or isempty" >&5 $as_echo_n "checking is_empty or isempty... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { octave_value ().isempty (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OV_ISEMPTY isempty" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: isempty" >&5 $as_echo "isempty" >&6; } echo ' ' >> oct-alt-includes.h else $as_echo "#define OV_ISEMPTY is_empty" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: is_empty" >&5 $as_echo " is_empty" >&6; } echo '' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking is_real_type or isreal" >&5 $as_echo_n "checking is_real_type or isreal... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { octave_value ().isreal (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OV_ISREAL isreal" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: isreal" >&5 $as_echo "isreal" >&6; } echo ' ' >> oct-alt-includes.h else $as_echo "#define OV_ISREAL is_real_type" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: is_real_type" >&5 $as_echo " is_real_type" >&6; } echo '' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking is_vector or isvector" >&5 $as_echo_n "checking is_vector or isvector... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { idx_vector ().isvector (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define IDXVECTOR_ISVECTOR isvector" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: isvector" >&5 $as_echo "isvector" >&6; } echo ' ' >> oct-alt-includes.h else $as_echo "#define IDXVECTOR_ISVECTOR is_vector" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: is_vector" >&5 $as_echo " is_vector" >&6; } echo '' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking octave_stream or octave::stream" >&5 $as_echo_n "checking octave_stream or octave::stream... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { octave::stream (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE__STREAM octave::stream" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::stream" >&5 $as_echo "octave::stream" >&6; } echo '#include ' >> oct-alt-includes.h else $as_echo "#define OCTAVE__STREAM octave_stream" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave_stream" >&5 $as_echo " octave_stream" >&6; } echo '#include ' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking octave_refcount or octave::refcount" >&5 $as_echo_n "checking octave_refcount or octave::refcount... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { octave::refcount (0); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE__REFCOUNT octave::refcount" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::refcount" >&5 $as_echo "octave::refcount" >&6; } echo '#include ' >> oct-alt-includes.h else $as_echo "#define OCTAVE__REFCOUNT octave_refcount" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave_refcount" >&5 $as_echo " octave_refcount" >&6; } echo '#include ' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking feval or octave::feval" >&5 $as_echo_n "checking feval or octave::feval... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { octave::feval ("date"); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE__FEVAL octave::feval" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::feval" >&5 $as_echo "octave::feval" >&6; } echo '#include ' >> oct-alt-includes.h else $as_echo "#define OCTAVE__FEVAL feval" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: feval" >&5 $as_echo " feval" >&6; } echo '#include ' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking eval_string or octave::eval_string" >&5 $as_echo_n "checking eval_string or octave::eval_string... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { int p_err; octave::eval_string ("date", false, p_err, 0); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE__EVAL_STRING octave::eval_string" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::eval_string" >&5 $as_echo "octave::eval_string" >&6; } echo '#include ' >> oct-alt-includes.h else $as_echo "#define OCTAVE__EVAL_STRING eval_string" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: eval_string" >&5 $as_echo " eval_string" >&6; } echo '#include ' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking file_stat or octave::sys::file_stat" >&5 $as_echo_n "checking file_stat or octave::sys::file_stat... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { octave::sys::file_stat (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define OCTAVE__SYS__FILE_STAT octave::sys::file_stat" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::sys::file_stat" >&5 $as_echo "octave::sys::file_stat" >&6; } echo '#include ' >> oct-alt-includes.h else $as_echo "#define OCTAVE__SYS__FILE_STAT file_stat" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: file_stat" >&5 $as_echo " file_stat" >&6; } echo '' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking add_fcn (octave_call_stack::pop) or add_method (octave::interpreter::the_interpreter () -> get_call_stack (), &octave::call_stack::pop)" >&5 $as_echo_n "checking add_fcn (octave_call_stack::pop) or add_method (octave::interpreter::the_interpreter () -> get_call_stack (), &octave::call_stack::pop)... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { octave::interpreter::the_interpreter () -> get_call_stack (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define ADD_OCTAVE__INTERPRETER__CALL_STACK__POP add_method (octave::interpreter::the_interpreter () -> get_call_stack (), &octave::call_stack::pop)" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: add_method (octave::interpreter::the_interpreter () -> get_call_stack (), &octave::call_stack::pop)" >&5 $as_echo "add_method (octave::interpreter::the_interpreter () -> get_call_stack (), &octave::call_stack::pop)" >&6; } echo ' ' >> oct-alt-includes.h else $as_echo "#define ADD_OCTAVE__INTERPRETER__CALL_STACK__POP add_fcn (octave_call_stack::pop)" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: add_fcn (octave_call_stack::pop)" >&5 $as_echo " add_fcn (octave_call_stack::pop)" >&6; } echo '' >> oct-alt-includes.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for octave::config::octave_home ()" >&5 $as_echo_n "checking for octave::config::octave_home ()... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { octave::config::octave_home (); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : $as_echo "#define HAVE_OCTAVE_CONFIG_FCNS 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } echo '#include ' >> oct-alt-includes.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext LIBS=$TLIBS LDFLAGS=$TLDFLAGS CXXFLAGS=$TCXXFLAGS CPPFLAGS=$TCPPFLAGS ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # End of checks for Octave features. ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by parallel $as_me 3.1.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ parallel config.status 3.1.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi parallel-3.1.3/src/PaxHeaders.30520/oct-alt-includes.h0000644000000000000000000000013213331003663017145 xustar0030 mtime=1533282227.096936914 30 atime=1533282227.592946708 30 ctime=1533282233.633065964 parallel-3.1.3/src/oct-alt-includes.h0000644000175000017500000000055013331003663017343 0ustar00olafolaf00000000000000/* generated by configure */ #include #include #include #include #include #include #include #include #include #include parallel-3.1.3/src/PaxHeaders.30520/netarrayfun.copy_to_m0000644000000000000000000000013213331003466020076 xustar0030 mtime=1533282102.562478049 30 atime=1533282227.396942838 30 ctime=1533282233.633065964 parallel-3.1.3/src/netarrayfun.copy_to_m0000644000175000017500000000342013331003466020273 0ustar00olafolaf00000000000000## Copyright (C) 2015, 2016 Olaf Till ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn{Function File} {} netarrayfun (@var{connections}, @var{fun}, @dots{}) ## Evaluates function @var{fun} in a parallel cluster and collects results. ## ## This function handles arguments and options equivalently to ## @code{pararrayfun} and returnes equivalent output. Differently, the ## first argument specifies server machines for parallel remote ## execution, see @code{pconnect} for a description of the ## @var{connections} variable. A further difference is that the option ## "ChunksPerProc" is ignored and instead the chunk size can be ## specified directly with an option "ChunkSize" (option "Vectorized" ## can be used together with option "ChunkSize" in function ## @code{netarrayfun}). ## ## The further details of operation are the same as for ## @code{netcellfun}, please see there. ## ## @seealso{netcellfun, pconnect, pserver, sclose, rfeval, install_vars} ## @end deftypefn function varargout = netarrayfun (varargin) if (nargin () < 3) print_usage (); endif [varargout{1 : nargout ()}] = netcellfun_worker (true, varargin{:}); endfunction parallel-3.1.3/src/PaxHeaders.30520/rfeval.copy_to_m0000644000000000000000000000013213331003466017017 xustar0030 mtime=1533282102.574478286 30 atime=1533282227.396942838 30 ctime=1533282233.633065964 parallel-3.1.3/src/rfeval.copy_to_m0000644000175000017500000001336113331003466017221 0ustar00olafolaf00000000000000## Copyright (C) 2015, 2016 Olaf Till ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn{Function File} {} rfeval (@var{func}, @dots{}, @var{nout}, @var{isout}, @var{connection}) ## Evaluate a function at a remote machine. ## ## @var{func} is evaluated with arguments @code{@dots{}} and number of ## output arguments set to @var{nout} at remote machine given by ## @var{connection}. If @var{isout} is not empty, it must be a logical ## array with @var{nout} elements, which are true for each of the ## @var{nout} output arguments which are requested from the function; ## the other output arguments will be marked as not requested ## with @code{~} at remote execution. ## ## This function can only be successfully called at the client machine. ## See @code{pconnect} for a description of the @var{connection} ## variable. @var{connection} must contain one single connection. ## ## If an output argument is given to @code{rfeval}, the function waits ## for completion of the remote function call, retrieves the results and ## returns them. They will be returned as one cell-array with an entry ## for each output argument. If some output arguments are marked as not ## requested by setting some elements of @var{isout} to false, the ## returned cell-array will only have entries for the requested output ## arguments. For consistency, the returned cell-array can be empty. To ## assign the output arguments to single variables, you can for example ## use: @code{[a, b, c] = returned_cell_array@{:@};}. ## ## If no output argument is given to @code{rfeval}, the function does ## not retrieve the results of the remote function call but returns ## immediately. It is left to the user to retrieve the results with ## @code{precv}. The results will be in the same format as if returned ## by @code{rfeval}. Note that a cell-array, possibly empty, will always ## have to be retrieved, even if the remote function call should have ## been performed without output arguments. ## ## Parallel execution can be achieved by calling @code{rfeval} several ## times with different specified server machines before starting to ## retrieve the results. ## ## The specified function handle can refer to a function present at the ## executing machine or be an anonymous function. In the latter case, ## the function specification sent to the server includes the anonymous ## functions context (generation of the sent function specification is ## implemented in the Octave core). Sending a handle to a subfunction, ## however, will currently not work. Sending a handle to a private ## function will only work if its file path is the same at the server. ## Sending an anonymous function using "varargin" in the argument list ## will currently not work. ## ## @seealso{pconnect, pserver, sclose, install_vars, netcellfun} ## @end deftypefn function ret = rfeval (varargin) if ((nargs = nargin ()) < 4) print_usage (); endif fname = "rfeval"; if (! isa (conn = varargin{end}, "pconnections")) error ("%s: `connection' must be a parallel connections object", fname); elseif (numel (conn) != 1) error ("%s: exactly one connection must be specified", fname); elseif (network_get_info (conn).local_machine) error ("%s: client was specified instead of server"); ## reval() checks if specified at server side endif if (! is_function_handle (varargin{1})) error ("%s: `func' must be a function handle", fname); endif if (! isnumeric (nout = varargin{end - 2}) || ! isscalar (nout) || ... (nout = round (nout)) < 0) error ("%s: `nout' must be a non-negative integer", fname); endif if (isempty (isout = varargin{end - 1})) isout = true (1, nout); elseif (! islogical (isout) || numel (isout) != nout) error ("%s: `isout' must be empty or a logical with `nout' elements", fname); endif isout = isout(:); ## feval() isn't called remotely since it doesn't resepect ignoring of ## output variables with '~'. So the function handle has to be sent ## separately and a remote temporary variable has to be used for it. ## ## rargs = varargin(1 : end - 3); # could be used with feval func = varargin{1}; rargs = varargin(2 : end - 3); if (any (ign = ! isout)) rout = repmat ({"__pserver_tout__{%i},"}, nout, 1); rout(ign) = {"~,"}; rout = cstrcat (rout{:}); rout = sprintf (rout, 1 : sum (isout)); rout = rout(1 : end - 1); # remove final ',' rout = sprintf ("[%s]", rout); if (all (ign)) init_rout = "__pserver_tout__ = {}; "; else init_rout = ""; endif else rout = sprintf ("[__pserver_tout__{1:%i}]", nout); init_rout = ""; endif cmd = sprintf ... ("__pserver_tfunc__ = precv (sockets(1)); %s%s = __pserver_tfunc__ (precv (sockets(1)){:}); psend (__pserver_tout__, sockets(1)); clear ('__pserver_tout__');", init_rout, rout); reval (cmd, conn); ready = false; unwind_protect psend (func, conn); psend (rargs, conn); ready = true; unwind_protect_cleanup if (! ready) sclose (conns); # might already be closed from within reval or psend endif end_unwind_protect if (nargout () > 0) ret = precv (conn); endif endfunction parallel-3.1.3/src/PaxHeaders.30520/getpass.c0000644000000000000000000000013213331003466015440 xustar0030 mtime=1533282102.538477575 30 atime=1533282102.538477575 30 ctime=1533282233.633065964 parallel-3.1.3/src/getpass.c0000644000175000017500000001211013331003466015631 0ustar00olafolaf00000000000000/* Copyright (C) 1992-2001, 2003-2007, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see . */ #include #include #include #if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) # include # if HAVE_DECL___FSETLOCKING && HAVE___FSETLOCKING # if HAVE_STDIO_EXT_H # include # endif # else # define __fsetlocking(stream, type) /* empty */ # endif # if HAVE_TERMIOS_H # include # endif # if USE_UNLOCKED_IO # include "unlocked-io.h" # else # if !HAVE_DECL_FFLUSH_UNLOCKED # undef fflush_unlocked # define fflush_unlocked(x) fflush (x) # endif # if !HAVE_DECL_FLOCKFILE # undef flockfile # define flockfile(x) ((void) 0) # endif # if !HAVE_DECL_FUNLOCKFILE # undef funlockfile # define funlockfile(x) ((void) 0) # endif # if !HAVE_DECL_FPUTS_UNLOCKED # undef fputs_unlocked # define fputs_unlocked(str,stream) fputs (str, stream) # endif # if !HAVE_DECL_PUTC_UNLOCKED # undef putc_unlocked # define putc_unlocked(c,stream) putc (c, stream) # endif # endif /* It is desirable to use this bit on systems that have it. The only bit of terminal state we want to twiddle is echoing, which is done in software; there is no need to change the state of the terminal hardware. */ # ifndef TCSASOFT # define TCSASOFT 0 # endif static void call_fclose (void *arg) { if (arg != NULL) fclose (arg); } char * getpass (const char *prompt) { FILE *tty; FILE *in, *out; struct termios s, t; bool tty_changed = false; static char *buf; static size_t bufsize; ssize_t nread; /* Try to write to and read from the terminal if we can. If we can't open the terminal, use stderr and stdin. */ tty = fopen ("/dev/tty", "w+"); if (tty == NULL) { in = stdin; out = stderr; } else { /* We do the locking ourselves. */ __fsetlocking (tty, FSETLOCKING_BYCALLER); out = in = tty; } flockfile (out); /* Turn echoing off if it is on now. */ # if HAVE_TCGETATTR if (tcgetattr (fileno (in), &t) == 0) { /* Save the old one. */ s = t; /* Tricky, tricky. */ t.c_lflag &= ~(ECHO | ISIG); tty_changed = (tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &t) == 0); } # endif /* Write the prompt. */ fputs_unlocked (prompt, out); fflush_unlocked (out); /* Read the password. */ nread = getline (&buf, &bufsize, in); /* According to the C standard, input may not be followed by output on the same stream without an intervening call to a file positioning function. Suppose in == out; then without this fseek call, on Solaris, HP-UX, AIX, OSF/1, the previous input gets echoed, whereas on IRIX, the following newline is not output as it should be. POSIX imposes similar restrictions if fileno (in) == fileno (out). The POSIX restrictions are tricky and change from POSIX version to POSIX version, so play it safe and invoke fseek even if in != out. */ fseeko (out, 0, SEEK_CUR); if (buf != NULL) { if (nread < 0) buf[0] = '\0'; else if (buf[nread - 1] == '\n') { /* Remove the newline. */ buf[nread - 1] = '\0'; if (tty_changed) { /* Write the newline that was not echoed. */ putc_unlocked ('\n', out); } } } /* Restore the original setting. */ # if HAVE_TCSETATTR if (tty_changed) tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &s); # endif funlockfile (out); call_fclose (tty); return buf; } #else /* W32 native */ /* Windows implementation by Martin Lambers , improved by Simon Josefsson. */ /* For PASS_MAX. */ # include /* For _getch(). */ # include /* For strdup(). */ # include # ifndef PASS_MAX # define PASS_MAX 512 # endif char * getpass (const char *prompt) { char getpassbuf[PASS_MAX + 1]; size_t i = 0; int c; if (prompt) { fputs (prompt, stderr); fflush (stderr); } for (;;) { c = _getch (); if (c == '\r') { getpassbuf[i] = '\0'; break; } else if (i < PASS_MAX) { getpassbuf[i++] = c; } if (i >= PASS_MAX) { getpassbuf[i] = '\0'; break; } } if (prompt) { fputs ("\r\n", stderr); fflush (stderr); } return strdup (getpassbuf); } #endif parallel-3.1.3/src/PaxHeaders.30520/mkdoc.pl0000644000000000000000000000013113331003466015257 xustar0029 mtime=1533282102.55847797 30 atime=1533282227.392942759 30 ctime=1533282233.633065964 parallel-3.1.3/src/mkdoc.pl0000755000175000017500000000442513331003466015466 0ustar00olafolaf00000000000000#! /usr/bin/perl -w # # Copyright (C) 2012-2013 Rik Wehbring # # This file is part of Octave. # # Octave is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # Octave is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License # along with Octave; see the file COPYING. If not, see # . # copied from Octave and slightly modified by Olaf Till unless (@ARGV >= 1) { die "Usage: $0 m_filename1 ..." ; } print <<__END_OF_MSG__; ### This file is generated automatically by the packages `mkdoc.pl'. __END_OF_MSG__ MFILE: foreach $full_fname (@ARGV) { next MFILE unless ( $full_fname =~ m{([^/]+)\.m$} || $full_fname =~ m{([^/]+)\.copy_to_m$}); $fcn = $1; @help_txt = gethelp ($fcn, $full_fname); next MFILE if ($help_txt[0] eq ""); print "\x{1d}$fcn\n"; print "\@c $fcn $full_fname\n"; foreach $_ (@help_txt) { s/^\s+\@/\@/ unless $in_example; s/^\s+\@group/\@group/; s/^\s+\@end\s+group/\@end group/; $in_example = (/\s*\@example\b/ .. /\s*\@end\s+example\b/); print $_; } } ################################################################################ # Subroutines ################################################################################ sub gethelp { ($fcn, $fname) = @_[0..1]; open (FH, $fname) or return ""; do { @help_txt = (); ## Advance to non-blank line while (defined ($_ = ) and /^\s*$/) {;} if (! /^\s*(?:#|%)/ or eof (FH)) { ## No comment block found. Return empty string close (FH); return ""; } ## Extract help text stopping when comment block ends do { ## Remove comment characters at start of line s/^\s*(?:#|%){1,2} ?//; push (@help_txt, $_); } until (! defined ($_ = ) or ! /^\s*(?:#|%)/); } until ($help_txt[0] !~ /^(?:Copyright|Author)/); close (FH); return @help_txt; } parallel-3.1.3/src/PaxHeaders.30520/netcellfun.copy_to_m0000644000000000000000000000013213331003466017677 xustar0030 mtime=1533282102.562478049 30 atime=1533282227.396942838 30 ctime=1533282233.633065964 parallel-3.1.3/src/netcellfun.copy_to_m0000644000175000017500000000615713331003466020106 0ustar00olafolaf00000000000000## Copyright (C) 2015, 2016 Olaf Till ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn{Function File} {} netcellfun (@var{connections}, @var{fun}, @dots{}) ## Evaluates function @var{fun} in a parallel cluster and collects results. ## ## This function handles arguments and options equivalently to ## @code{parcellfun} and returnes equivalent output. Differently, the ## first argument specifies server machines for parallel remote ## execution, see @code{pconnect} for a description of the ## @var{connections} variable. A further difference is that the option ## "ChunksPerProc" is ignored and instead the chunk size can be ## specified directly with an option "ChunkSize". ## ## This function can only be successfully called at the client machine ## of the parallel cluster. @var{connections} can contain all ## connections of the network, a subset of them, or a single connection. ## The local machine (client), if contained in @var{connections}, is ## ignored. However, one of the servers can run at the local machine ## under certain conditions (see @code{pconnect}) and will not be ## ignored in this case, so that the local machine can take part in ## parallel execution with @code{netcellfun}. ## ## As a second level of parallelism, @var{fun} is executed at each ## server machine (using @code{parcellfun or pararrayfun}) by default in ## as many local processes in parallel as the server has processor cores ## available. The number of local parallel processes can be configured ## for each server with the "nlocaljobs" option (see ## @code{network_set}), a value of @code{0} means that the default value ## will be used, a value of @code{1} means that execution is not ## parallel within the server (but still parallel over the cluster). ## ## There are certain limitations on how @var{fun} can be defined. These ## are explained in the documentation of @code{rfeval}. ## ## Cluster execution incurs a considerable overhead. A speedup is ## likely if the computation time of @var{fun} is long. To speed up ## execution of a large set of arguments with short computation times ## of @var{fun}, increase "ChunkSize", possibly use "Vectorize" (see ## @code{pararrayfun}), and possibly experiment with increasing ## "nlocaljobs" from the default. ## ## @seealso{netarrayfun, pconnect, pserver, sclose, rfeval, install_vars} ## @end deftypefn function varargout = netcellfun (varargin) if (nargin () < 3) print_usage (); endif [varargout{1 : nargout ()}] = netcellfun_worker (false, varargin{:}); endfunction parallel-3.1.3/src/PaxHeaders.30520/Makefile.in0000644000000000000000000000013213331003466015673 xustar0030 mtime=1533282102.534477496 30 atime=1533282227.304941021 30 ctime=1533282233.633065964 parallel-3.1.3/src/Makefile.in0000644000175000017500000001760113331003466016076 0ustar00olafolaf00000000000000# Makefile for parallel package for Octave # # Copyright (C) 2015-2018 Olaf Till # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # before cross building, pre-build at least $(TEXIFILE) natively, # e.g. with targets 'doc', 'html', or 'prebuild' # Uncomment this for a release. # RELEASE := yes ifdef RELEASE # Currently this does nothing. RELEASE_CXXFLAGS = endif # This is set by configure to the default used by mkoctfile, possibly # enhanced with an option to enforce C++11 features. I see no clean # way to make this overridable by the user with an environment # variable, since make itself sets a default for CXX. CXX = @CXX@ CXXCPP = @CXXCPP@ MKOCTFILE ?= @MKOCTFILE@ PKG_CONFIG ?= @PKG_CONFIG@ ifndef CXXFLAGS CXXFLAGS := $(shell $(MKOCTFILE) -p CXXFLAGS) endif # not for calling mkoctfile CC ?= @CC@ # not for calling mkoctfile CFLAGS ?= -g -O2 HAVE_WINSOCK := @HAVE_WINSOCK@ ifeq ($(HAVE_WINSOCK), yes) WINSOCKLIBS = -lws2_32 else WINSOCKLIBS = endif HAVE_GNUTLS := @HAVE_GNUTLS@ HAVE_GNUTLS_EXTRA := @HAVE_GNUTLS_EXTRA@ HAVE_GETPASS := @HAVE_GETPASS@ REDUCED_BUILD := @REDUCED_BUILD@ ifeq ($(REDUCED_BUILD), yes) octs = $(local_octs_set1) else octs = $(cluster_oct) $(generate_srp_data_oct) $(local_octs) ms = install_vars.m netarrayfun.m __netcellfun_guardfun__.m \ netcellfun.m __pserver_exit__.m rfeval.m scloseall.m server.m endif # All compiled user functions for parallel cluster must be in one # file, otherwise registration of new octave_base_value derived type # is not seen by the other functions. cluster_oct := parallel_interface.oct local_octs_set1 := fload.oct fsave.oct __exit__.oct local_octs_set2 := select.oct __visglobal__.oct local_octs := $(local_octs_set1) $(local_octs_set2) cluster_objs = $(cluster_oobjs) $(cluster_lobjs) t_cluster_oobjs := pconnect.o pserver.o sclose.o \ reval.o precv.o psend.o select_sockets.o \ network_get_info.o network_set.o cluster_lobjs := p-connection.o p-streams.o generate_srp_data_source := parallel_generate_srp_data.cc ifeq ($(HAVE_GNUTLS), yes) generate_srp_data_oct := parallel_generate_srp_data.oct cluster_oobjs := $(t_cluster_oobjs) parallel_generate_srp_data.o cluster_lobjs := $(cluster_lobjs) gnutls-callbacks.o sensitive-data.o ifneq ($(HAVE_GETPASS), yes) getpass_obj := getpass.o endif ifeq ($(HAVE_GNUTLS_EXTRA), yes) GNUTLS_CFLAGS := $(shell $(PKG_CONFIG) --cflags gnutls-extra) -Wno-int-to-pointer-cast GNUTLS_LIBS := $(shell $(PKG_CONFIG) --libs gnutls-extra) else GNUTLS_CFLAGS := $(shell $(PKG_CONFIG) --cflags gnutls) -Wno-int-to-pointer-cast GNUTLS_LIBS := $(shell $(PKG_CONFIG) --libs gnutls) endif else cluster_oobjs := $(t_cluster_oobjs) endif INFOFILE := ../doc/parallel.info TEXIFILE := $(addsuffix .texi,$(basename $(INFOFILE))) TXIFILE := $(addsuffix .txi,$(basename $(INFOFILE))) HTMLDIR := ../doc/html/ DEFUNDLDFILES := $(addsuffix .cc,$(basename $(t_cluster_oobjs))) \ $(generate_srp_data_source) \ $(addsuffix .cc,$(basename $(local_octs))) DSFILES := $(addsuffix .docstrings,$(DEFUNDLDFILES)) MFILES := $(wildcard *.copy_to_m) $(wildcard ../inst/*.m) .PHONY: all clean distclean maintainer-clean doc prebuild html .INTERMEDIATE: MFDOCSTRINGS $(DSFILES) all: doc $(octs) $(ms) prebuild: doc html getpass.o: getpass.c $(CC) -c getpass.c $(CFLAGS) -fPIC error-helpers.o: error-helpers.cc error-helpers.h CXXFLAGS="$(CXXFLAGS) $(RELEASE_CXXFLAGS)" $(MKOCTFILE) -c error-helpers.cc minimal-load-save.o: minimal-load-save.cc CXXFLAGS="$(CXXFLAGS) $(RELEASE_CXXFLAGS)" $(MKOCTFILE) -c minimal-load-save.cc $(octs): error-helpers.h minimal-load-save.h $(cluster_objs): parallel-gnutls.h p-connection.h p-streams.h sensitive-data.h \ p-sighandler.h # CXX default is set by configure to the default used by mkoctfile, # possibly enhanced with an option to enforce C++11 features. $(cluster_objs): %.o: %.cc config.h CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS) $(GNUTLS_CFLAGS) $(RELEASE_CXXFLAGS)" $(MKOCTFILE) -c $< %.o: %.cc config.h CXXFLAGS="$(CXXFLAGS) $(RELEASE_CXXFLAGS)" $(MKOCTFILE) -c $< $(generate_srp_data_oct): %.oct: %.o $(cluster_lobjs) $(getpass_obj) \ error-helpers.o $(MKOCTFILE) $< $(cluster_lobjs) $(getpass_obj) error-helpers.o $(GNUTLS_LIBS) $(cluster_oct): $(cluster_objs) $(getpass_obj) error-helpers.o minimal-load-save.o $(MKOCTFILE) -o $(cluster_oct) $(cluster_objs) $(getpass_obj) error-helpers.o minimal-load-save.o $(GNUTLS_LIBS) $(WINSOCKLIBS) %.oct: %.o error-helpers.o minimal-load-save.o $(MKOCTFILE) $< error-helpers.o minimal-load-save.o $(ms): %.m: %.copy_to_m cp $< $(addsuffix .m,$(basename $<)) doc: $(INFOFILE) $(INFOFILE): $(TEXIFILE) makeinfo $(TEXIFILE) -o $(INFOFILE) html: $(TEXIFILE) makeinfo --html -o $(HTMLDIR) $(TEXIFILE) $(TEXIFILE): $(TXIFILE) MFDOCSTRINGS $(DSFILES) munge-texi.pl ./munge-texi.pl MFDOCSTRINGS $(DSFILES) < $(TXIFILE) > $(TEXIFILE) MFDOCSTRINGS: $(MFILES) mkdoc.pl ./mkdoc.pl $(MFILES) > MFDOCSTRINGS # take long CPP macro names, unlikely to be present in package code # (which is checked) or to be defined by Octave (which can't be # checked) RDEFUN_DLD := DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS RDEFUNX_DLD := DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS # Docstrings defined as C strings are obtained from a compiled C # program. This should be the cleanest way to correctly get all # special characters defined in these strings. %.cc.docstrings: %.bin (echo "### This file is generated automatically from the"; echo "### corresponding .cc file by a Makefile rule."; echo ""; ./$<) > $@ # Explanation of the command after the checks: Macro names are changed # by `sed' so that a different definition can be given to them on the # `cpp' commandline. After running the `cpp' command, one can be sure # that there are not more than one `$(RDEFUN_DLD)' resulting from a # DEFUN(X)_DLD invocation in the original code at one line, that every # occurance of `$(RDEFUN_DLD)' indeed corresponds to an original macro # invocation, and not to `DEFUN(X)_DLD' within a comment or a string, # and that we have all necessary information within one line of # text. The package code is expected to give the function # documentation as a string constant directly in the macro invocation, # as is normally done. %.bin: %.cc if grep -q $(RDEFUN_DLD) $<; then echo "The string '$(RDEFUN_DLD)' must not be present in source code, but is in $<."; exit 1; fi if grep -q $(RDEFUNX_DLD) $<; then echo "The string '$(RDEFUNX_DLD)' must not be present in source code, but is in $<."; exit 1; fi (echo "#include "; echo "int main () {"; sed -e s/DEFUN_DLD/$(RDEFUN_DLD)/g -e s/DEFUNX_DLD/$(RDEFUNX_DLD)/g $< | $(CXXCPP) `$(MKOCTFILE) -p INCFLAGS` -x c++ -iquote '.' -D'$(RDEFUN_DLD)(name,args,nargout,doc)=$(RDEFUN_DLD)(name,doc)' -D'$(RDEFUNX_DLD)(name,fname,gname,args,nargout,doc)=$(RDEFUN_DLD)(name,doc)' - | sed -e '/.*$(RDEFUN_DLD)/!D'; echo "}";) | $(CXX) -x c++ -D'$(RDEFUN_DLD)(name,doc)=printf("%c" #name "\n@c " #name " $<\n" doc "\n\n", 0x1D);' -o $@ - clean: $(RM) *.o *.oct *.m octave-core *.cc.docstrings MFDOCSTRINGS *~ distclean: $(RM) *.o *.oct *.m octave-core *.cc.docstrings config.h config.log config.status MFDOCSTRINGS *~ maintainer-clean: $(RM) *.o *.oct *.m octave-core *.cc.docstrings config.h config.log config.status MFDOCSTRINGS *~ $(INFOFILE) $(TEXIFILE) parallel-3.1.3/src/PaxHeaders.30520/__visglobal__.cc0000644000000000000000000000013213331003466016713 xustar0030 mtime=1533282102.534477496 30 atime=1533282232.249038637 30 ctime=1533282233.633065964 parallel-3.1.3/src/__visglobal__.cc0000644000175000017500000000353213331003466017114 0ustar00olafolaf00000000000000// Copyright (C) 2015-2018 Olaf Till // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; If not, see . #include #include "config.h" #include #include "error-helpers.h" DEFUN_DLD (__visglobal__, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} __visglobal__ (@var{vars})\n\ Internal function. Vector version of isglobal(), executed in calling frame. @var{vars} is a cellstr.\n\ @end deftypefn") { std::string fname ("__visglobal__"); octave_value err_retval; if (args.length () != 1) { print_usage (); return octave_value_list (); } bool err; Array vars; SET_ERR (vars = args(0).cellstr_value (), err); if (err) { print_usage (); return octave_value_list (); } octave_idx_type n = vars.numel (); boolNDArray retval (dim_vector (n, 1)); OCTAVE__UNWIND_PROTECT frame; frame.ADD_OCTAVE__INTERPRETER__CALL_STACK__POP; CHECK_ERROR (OCTAVE__INTERPRETER__CALL_STACK__GOTO_CALLER_FRAME (), err_retval, "%s: goto_caller_frame() returned an error", fname.c_str ()); for (octave_idx_type i = 0; i < n; i++) retval(i) = OCTAVE__INTERPRETER__CURRENT_SCOPE__IS_GLOBAL (vars(i)); return octave_value (retval); } parallel-3.1.3/src/PaxHeaders.30520/server.copy_to_m0000644000000000000000000000013213331003466017046 xustar0030 mtime=1533282102.574478286 30 atime=1533282227.396942838 30 ctime=1533282233.633065964 parallel-3.1.3/src/server.copy_to_m0000644000175000017500000000161413331003466017246 0ustar00olafolaf00000000000000## Copyright (C) 2002 by Hayato Fujiwara ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License ## along with this program; If not, see . ## This script is here for backwards compatibility and is deprecated. It ## just calls 'pserver', which should be called directly instead. See ## documentation of 'pserver'. pserver parallel-3.1.3/src/PaxHeaders.30520/config.h.in0000644000000000000000000000013213331003471015645 xustar0030 mtime=1533282105.106528282 30 atime=1533282227.324941416 30 ctime=1533282233.633065964 parallel-3.1.3/src/config.h.in0000644000175000017500000001560013331003471016045 0ustar00olafolaf00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ #include "undef-ah-octave.h" /* macro for alternative Octave symbols */ #undef ADD_OCTAVE__INTERPRETER__CALL_STACK__POP /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #undef HAVE_FSEEKO /* Define as 1 if getpass function is present. */ #undef HAVE_GETPASS /* Define as 1 if libgnutls has gnutls_srp_base64_decode2 */ #undef HAVE_GNUTLS_SRP_BASE64_DECODE2 /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define as 1 if gnutls library is present. */ #undef HAVE_LIBGNUTLS /* Define as 1 if gnutls extra library is present. */ #undef HAVE_LIBGNUTLS_EXTRA /* Define to 1 if you have the `ws2_32' library (-lws2_32). */ #undef HAVE_LIBWS2_32 /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if you have the `mkdir' function. */ #undef HAVE_MKDIR /* Define to 1 if you have the `modf' function. */ #undef HAVE_MODF /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if you have octave::config::octave_home () */ #undef HAVE_OCTAVE_CONFIG_FCNS /* Define as 1 if liboctinterp is old enough to provide error_state. */ #undef HAVE_OCTAVE_ERROR_STATE /* Define to 1 if you have the header file. */ #undef HAVE_OCTAVE_INTERPRETER_H /* Define as 1 if liboctinterp has 'verror (octave_execution_exception&, const char *, va_list)'. */ #undef HAVE_OCTAVE_VERROR_ARG_EXC /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_EXT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MALLOC_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the `uname' function. */ #undef HAVE_UNAME /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL /* macro for alternative Octave symbols */ #undef IDXVECTOR_ISVECTOR /* macro for alternative Octave symbols */ #undef OCTAVE_CHILD_LIST /* macro for alternative Octave symbols */ #undef OCTAVE__EVAL_STRING /* macro for alternative Octave symbols */ #undef OCTAVE__EXECUTION_EXCEPTION /* macro for alternative Octave symbols */ #undef OCTAVE__FEVAL /* macro for alternative Octave symbols */ #undef OCTAVE__INTERPRETER /* macro for alternative Octave symbols */ #undef OCTAVE__INTERPRETER__CALL_STACK__GOTO_CALLER_FRAME /* macro for alternative Octave symbols */ #undef OCTAVE__INTERPRETER__CURRENT_SCOPE__IS_GLOBAL /* macro for alternative Octave symbols */ #undef OCTAVE__INTERPRETER__STREAM_LIST__GET_FILE_NUMBER /* macro for alternative Octave symbols */ #undef OCTAVE__INTERPRETER__STREAM_LIST__LOOKUP /* macro for alternative Octave symbols */ #undef OCTAVE__INTERPRETER__SYMBOL_TABLE__ASSIGN /* macro for alternative Octave symbols */ #undef OCTAVE__MACH_INFO /* macro for alternative Octave symbols */ #undef OCTAVE__REFCOUNT /* macro for alternative Octave symbols */ #undef OCTAVE__STREAM /* macro for alternative Octave symbols */ #undef OCTAVE__SYS__FILE_OPS /* macro for alternative Octave symbols */ #undef OCTAVE__SYS__FILE_STAT /* macro for alternative Octave symbols */ #undef OCTAVE__UNWIND_PROTECT /* macro for alternative Octave symbols */ #undef OV_ISEMPTY /* macro for alternative Octave symbols */ #undef OV_ISREAL /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ #undef _LARGEFILE_SOURCE /* Define for Solaris 2.5.1 so the uint32_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT32_T /* Define to the type of a signed integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ #undef int32_t /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc /* Define to `int' if does not define. */ #undef mode_t /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned int' if does not define. */ #undef size_t /* Define to `int' if does not define. */ #undef ssize_t /* Define to the type of an unsigned integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ #undef uint32_t /* Define as `fork' if `vfork' does not work. */ #undef vfork #include "oct-alt-includes.h" #include "custom.h" parallel-3.1.3/src/PaxHeaders.30520/__exit__.cc0000644000000000000000000000013213331003466015702 xustar0030 mtime=1533282102.534477496 30 atime=1533282231.585025527 30 ctime=1533282233.633065964 parallel-3.1.3/src/__exit__.cc0000644000175000017500000000234113331003466016100 0ustar00olafolaf00000000000000// Copyright (C) 2008 Olaf Till // // This program is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free Software // Foundation; either version 3 of the License, or (at your option) any later // version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // this program; if not, see . #include #include #include DEFUN_DLD (__exit__, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} __exit__ (status)\n\ This is a wrapper over the POSIX _exit() system call. Calling this function\n\ will terminate the running process immediately, bypassing normal Octave\n\ terminating sequence. It is suitable to terminate a forked process. It\n\ should be considered expert-only and not to be used in normal code.\n\ @end deftypefn") { _exit (args.length () > 0 ? args(0).int_value () : 0); } parallel-3.1.3/src/PaxHeaders.30520/install_vars.copy_to_m0000644000000000000000000000013213331003466020241 xustar0030 mtime=1533282102.538477575 30 atime=1533282227.396942838 30 ctime=1533282233.633065964 parallel-3.1.3/src/install_vars.copy_to_m0000644000175000017500000001536713331003466020453 0ustar00olafolaf00000000000000## Copyright (C) 2015, 2016 Olaf Till ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . ## -*- texinfo -*- ## @deftypefn{Function File} {} install_vars (@var{varname}, @dots{}, @var{connections}) ## Install named variables at remote machines. ## ## The variables named in the arguments are distrubted to the remote ## machines specified by @var{connections} and installed there. The ## variables must be accessible within the calling function. If ## variables have been declared to have global scope, they will also ## have global scope at the remote machines. ## ## This function can only be successfully called at the client machine. ## See @code{pconnect} for a description of the @var{connections} ## variable. @var{connections} can contain all connections of the ## network, a subset of them, or a single connection. The local machine ## (client), if contained in @var{connections}, is ignored. ## ## To install, e.g., all visible variables, ## ## @code{install_vars (who ()@{:@}, @dots{});} ## ## can be used. ## ## Internally, this function sends the variables only to one server and ## then issues the necessary commands to distribute them to all ## specified servers over server-to-server data connections. ## ## @seealso{pconnect, pserver, sclose, rfeval, netcellfun} ## @end deftypefn function ret = install_vars (varargin) if ((nargs = nargin ()) < 1 || ... ! iscellstr (varnames = varargin(1 : end - 1))) print_usage (); endif fname = "install_vars"; if (! isa (conns = varargin{end}, "pconnections")) error ("%s: `connections' must be a parallel connections object", fname); endif ## reval() will check if specified at server side ## delete local machine from connections if present conns = conns(! [network_get_info(conns).local_machine]); if ((nhosts = numel (conns)) == 0) return; endif if ((nvars = numel (varnames)) == 0) return; endif ## get an index translation into the remote variable of connections ## ('sockets') ridx = [network_get_info(conns).real_node_id] + 1; ## retrieve cell-array of variable values from variable names in ## calling function [vars{1:nvars}] = evalin("caller", sprintf ("{%s%s}{:}", varnames{1}, ifelse (nvars > 1, sprintf (", %s", varnames{2:end}), ""))); ## retrieve logical vector of corresponding 'global' states vglobal = __visglobal__ (varnames); ## construct binary tree of transfers source_hosts = 1; source_id = zeros (0, 1); target_ids = zeros (0, 2); [source_id, target_ids] = add_transfers (source_id, target_ids, source_hosts, nhosts); if (any (vglobal)) recv_cmd1 = sprintf ("%s%s%s", "global ", sprintf ("%s ", varnames{vglobal}), "; "); else recv_cmd1 = ""; endif ## we need a temporary for easily sending the vars to the next server recv_cmd2_mask = sprintf ("__pserver_tvars__ = precv (sockets(%%i)); [%s%s] = __pserver_tvars__{:}; ", varnames{1}, ifelse (nvars > 1, sprintf (", %s", varnames{2:end}), "")); recv_cmd_mask = cstrcat (recv_cmd1, recv_cmd2_mask); send_cmd_mask = "psend (__pserver_tvars__, sockets([%s]));"; ## It is better to reval the recv command and the possibly following ## send commands for a specific server within the same string. ## Otherwise the client or a server might block if the command string ## does not fit into the socket buffers (and we may have long command ## strings here). error_in_first_command = false; ready = false; unwind_protect ## initial transfer recv_cmd = sprintf (recv_cmd_mask, 1); if (nhosts > 1) send_cmd = sprintf (send_cmd_mask, get_ridx_string (target_ids(1, :), ridx)); else send_cmd = ""; endif cmd = sprintf ("%s%s", recv_cmd, send_cmd); try reval (cmd, conns(1)); catch error_in_first_command = true; error (lasterror ()); end_try_catch psend (vars, conns(1)); ## remote transfers for ida = 1 : numel (source_id) for idb = 1:2 if ((did = target_ids(ida, idb)) != 0) recv_cmd = sprintf (recv_cmd_mask, ridx(source_id(ida))); if (isempty (sid = find (source_id == did))) send_cmd = ""; else send_cmd = sprintf (send_cmd_mask, get_ridx_string (target_ids(sid, :), ... ridx)); endif cmd = sprintf ("%s%s", recv_cmd, send_cmd); reval (cmd, conns(did)); endif endfor endfor ready = true; unwind_protect_cleanup if (! (ready || error_in_first_command)) sclose (conns); endif end_unwind_protect endfunction function ret = get_ridx_string (targ_idx, ridx) ret = sprintf ("%i", ridx(targ_idx(1))); if (targ_idx(2) != 0) ret = sprintf ("%s, %i", ret, ridx(targ_idx(2))); endif endfunction function [source_id, target_ids] = add_transfers (source_id, target_ids, source_hosts, nhosts) if ((left = nhosts - source_hosts(end)) == 0) return; endif new_source_hosts = zeros (1, 0); for idb = 1:2 # two branches for ids = 1 : (nsh = numel (source_hosts)) current_target_id = nhosts + 1 - left; if (idb == 1) source_id = vertcat (source_id, source_hosts(ids)); target_ids = vertcat (target_ids, [current_target_id, 0]); else target_ids(end + ids - nsh, 2) = current_target_id; endif new_source_hosts = horzcat (new_source_hosts, current_target_id); left--; if (left == 0) break; endif endfor # source hosts if (left == 0) break; endif endfor # two branches [source_id, target_ids] = add_transfers (source_id, target_ids, new_source_hosts, nhosts); endfunction parallel-3.1.3/src/PaxHeaders.30520/fsave.cc0000644000000000000000000000013213331003466015241 xustar0030 mtime=1533282102.538477575 30 atime=1533282231.241018735 30 ctime=1533282233.633065964 parallel-3.1.3/src/fsave.cc0000644000175000017500000000330513331003466015440 0ustar00olafolaf00000000000000/* Copyright (C) 2009 VZLU Prague This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see . */ // Author: Jaroslav Hajek #include #include #include "minimal-load-save.h" DEFUN_DLD (fsave, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} fsave (@var{fid}, @var{var})\n\ Save a single variable to a binary stream, to be subsequently loaded with\n\ fload. Returns true if successful.\n\ Not suitable for data transfer between machines of different type.\n\ @end deftypefn") { octave_value retval; int nargin = args.length (); if (nargin == 2) { int fid = OCTAVE__INTERPRETER__STREAM_LIST__GET_FILE_NUMBER (args(0)); OCTAVE__STREAM octs = OCTAVE__INTERPRETER__STREAM_LIST__LOOKUP (fid, "fsave"); std::ostream *os = octs.output_stream (); octave_value val = args(1); if (os) { minimal_write_header (*os); if (minimal_write_data (*os, val)) error ("fsave: could not save variable."); } else error ("fsave: stream not opened for writing."); } else print_usage (); return retval; } parallel-3.1.3/src/PaxHeaders.30520/bootstrap0000644000000000000000000000013213331003466015566 xustar0030 mtime=1533282102.534477496 30 atime=1533282102.590478602 30 ctime=1533282233.633065964 parallel-3.1.3/src/bootstrap0000755000175000017500000000005513331003466015767 0ustar00olafolaf00000000000000#! /bin/sh aclocal autoconf autoheader -f parallel-3.1.3/src/PaxHeaders.30520/scloseall.copy_to_m0000644000000000000000000000013213331003466017521 xustar0030 mtime=1533282102.574478286 30 atime=1533282227.396942838 30 ctime=1533282233.633065964 parallel-3.1.3/src/scloseall.copy_to_m0000644000175000017500000000226213331003466017721 0ustar00olafolaf00000000000000## Copyright (C) 2002 by Hayato Fujiwara ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software ## Foundation; either version 3 of the License, or (at your option) any later ## version. ## ## This program is distributed in the hope that it will be useful, but WITHOUT ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ## details. ## ## You should have received a copy of the GNU General Public License ## along with this program; If not, see . ## -*- texinfo -*- ## @deftypefn {Function File} {} scloseall (@var{connections}) ## Deprecated function, calls @code{sclose (connections)}, which should ## be called directly. ## ## @seealso {sclose} ## @end deftypefn function scloseall (connections) persistent warned = false; if (! warned) warned = true; warning ("Octave:deprecated-function", "scloseall is deprecated, please use sclose directly."); endif sclose (connections); endfunction parallel-3.1.3/src/PaxHeaders.30520/p-sighandler.h0000644000000000000000000000013113331003466016353 xustar0030 mtime=1533282102.566478128 29 atime=1533282227.62094726 30 ctime=1533282233.633065964 parallel-3.1.3/src/p-sighandler.h0000644000175000017500000000373713331003466016564 0ustar00olafolaf00000000000000/* Copyright (C) 2015-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ #ifndef __OCT_PARALLEL_SIGHANDLER__ #define __OCT_PARALLEL_SIGHANDLER__ #include #include class inthandler_dont_restart_syscalls { public: inthandler_dont_restart_syscalls (void) : restore_int (false), restore_break (false) { #ifdef SIGINT if (sigaction (SIGINT, NULL, &oldintaction)) return; restore_int = true; memcpy (&newintaction, &oldintaction, sizeof (struct sigaction)); newintaction.sa_flags &= ~ SA_RESTART; sigaction (SIGINT, &newintaction, NULL); #endif #ifdef SIGBREAK if (sigaction (SIGBREAK, NULL, &oldbreakaction)) return; restore_break = true; memcpy (&newbreakaction, &oldbreakaction, sizeof (struct sigaction)); newbreakaction.sa_flags &= ~ SA_RESTART; sigaction (SIGBREAK, &newbreakaction, NULL); #endif } ~inthandler_dont_restart_syscalls (void) { #ifdef SIGINT if (restore_int) sigaction (SIGINT, &oldintaction, NULL); #endif #ifdef SIGBREAK if (restore_break) sigaction (SIGBREAK, &oldbreakaction, NULL); #endif } private: bool restore_int; bool restore_break; #ifdef SIGINT struct sigaction newintaction; struct sigaction oldintaction; #endif #ifdef SIGBREAK struct sigaction newbreakaction; struct sigaction oldbreakaction; #endif }; #endif // __OCT_PARALLEL_SIGHANDLER__ parallel-3.1.3/src/PaxHeaders.30520/sensitive-data.h0000644000000000000000000000013213331003466016717 xustar0030 mtime=1533282102.574478286 30 atime=1533282227.616947181 30 ctime=1533282233.633065964 parallel-3.1.3/src/sensitive-data.h0000644000175000017500000001621413331003466017121 0ustar00olafolaf00000000000000/* Copyright (C) 2015-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ #ifndef __OCT_PARALLEL_SENSITIVE_DATA__ #define __OCT_PARALLEL_SENSITIVE_DATA__ #include class sensitive_base { public: virtual void zero_val (void) = 0; }; class zero_sensitive_base { public: zero_sensitive_base (void) {} ~zero_sensitive_base (void) { for (std::list::const_iterator it = list.begin (); it != list.end (); it++) (*it)->zero_val (); } void add (sensitive_base *el) { list.push_front (el); } private: std::list list; }; class verifier: public sensitive_base { public: verifier (void) : valid (false), locked_length (0) { val.data = NULL; val.size = 0; } verifier (const char *username, const char *passwd, const gnutls_datum_t *salt, bool lock = false) : valid (false), locked_length (0) { val.data = NULL; val.size = 0; do_assign (username, passwd, salt, lock); } void assign (const char *username, const char *passwd, const gnutls_datum_t *salt, bool lock = false) { do_assign (username, passwd, salt, lock); } void free_val (void) { if (val.data) { zero_val (); if (locked_length) { if (munlock (val.data, locked_length)) fprintf (stderr, "Could not unlock memory pages!\n"); else locked_length = 0; } free (val.data); val.data = NULL; } val.size = 0; valid = false; } void zero_val (void) { valid = false; if (val.data) memset ((void *) val.data, '\0', val.size); } ~verifier (void) { free_val (); } bool good (void) {return valid;} const gnutls_datum_t &get_val (void) {return val;} private: void do_assign (const char *&username, const char *&passwd, const gnutls_datum_t *&salt, bool lock) { if (gnutls_srp_verifier (username, passwd, salt, &gnutls_srp_2048_group_generator, &gnutls_srp_2048_group_prime, &val) == GNUTLS_E_SUCCESS && val.data) { if (lock) { if (mlock (val.data, val.size)) _p_error ("could not lock memory pages"); else { valid = true; locked_length = val.size; } } else valid = true; } } gnutls_datum_t val; bool valid; int locked_length; }; class sensitive_string: public sensitive_base { public: sensitive_string (void) : valid (false), internally_allocated (false), locked_length (0) { val.data = NULL; val.size = 0; } sensitive_string (char *s, bool lock = false) : valid (false), internally_allocated (false), locked_length (0) { assign (s, lock); } sensitive_string (int n, bool lock = false) : valid (false), internally_allocated (false), locked_length (0) { val.data = NULL; val.size = 0; fill (n, lock); } void fill (int n, bool lock = false); void assign (char *s, bool lock = false) { if (valid || locked_length || internally_allocated) { valid = false; return; } val.data = (unsigned char *) s; val.size = strlen ((char *) val.data); valid = true; if (val.size != 0 && lock) { if (mlock (val.data, val.size)) { _p_error ("could not lock memory pages"); valid = false; } else locked_length = val.size; } } void free_val (void) { if (val.data) { zero_val (); if (locked_length) { if (munlock (val.data, locked_length)) fprintf (stderr, "Could not unlock memory pages!\n"); else locked_length = 0; } if (internally_allocated) { delete [] val.data; internally_allocated = false; } val.data = NULL; } val.size = 0; valid = false; } void zero_val (void) { valid = false; if (val.data) memset ((void *) val.data, '\0', val.size); } ~sensitive_string (void) { free_val (); } bool good (void) {return valid;} const gnutls_datum_t &get_val (void) {return val;} char *get_string (void) {return (char *) val.data;} int get_size (void) {return val.size;} private: // val.size is the length of the string (without terminating '\0'), // not the length of the data. This is because gnutls encoding // functions expect a gnutls_datum_t with binary data. gnutls_datum_t val; bool valid; bool internally_allocated; int locked_length; }; class srp_base64_encode: public sensitive_base { public: srp_base64_encode (void) : valid (false), locked_length (0) { val.data = NULL; val.size = 0; } srp_base64_encode (const gnutls_datum_t *data, bool lock = false) : valid (false), locked_length (0) { val.data = NULL; val.size = 0; encode (data, lock); } void encode (const gnutls_datum_t *data, bool lock = false) { if (gnutls_srp_base64_encode_alloc (data, &val)) { _p_error ("base64 encoding failed"); valid = false; } else { valid = true; if (lock) { if (mlock (val.data, val.size)) { _p_error ("could not lock memory pages"); valid = false; } else locked_length = val.size; } } } void free_val (void) { if (val.data) { zero_val (); if (locked_length) { if (munlock (val.data, locked_length)) fprintf (stderr, "Could not unlock memory pages!\n"); else locked_length = 0; } gnutls_free ((void *) val.data); val.data = NULL; } val.size = 0; } void zero_val (void) { valid = false; if (val.data) memset ((void *) val.data, '\0', val.size); } ~srp_base64_encode (void) { free_val (); } bool good (void) {return valid;} const gnutls_datum_t &get_val (void) {return val;} char *get_string (void) {return (char *) val.data;} int get_size (void) {return val.size;} private: gnutls_datum_t val; bool valid; int locked_length; }; #endif // __OCT_PARALLEL_SENSITIVE_DATA__ parallel-3.1.3/src/PaxHeaders.30520/error-helpers.h0000644000000000000000000000013213331003466016570 xustar0030 mtime=1533282102.534477496 30 atime=1533282227.616947181 30 ctime=1533282233.633065964 parallel-3.1.3/src/error-helpers.h0000644000175000017500000000674013331003466016775 0ustar00olafolaf00000000000000/* Copyright (C) 2016-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ #include "config.h" // Octaves non-static verror functions: The elder all set error_state, // the newer, present from the time on at which error started to throw // an exception, all throw, too. // call verror, for _linking_ also against Octave versions who have no // verror() with these arguments #ifdef HAVE_OCTAVE_VERROR_ARG_EXC void c_verror (OCTAVE__EXECUTION_EXCEPTION&, const char *, ...); #else void c_verror (const OCTAVE__EXECUTION_EXCEPTION&, const char *, ...); #endif void _p_error (const char *fmt, ...); // Print a message if 'code' causes an error and raise an error again, // both if Octave uses exceptions for errors and if it still uses // error_state. In the latter case return 'retval'. #ifdef HAVE_OCTAVE_ERROR_STATE // can throw OCTAVE__EXECUTION_EXCEPTION despite of this #define CHECK_ERROR(code, retval, ...) \ try \ { \ code ; \ \ if (error_state) \ { \ error (__VA_ARGS__); \ \ return retval; \ } \ } \ catch (OCTAVE__EXECUTION_EXCEPTION& e) \ { \ c_verror (e, __VA_ARGS__); \ } #else #define CHECK_ERROR(code, retval, ...) \ try \ { \ code ; \ } \ catch (OCTAVE__EXECUTION_EXCEPTION& e) \ { \ verror (e, __VA_ARGS__); \ } #endif // If 'code' causes an error, print a message and call exit(1) if // Octave doesn't throw exceptions for errors but still uses // error_state. #ifdef HAVE_OCTAVE_ERROR_STATE // can throw OCTAVE__EXECUTION_EXCEPTION despite of this #define CHECK_ERROR_EXIT1(code, ...) \ try \ { \ code ; \ \ if (error_state) \ { \ _p_error (__VA_ARGS__); \ \ exit (1); \ } \ } \ catch (OCTAVE__EXECUTION_EXCEPTION&) \ { \ _p_error (__VA_ARGS__); \ \ exit (1); \ } #else #define CHECK_ERROR_EXIT1(code, ...) \ try \ { \ code ; \ } \ catch (OCTAVE__EXECUTION_EXCEPTION&) \ { \ _p_error (__VA_ARGS__); \ \ exit (1); \ } #endif // Set 'err' to true if 'code' causes an error, else to false; both if // Octave uses exceptions for errors and if it still uses // error_state. In the latter case reset error_state to 0. #ifdef HAVE_OCTAVE_ERROR_STATE // can throw OCTAVE__EXECUTION_EXCEPTION despite of this #define SET_ERR(code, err) \ err = false; \ \ try \ { \ code ; \ if (error_state) \ { \ error_state = 0; \ err = true; \ } \ } \ catch (OCTAVE__EXECUTION_EXCEPTION&) \ { \ err = true; \ } #else #define SET_ERR(code, err) \ err = false; \ \ try \ { \ code ; \ } \ catch (OCTAVE__EXECUTION_EXCEPTION&) \ { \ err = true; \ } #endif parallel-3.1.3/src/PaxHeaders.30520/pconnect.cc0000644000000000000000000000013213331003466015746 xustar0030 mtime=1533282102.570478207 30 atime=1533282227.400942917 30 ctime=1533282233.633065964 parallel-3.1.3/src/pconnect.cc0000644000175000017500000006174113331003466016155 0ustar00olafolaf00000000000000/* Copyright (C) 2002 Hayato Fujiwara Copyright (C) 2010-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ // PKG_ADD: autoload ("pconnect", "parallel_interface.oct"); // PKG_DEL: autoload ("pconnect", "parallel_interface.oct", "remove"); #include #include "config.h" #include #include #include #include #include // reported necessary for FreeBSD-8 #if HAVE_UNISTD_H #include #endif #include "parallel-gnutls.h" static int assert_file (std::string &path) { OCTAVE__SYS__FILE_STAT stat (path); if (! stat.is_reg ()) return -1; else return 0; } DEFUN_DLD (pconnect, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{connections} =} pconnect (@var{hosts})\n\ @deftypefnx {Loadable Function} {@var{connections} =} pconnect (@var{hosts}, @var{options})\n\ Connects to a network of parallel cluster servers.\n\ \n\ As a precondition, a server must have been started at each machine of\n\ the cluster, see @code{pserver}. Connections are not guaranteed to\n\ work if client and server are from @code{parallel} packages of\n\ different versions, so versions should be kept equal.\n\ \n\ @var{hosts} is a cell-array of strings, holding the names of all\n\ server machines. The machines must be unique, and their names must be\n\ resolvable to the correct addresses also at each server machine, not\n\ only at the client. This means e.g. that the name @code{localhost} is\n\ not acceptable (exception: @code{localhost} is acceptable as the first\n\ of all names).\n\ \n\ Alternatively, but deprecated, @var{hosts} can be given as previously,\n\ as a character array with a machine name in each row. If it is given\n\ in this way, the first row must contain the name of the client machine\n\ (for backwards compatibility), so that there is one row more than the\n\ now preferred cell-array @var{hosts} would have entries.\n\ \n\ @code{pconnect} returns an opaque variable holding the network\n\ connections. This variable can be indexed to obtain a subset of\n\ connections or even a single connection. (For backwards compatibility,\n\ a second index of @code{:} is allowed, which has no effect). At the\n\ first index position is the client machine, so this position does not\n\ correspond to a real connection. At the following index positions are\n\ the server machines in the same order as specified in the cell-array\n\ @var{hosts}. So in the whole the variable of network connections has\n\ one position more than the number of servers given in @var{hosts}\n\ (except if @var{hosts} was given in the above mentioned deprecated\n\ way). You can display the variable of network connections to see what\n\ is in it. The variable of network connections, or subsets of it, is\n\ passed to the other functions for parallel cluster excecution\n\ (@code{reval}, @code{psend}, @code{precv}, @code{sclose},\n\ @code{select_sockets} among others -- see documentation of these\n\ functions).\n\ \n\ @var{options}: structure of options; field @code{use_tls} is\n\ @code{true} by default (TLS with SRP authentication); if set to\n\ @code{false}, there will be no encryption or authentication. Field\n\ @code{password_file} can be set to an alternative path to the file\n\ with authentication information (see below). Field @code{user} can\n\ specify the username for authentication; if the username is so\n\ specified, no file with authentication information will be used at the\n\ client, but the password will be queried from the user.\n\ \n\ The client and the server must both use or both not use TLS. If TLS is\n\ switched off, different measures must be taken to protect ports 12501\n\ and 12502 at the servers and the client against unauthorized access;\n\ e.g. by a firewall or by physical isolation of the network.\n\ \n\ For using TLS, authorization data must be present at the server\n\ machine. These data can conveniently be generated by\n\ @code{parallel_generate_srp_data}. By default, the client\n\ authentication file is created in the same run. The helptext of\n\ @code{parallel_generate_srp_data} documents the expected locations of\n\ the authentication data.\n\ \n\ The SRP password will be sent over the encrypted TLS channel from the\n\ client to each server, to avoid permanently storing passwords at the\n\ server for server-to-server data connections. Due to inevitable usage\n\ of external libraries, memory with sensitive data can, however, be on\n\ the swap device even after shutdown of the application, both at the\n\ client and at the server machines.\n\ \n\ Example (let data travel through all machines), assuming\n\ @code{pserver} was called on each remote machine and authentication\n\ data is present (e.g. generated with\n\ @code{parallel_generate_srp_data}):\n\ \n\ @example\n\ @group\n\ sockets = pconnect (@{'remote.machine.1', 'remote.machine.2'@});\n\ reval ('psend (precv (sockets(2)), sockets(1))', sockets(3));\n\ reval ('psend (precv (sockets(1)), sockets(3))', sockets(2));\n\ psend ('some data', sockets(2));\n\ precv (sockets(3))\n\ --> ans = some data\n\ sclose (sockets);\n\ @end group\n\ @end example\n\ \n\ @seealso{pserver, reval, psend, precv, sclose, parallel_generate_srp_data, select_sockets, rfeval}\n\ @end deftypefn") { std::string fname ("pconnect"); octave_value retval; if (args.length () < 1 || args.length () > 2) { print_usage (); return retval; } if (nargout == 0) { error ("%s: An output argument must be given to hold the network connections.", fname.c_str ()); return retval; } // A negative integer might be sent as Octave data, and Octave // doesn't care about coding of negative integers. (I know, there // probably will never be a current C-compiler with something // different than twos complement, but the C99-standard allows for // it.) if (octave_parallel_stream::signed_int_rep ()) { error ("This machine doesn't seem to use twos complement as negative integer representation. If you want this machine to be supported, please file a bug report."); return retval; } // The original character array argument had client name in first // row. We still accept such an argument. But currently the client // and server names of connections at the server sides are taken // from the systems connection structures. This means e.g. that the // name under which a client appears to servers can be different on // different servers and different from the client hostname // retrieved at the client itself. // // The new cell-array argument does not give the client name; so it // has one entry less than the previous character array would have // had rows. Array hosts; bool err; SET_ERR (hosts = args(0).cellstr_value (), err); if (err) { charMatrix cm; CHECK_ERROR (cm = args(0).char_matrix_value (), retval, "%s: first argument must be a cell array of strings or a character matrix", fname.c_str ()); int rows = cm.rows (); int cols = cm.columns (); cm = cm.transpose (); hosts.resize1 (rows - 1, std::string ()); const char *pts, *pte; for (int i = 1; i < rows; i++) { if ((pte = (char *) memchr ((void *) (pts = &cm.data ()[cols * i]), ' ', cols))) hosts(i - 1) = std::string (pts, pte - pts); else hosts(i - 1) = std::string (pts, cols); } } uint32_t nhosts = hosts.numel (); inthandler_dont_restart_syscalls __inthandler_guard__; // "canonicalize" host names and check for uniqueness Array canhosts (dim_vector (nhosts, 1)); struct addrinfo *ai, hints; memset ((void *) &hints, 0, sizeof (hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; hints.ai_flags = AI_CANONNAME; struct __aiguard { struct addrinfo *__ai; __aiguard (struct addrinfo *__aai) : __ai (__aai) { } ~__aiguard (void) { freeaddrinfo (__ai); } }; for (uint32_t i = 0; i < nhosts; i++) { if (getaddrinfo (hosts(i).c_str (), NULL, &hints, &ai)) { error ("getaddrinfo returned an error"); return retval; } struct __aiguard __aig (ai); canhosts(i) = std::string (ai->ai_canonname); dcprintf ("orig: %s, canon: %s\n", hosts(i).c_str (), ai->ai_canonname); } Array s_canhosts (canhosts.sort ()); for (uint32_t i = 1; i < nhosts; i++) { if (! s_canhosts(i - 1).compare (s_canhosts(i))) { error ("%s: hostnames not unique after canonicalizing", fname.c_str ()); return retval; } } // default options bool use_gnutls = true; bool use_pfile = true; std::string cpfile; std::string user; // get options, if any if (args.length () == 2) { octave_scalar_map options; CHECK_ERROR (options = args(1).scalar_map_value (), retval, "%s: could not convert second argument to scalar structure", fname.c_str ()); octave_value tmp; // use TLS tmp = options.contents ("use_tls"); if (tmp.is_defined ()) { CHECK_ERROR (use_gnutls = tmp.bool_value (), retval, "%s: could not convert option 'use_tls' to bool", fname.c_str ()); } // custom password file tmp = options.contents ("password_file"); if (tmp.is_defined ()) { CHECK_ERROR (cpfile = tmp.string_value (), retval, "%s: could not convert option 'password_file' to string", fname.c_str ()); } // user name tmp = options.contents ("user"); if (tmp.is_defined ()) { CHECK_ERROR (user = tmp.string_value (), retval, "%s: could not convert option 'user' to string", fname.c_str ()); if (user.length ()) use_pfile = false; } } // args.length () == 2 // check options integrity #ifndef HAVE_LIBGNUTLS if (use_gnutls) { error ("TLS not available"); return retval; } #endif if (! use_gnutls && (! use_pfile || cpfile.length ())) warning ("no TLS used, options 'user' and 'password_file' have no effect"); if (use_gnutls && ! use_pfile && cpfile.length ()) warning ("option 'password_file' has no effect since option 'user' was given and is not empty"); #ifdef HAVE_LIBGNUTLS // if necessary, initialize gnutls and create credentials struct __credguard { octave_parallel_gnutls_srp_client_credentials *__c; __credguard (void) : __c (NULL) { } ~__credguard (void) { if (__c && ! __c->check_ref ()) { dcprintf ("__credguard will delete cred\n"); delete __c; } } octave_parallel_gnutls_srp_client_credentials *__get (void) { return __c; } void __set (octave_parallel_gnutls_srp_client_credentials *__ic) { __c = __ic; } void __release (void) { __c = NULL; } } __cg; octave_parallel_gnutls_srp_client_credentials *ccred; if (use_gnutls) { // There is no deinitialization routine for extra, _init_extra() // requires _init() to have been called before, and only the // first call to each of these functions does anything beyond // incrementing a counter. So we can't ever deinitialize even // the general globals, since we would not be able to // reinitialize _extra after this. So we can just as well call // the init functions for each pconnect, as long as their global // counters don't overflow. gnutls_global_init (); #ifdef HAVE_LIBGNUTLS_EXTRA gnutls_global_init_extra (); // for SRP parallel_gnutls_set_mem_functions (); #endif if (use_pfile) { if (! cpfile.length ()) { #ifdef HAVE_OCTAVE_CONFIG_FCNS std::string octave_home = octave::config::octave_home (); #else extern std::string Voctave_home; std::string octave_home = Voctave_home; #endif cpfile = octave_home + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "share" + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "octave" + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "parallel-srp-data" + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "client" + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "user_passwd"; if (assert_file (cpfile)) { octave_value_list f_args (1); f_args(0) = octave_value ("prefix"); octave_value_list f_ret; CHECK_ERROR (f_ret = OCTAVE__FEVAL ("pkg", f_args, 1), retval, "%s: could not get prefix from pkg", fname.c_str ()); CHECK_ERROR (cpfile = f_ret(0).string_value (), retval, "%s: could not convert output of pkg ('prefix') to string)", fname.c_str ()); cpfile = cpfile + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "parallel-srp-data" + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "client" + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "user_passwd"; if (assert_file (cpfile)) { error ("%s: no regular file found at default password file paths", fname.c_str ()); return retval; } } } else if (assert_file (cpfile)) { error ("%s: no regular file found at password file path given by user", fname.c_str ()); return retval; } __cg.__set (ccred = new octave_parallel_gnutls_srp_client_credentials (cpfile)); // arg is std::string } else __cg.__set (ccred = new octave_parallel_gnutls_srp_client_credentials (user.c_str ())); // arg is char* string if (! __cg.__get ()->check_cred ()) { error ("%s: could not create credentials", fname.c_str ()); return retval; } } #endif // HAVE_LIBGNUTLS char tuuid[37]; char *uuid = (char *) tuuid; if (oct_parallel_store_unique_identifier (uuid)) return retval; octave_parallel_network *network; struct __netwguard { octave_parallel_network *__n; __netwguard (octave_parallel_network *__an): __n (__an) { __n->get_ref (); } ~__netwguard (void) { if (__n->release_ref () <= 0) { dcprintf ("__netwguard will delete network\n"); delete __n; } } } __ng (network = new octave_parallel_network (nhosts + 1)); // a pseudo-connection, representing the own node in the network octave_parallel_connection *conn = new octave_parallel_connection (false, uuid); network->insert_connection (conn, 0); // store number of processor cores available in client conn->set_nproc (num_processors (NPROC_CURRENT)); for (uint32_t i = 0; i < nhosts; i++) { dcprintf ("host number %i\n", i); int sock = socket (PF_INET, SOCK_STREAM, 0); if (sock == -1) { error ("socket error"); return retval; } struct __sockguard { __sockguard (int __isock) { __sock = __isock; } ~__sockguard (void) { if (__sock > -1) close (__sock); } void __release (void) { __sock = -1; } int __sock; } __sockg (sock); struct addrinfo *ai, hints; memset ((void *) &hints, 0, sizeof (hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; hints.ai_flags = 0; if (getaddrinfo (hosts(i).c_str (), "12502", &hints, &ai)) { error ("getaddrinfo returned an error"); return retval; } struct __aiguard __aig (ai); int not_connected = 1; for (int j = 0; j < N_CONNECT_RETRIES; j++) { if((not_connected = connect (sock, ai->ai_addr, ai->ai_addrlen)) == 0) break; else if (errno != ECONNREFUSED && errno != EINTR) { _p_error ("connect error"); break; } else usleep(5000); } if (not_connected) { error ("Unable to connect to %s", hosts(i).c_str ()); return retval; } else { conn = new octave_parallel_connection (hosts(i).c_str (), false, uuid); network->insert_connection (conn, i + 1); #ifdef HAVE_LIBGNUTLS if (use_gnutls) { conn->insert_cmd_stream (new octave_parallel_stream (new octave_parallel_gnutls_streambuf (sock, ccred, false))); __cg.__release (); } else #endif conn->insert_cmd_stream (new octave_parallel_stream (new octave_parallel_socket_streambuf (sock, false))); __sockg.__release (); if (! conn->get_cmd_stream ()->good ()) { error ("could not create command stream to %s", hosts(i).c_str ()); return retval; } conn->get_cmd_stream ()->network_send_4byteint (nhosts, true); dcprintf ("nhosts written\n"); uint32_t nproc; conn->get_cmd_stream ()->network_recv_4byteint (nproc); dcprintf ("nproc read (%u)\n", nproc); conn->set_nproc (nproc); conn->get_cmd_stream ()->network_send_4byteint (i + 1, true); dcprintf ("current host number written (%i)\n", i + 1); conn->get_cmd_stream ()->network_send_string (uuid); dcprintf ("uuid written (%s)\n", uuid); for (uint32_t j = 0; j < nhosts; j++) { conn->get_cmd_stream ()->network_send_string (hosts(j).c_str ()); dcprintf ("hostname %i written (%s)\n", j, hosts(j).c_str ()); } std::string directory = octave_env::get_current_directory (); conn->get_cmd_stream ()->network_send_string (directory.c_str ()); dcprintf ("directory written (%s)\n", directory.c_str ()); #ifdef HAVE_LIBGNUTLS // This is to enable the servers to authenticate to each // other with TLS-SRP without having passwords stored at the // servers. The username can be read from the TLS-SRP // structures by the server. if (use_gnutls) { conn->get_cmd_stream ()->network_send_string (ccred->get_passwd ()); dcprintf ("password written (%s)\n", ccred->get_passwd ()); } #endif if (! conn->get_cmd_stream ()->good ()) { error ("communication error in initialization"); return retval; } } } // go through the (now short) chain of deallocation-safeguarding // objects up to octave_value octave_parallel_connections *cconns = new octave_parallel_connections (network, uuid, false); retval = octave_value (cconns); octave_parallel_connections_rep *conns = cconns->get_rep (); // usleep (100); dcprintf ("\n data socket \n\n"); for (uint32_t i = 0; i < nhosts; i++) { dcprintf ("host number %i\n", i); struct addrinfo *ai = NULL, hints; memset ((void *) &hints, 0, sizeof (hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; hints.ai_flags = 0; if (getaddrinfo (hosts(i).c_str (), "12501", &hints, &ai)) { error ("getaddrinfo returned an error"); return retval; } struct __aiguard __aig (ai); int not_connected = 1; for (int j = 0; j < N_CONNECT_RETRIES; j++) { dcprintf ("host %i, connect retry %i\n", i, j); int sock = socket (PF_INET, SOCK_STREAM, 0); if (sock == -1) { error ("socket error"); return retval; } struct __sockguard { __sockguard (int __isock) { __sock = __isock; } ~__sockguard (void) { if (__sock > -1) close (__sock); } void __release (void) { __sock = -1; } int __sock; } __sockg (sock); dcprintf ("%i, %i, trying to connect \n", i, j); if (connect (sock, ai->ai_addr, ai->ai_addrlen) == 0) { dcprintf ("%i, %i, connect successful\n", i, j); octave_parallel_stream *data_stream; #ifdef HAVE_LIBGNUTLS if (use_gnutls) conns->get_connections ()(i + 1)->insert_data_stream (data_stream = new octave_parallel_stream (new octave_parallel_gnutls_streambuf (sock, ccred, false))); else #endif conns->get_connections ()(i + 1)->insert_data_stream (data_stream = new octave_parallel_stream (new octave_parallel_socket_streambuf (sock, false))); __sockg.__release (); if (! data_stream->good ()) { error ("%i, %i, could not create data stream to %s", i, j, hosts(i).c_str ()); return retval; } dcprintf ("data connection established\n"); data_stream->network_send_string (uuid); dcprintf ("%i, %i, uuid written (%s)\n", i, j, uuid); // send host number 0 (me, the master) data_stream->network_send_4byteint (0, true); dcprintf ("%i, %i, me (0) written\n", i, j); // recv result code int32_t res; data_stream->network_recv_4byteint (res); if (! data_stream->good ()) { error ("communication error in initialization"); return retval; } if (res == -1) { if (conns->get_connections ()(i + 1)->delete_data_stream ()) { error ("could not delete data stream"); return retval; } dcprintf ("%i, %i, sleeping after receiving bad result (%i)\n", i, j, res); usleep (5000); } else if (res) { error ("unexpected server error"); return retval; } else { minimal_write_header (data_stream->get_ostream ()); if (conns->get_connections ()(i + 1)-> connection_read_header () || ! data_stream->good ()) { error ("communication error in initialization"); return retval; } not_connected = 0; dcprintf ("%i, %i, good result read, header written and read and datastream good, breaking\n", i, j); break; } } else if (errno != ECONNREFUSED && errno != EINTR) { _p_error ("connect error"); break; } else { dcprintf ("%i, %i, sleeping after failed connect\n", i, j); usleep (5000); } } if (not_connected) { error ("unable to connect to %s", hosts(i).c_str ()); return retval; } } char dummy; for (uint32_t i = 1; i <= nhosts; i++) { conns->get_connections ()(i)->get_cmd_stream ()->get_istream () >> std::noskipws >> dummy; dcprintf ("host %i, final dummy read from command stream (%i)\n", i, dummy); dummy = '\n'; conns->get_connections ()(i)->get_cmd_stream ()->get_ostream () << dummy; dcprintf ("host %i, final newline written to command stream\n", i); if (! conns->get_connections ()(i)->get_cmd_stream ()->good ()) { error ("could not finish initialization"); return retval; } dcprintf ("host %i, command stream good\n", i); } dcprintf ("returning retval\n"); return retval; } /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */ parallel-3.1.3/src/PaxHeaders.30520/p-streams.cc0000644000000000000000000000013213331003466016050 xustar0030 mtime=1533282102.566478128 30 atime=1533282102.566478128 30 ctime=1533282233.633065964 parallel-3.1.3/src/p-streams.cc0000644000175000017500000001455413331003466016257 0ustar00olafolaf00000000000000/* Copyright (C) 2015-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ #include "parallel-gnutls.h" #define BUFLEN 2048 octave_parallel_socket_streambuf:: octave_parallel_socket_streambuf (int sid, bool server, encryption_type encrtype) : undefined_connection_state (false) { fid = sid; if (fid == -1) { store_errno = -1; _p_error ("no valid socket"); } else { readable = writeable = true; uint32_t info = 0; if (server) { info = encrtype << 16; info |= PROTOCOL_VERSION; network_send_4byteint (info, true); if (network_recv_4byteint (info)) _p_error ("could not read client response to info"); else { if (info != 0) { store_errno = -1; _p_error ("client rejected connection because its connection type is %u and its protocol version is %u", info >> 16, info & 0xFFFF); } } } else // client { bool err = false; if (network_recv_4byteint (info)) _p_error ("could not read server info"); else { if (info >> 16 != encrtype) { err = true; _p_error ("server uses connection type %u, we use %u", info >> 16, encrtype); } if ((info & 0xFFFF) != PROTOCOL_VERSION) { err = true; _p_error ("server uses protocol version %u, we use %u", info & 0xFFFF, PROTOCOL_VERSION); } } if (err) { info = encrtype << 16; info |= PROTOCOL_VERSION; } else info = 0; network_send_4byteint (info, true); if (err) store_errno = -1; } } } #ifdef HAVE_LIBGNUTLS // Username was given as argument to 'connect'. appasswd is optional. octave_parallel_gnutls_srp_client_credentials:: octave_parallel_gnutls_srp_client_credentials (const char *user, char *apasswd) : password (apasswd), pw_allocated (false) { if (! password) password = getpass ("password: "); if (! strlen (password)) { _p_error ("password is empty"); return; } if (! gnutls_srp_allocate_client_credentials ((gnutls_srp_client_credentials_t *) &cred)) if (gnutls_srp_set_client_credentials ((gnutls_srp_client_credentials_t) cred, user, password)) { free_credentials (); cred = NULL; } } // no username was given as argument to 'connect' octave_parallel_gnutls_srp_client_credentials:: octave_parallel_gnutls_srp_client_credentials (std::string passwd_file) : password (NULL), pw_allocated (false) { struct __bufguard { char *__b; __bufguard (char *__ib) : __b (__ib) { } ~__bufguard (void) { memset ((void *) __b, '\0', BUFLEN); delete[] __b; } char *__get (void) { return __b; } } __bg (new char[BUFLEN]); char *line = __bg.__get (); line[0] = '\0'; octave_parallel_stream cpi (new octave_parallel_file_streambuf (passwd_file.c_str (), O_RDONLY, 0)); if (! cpi.good ()) { _p_error ("could not open password file"); return; } cpi.get_istream ().getline (line, BUFLEN); int len = strlen (line); if (cpi.get_istream ().fail () && len == BUFLEN - 1) { _p_error ("line in password file too long"); return; } char *p; if (! (p = strchr (line, ' '))) { _p_error ("invalid line in password file"); return; } *p = '\0'; if (! strlen (line)) { _p_error ("no username in password file"); return; } if (++p - line >= len) { _p_error ("no password in password file"); return; } if (! gnutls_srp_allocate_client_credentials ((gnutls_srp_client_credentials_t *) &cred)) { if (gnutls_srp_set_client_credentials ((gnutls_srp_client_credentials_t) cred, line, p)) { free_credentials (); cred = NULL; } else { password = new char[strlen (p) + 1]; pw_allocated = true; strcpy (password, p); } } } octave_parallel_gnutls_streambuf::octave_parallel_gnutls_streambuf (int sid, octave_parallel_gnutls_srp_credentials *accred, bool server) : octave_parallel_socket_streambuf (sid, server, ENCR_TLS_SRP), ccred (accred), session (NULL) { // check result of parent class constructor, reset if necessary if (! good ()) return; else readable = writeable = false; dlprintf ("gnutls_steambuf ctor requests incr cred refcount\n"); if (! (cred = ccred->get_ref ())) { store_errno = -1; _p_error ("no valid credentials"); return; } if (gnutls_init (&session, server ? GNUTLS_SERVER : GNUTLS_CLIENT)) { store_errno = -1; _p_error ("could not initialize gnutls session"); return; } if (gnutls_priority_set_direct (session, "NORMAL:+SRP:+SRP-DSS:+SRP-RSA", NULL)) { store_errno = -1; _p_error ("error in setting gnutls priorities"); return; } if (gnutls_credentials_set (session, GNUTLS_CRD_SRP, cred)) { store_errno = -1; _p_error ("could not set credentials"); return; } gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) fid); int ret; ret = gnutls_handshake (session); // don't repeat interrupted handshake if (ret) { store_errno = -1; _p_error ("handshake failed"); return; } readable = writeable = true; } #endif // HAVE_LIBGNUTLS parallel-3.1.3/src/PaxHeaders.30520/sclose.cc0000644000000000000000000000013213331003466015425 xustar0030 mtime=1533282102.574478286 30 atime=1533282228.116957053 30 ctime=1533282233.633065964 parallel-3.1.3/src/sclose.cc0000644000175000017500000000443613331003466015632 0ustar00olafolaf00000000000000/* Copyright (C) 2002 Hayato Fujiwara Copyright (C) 2010-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ // PKG_ADD: autoload ("sclose", "parallel_interface.oct"); // PKG_DEL: autoload ("sclose", "parallel_interface.oct", "remove"); #include #include #include #include #include #include #include #include #include #include #include #include #include #include "parallel-gnutls.h" DEFUN_DLD (sclose, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} sclose (@var{connections})\n\ Close the parallel cluster network to which @var{connections} belongs.\n\ \n\ See @code{pconnect} for a description of the @var{connections}\n\ variable. All connections of the network are closed, even if\n\ @var{connections} contains only a subnet or a single connection.\n\ \n\ @seealso{pconnect, pserver, reval, psend, precv, parallel_generate_srp_data, select_sockets}\n\ @end deftypefn") { std::string fname ("sclose"); octave_value retval; if (args.length () != 1 || args(0).type_id () != octave_parallel_connections::static_type_id ()) { print_usage (); return retval; } const octave_base_value &rep = args(0).get_rep (); const octave_parallel_connections &cconns = dynamic_cast (rep); octave_parallel_connections_rep *conns = cconns.get_rep (); inthandler_dont_restart_syscalls __inthandler_guard__; conns->close (); return retval; } /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */ parallel-3.1.3/src/PaxHeaders.30520/p-connection.h0000644000000000000000000000013213331003466016373 xustar0030 mtime=1533282102.566478128 30 atime=1533282227.616947181 30 ctime=1533282233.633065964 parallel-3.1.3/src/p-connection.h0000644000175000017500000003744113331003466016602 0ustar00olafolaf00000000000000/* Copyright (C) 2015-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ #ifndef __OCT_PARALLEL_CONNECTION__ #define __OCT_PARALLEL_CONNECTION__ #include #include #include #include #include "minimal-load-save.h" #include "p-streams.h" // at 'p' 37 bytes must be available; returns 0 on success and -1 on failure int oct_parallel_store_unique_identifier (char *p); #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_PCONNECTION \ BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_1; \ if(cmd_stream) cmd_stream->get_strbuf()->set_connection_state_undefined(); \ if(data_stream) data_stream->get_strbuf()->set_connection_state_undefined(); \ octave_rethrow_exception (); \ BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_2 class octave_parallel_connection { public: octave_parallel_connection (const char *arg_peer_name, bool i_am_server, const char *auuid) : peer_node_n (-1), cmd_stream (NULL), data_stream (NULL), connection_open (false), pseudo_connection (false), peer_name (arg_peer_name), nproc (0), nlocaljobs (0), server (i_am_server), uuid (auuid) { } octave_parallel_connection (bool i_am_server, const char *auuid) : peer_node_n (-1), cmd_stream (NULL), data_stream (NULL), connection_open (false), pseudo_connection (true), peer_name (""), nproc (0), nlocaljobs (0), server (i_am_server), uuid (auuid) { } octave_parallel_connection *insert_cmd_stream (octave_parallel_stream *s) { cmd_stream = s; connection_open = true; return this; } octave_parallel_connection *insert_data_stream (octave_parallel_stream *s) { data_stream = s; connection_open = true; return this; } void set_nproc (uint32_t anproc) { nproc = anproc; } void set_nlocaljobs (uint32_t anlocaljobs) { nlocaljobs = anlocaljobs; } uint32_t get_nproc (void) { return nproc; } uint32_t get_nlocaljobs (void) { return nlocaljobs; } octave_parallel_stream *get_cmd_stream (void) const { return cmd_stream; } octave_parallel_stream *get_data_stream (void) const { return data_stream; } int poll_for_errors (void) { if (! cmd_stream) { _p_error ("can't poll since no command stream present"); return -1; } if (! cmd_stream->get_strbuf ()-> good ()) { _p_error ("can't poll since command stream not good"); return -1; } int ret = 0; uint32_t err; while (cmd_stream->get_strbuf ()->in_avail () > 0) { err = cmd_stream->network_recv_4byteint (err); if (! cmd_stream->good ()) { _p_error ("error in reading error code"); return -1; } _p_error ("An error with code %u occurred in server %s.\nSee %s:/tmp/octave_error-_%s.log for details.", err, peer_name.c_str (), peer_name.c_str (), uuid.c_str ()); ret = 1; } return ret; } int wait_for_errors_or_data (void); const std::string &get_peer_name (void) { return peer_name; } ~octave_parallel_connection (void) { dlprintf ("pconnection destructor called\n"); if (connection_open) close (); if (cmd_stream) { dlprintf ("pconnection destructor will delete cmd_stream\n"); delete cmd_stream; } if (data_stream) { dlprintf ("pconnection destructor will delete data_stream\n"); delete data_stream; } } int delete_data_stream (void) { if (data_stream) { data_stream->close (); if (! data_stream->good ()) { _p_error ("could not close data stream"); return -1; } delete data_stream; data_stream = NULL; } return 0; } int close (void) { int ret = 0; if (connection_open) { if (cmd_stream) { if (! server) { bool send_close_cmd = true; if (cmd_stream->get_strbuf ()->connection_state_undefined ()) { if (fcntl (cmd_stream->get_strbuf ()->get_fid (), F_SETFL, O_NONBLOCK)) { _p_error ("tried to switch to non-blocking mode due to undefined connection state, but it did not work; not sending close command"); send_close_cmd = false; } } poll_for_errors (); if (send_close_cmd) cmd_stream->network_send_string ("sclose (sockets); __exit__;\n"); } cmd_stream->close (); if (! cmd_stream->good ()) { _p_error ("could not close command stream"); ret = -1; } } if (data_stream) { data_stream->close (); if (! data_stream->good ()) { _p_error ("could not close data stream"); ret = -1; } } connection_open = false; return ret; } else if (! pseudo_connection) { _p_error ("connection is not open"); return -1; } else return ret; } bool is_pseudo_connection (void) { return pseudo_connection; } bool is_server (void) { return server; } int connection_read_header (void) { return minimal_read_header (data_stream->get_istream (), swap, flt_fmt); } int connection_read_data (octave_value &tc) { return minimal_read_data (data_stream->get_istream (), tc, swap, flt_fmt); } bool is_open (void) { return connection_open; } const std::string &get_uuid (void) { return uuid; } int32_t peer_node_n; // -1 is unset, 0 is client private: octave_parallel_stream *cmd_stream; octave_parallel_stream *data_stream; bool connection_open; bool pseudo_connection; // for indicating own node in network std::string peer_name; // number of usable processor cores in peer, or in own machine if // this is a pseudoconnection; num_processors() returns an unsigned // long int, but there is no specific transefer function implemented // here for long int, and such large numbers probably don't occur // for nproc; supposed to be available (i.e. non-zero) for all // connections in the clients network variable; not necessary in the // servers network variables uint32_t nproc; // configurable, this information can be used by the client to // decide how many local processes should be spawned at the server; // not necessary in the servers network variables uint32_t nlocaljobs; bool server; std::string uuid; // for Octaves save and load functions bool global; bool swap; OCTAVE__MACH_INFO::float_format flt_fmt; std::string doc; }; class octave_parallel_network { public: typedef Array connarray; octave_parallel_network (void) : refcount (0), closed (false) { } octave_parallel_network (int n) : connections (dim_vector (n, 1), NULL), refcount (0), closed (false) { } void resize (int n) { connections.resize1 (n, NULL); } void add_connection (octave_parallel_connection *connection) { connections.resize1 (connections.numel () + 1, connection); } void insert_connection (octave_parallel_connection *connection, int idx) { connections(idx) = connection; connection->peer_node_n = idx; } bool is_connection (int idx) { return (bool) connections(idx); } int close (void) { if (closed) { _p_error ("network already closed"); return -1; } else { int ret = 0; for (int i = 0; i < connections.numel (); i++) if (connections(i) && connections(i)->close ()) ret = -1; if (ret) _p_error ("could not close network"); else closed = true; return ret; } } ~octave_parallel_network (void) { dlprintf ("pnetwork destructor called ...\n"); for (int i = 0; i < connections.numel (); i++) { dlprintf ("... checks that connections(%i) is not NULL ...\n", i); if (connections(i)) { dlprintf ("... and deletes it.\n"); delete connections(i); } } } const connarray &get_ref (void) { refcount++; return connections; } int release_ref (void) { return --refcount; } bool is_closed (void) { return closed; } private: connarray connections; OCTAVE__REFCOUNT refcount; bool closed; }; // This additional class is declared to circumvent const-ness of // octave_value::get_rep() without a . It contains the // members specific for the package, while the containing class // octave_parallel_connections contains the stuff related to // octave_base_value. class octave_parallel_connections_rep { friend class octave_parallel_connections; public: octave_parallel_connections_rep (octave_parallel_network *net, const char *auuid, bool i_am_server) : network (net), connections (net->get_ref ()), uuid (auuid), server (i_am_server), indexed (false) { subnet = connections; } // for indexing octave_parallel_connections_rep (octave_parallel_network *net, const char *auuid, bool i_am_server, octave_parallel_network::connarray &asubnet) : network (net), connections (net->get_ref ()), uuid (auuid), server (i_am_server), indexed (true) { subnet = asubnet; } ~octave_parallel_connections_rep (void) { dlprintf ("pconnections_rep destructor called, will request decr of network refcount and will check if it's <= 0 ...\n"); int tpdebug; if ((tpdebug = network->release_ref ()) <= 0) { dlprintf ("... since it is %i, will delete network\n", tpdebug); delete network; } } int close (void) { return network->close (); } // function to return the _whole_ net (even if this is a subnet), to // make it possible to construct a new octave_value with this octave_parallel_network *get_whole_network (void) { return network; } // oct-functions work with this const octave_parallel_network::connarray &get_connections (void) { return subnet; } bool is_server (void) { return server; } const octave_parallel_network::connarray &get_all_connections (void) { return connections; } private: octave_parallel_network *network; const octave_parallel_network::connarray &connections; octave_parallel_network::connarray subnet; std::string uuid; bool server; bool indexed; }; class octave_parallel_connections : public octave_base_value { public: void octave_parallel_register_type (void) { static bool type_registered = false; if (! type_registered) { register_type (); type_registered = true; } } octave_parallel_connections (octave_parallel_network *net, const char *auuid, bool i_am_server) : rep (new octave_parallel_connections_rep (net, auuid, i_am_server)) { octave_parallel_register_type (); } // for indexing octave_parallel_connections (octave_parallel_network *net, const char *auuid, bool i_am_server, octave_parallel_network::connarray &asubnet) : rep (new octave_parallel_connections_rep (net, auuid, i_am_server, asubnet)) { octave_parallel_register_type (); } ~octave_parallel_connections (void) { dlprintf ("pconnections destructor called, deletes pconnections_rep\n"); delete rep; } // Octave internal stuff octave_value do_index_op (const octave_value_list& idx, bool resize_ok = false); octave_value_list do_multi_index_op (int, const octave_value_list& idx) { return do_index_op (idx); } // copied from ov-base-mat octave_value subsref (const std::string& type, const std::list& idx) { octave_value retval; switch (type[0]) { case '(': retval = do_index_op (idx.front ()); break; case '{': case '.': { std::string nm = type_name (); error ("%s cannot be indexed with %c", nm.c_str (), type[0]); } break; default: panic_impossible (); } return retval.next_subsref (type, idx); } octave_value_list subsref (const std::string& type, const std::list& idx, int) { return subsref (type, idx); } bool is_constant (void) const { return true; } bool is_defined (void) const { return true; } bool is_true (void) const { return ! rep->network->is_closed (); } dim_vector dims (void) const { return rep->subnet.dims (); } void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const { octave_idx_type n = rep->connections.numel (); octave_idx_type sn = rep->subnet.numel (); indent (os); os << " "; if (sn < n) os << "subnet with " << sn << " of "; os << n << " nodes"; newline (os); os << "network id: " << rep->uuid.c_str (); newline (os); if (rep->network->is_closed ()) os << "----- closed -----"; else os << "----- open -----"; newline (os); for (octave_idx_type i = 0; i < sn; i++) { os << rep->subnet(i)->peer_node_n << ") "; // if (rep->subnet(i)->is_server ()) // os << "[server] "; // else // os << "[client] "; if (rep->subnet(i)->is_pseudo_connection ()) os << ""; else os << rep->subnet(i)->get_peer_name ().c_str (); newline (os); } } void print (std::ostream& os, bool pr_as_read_syntax = false) const { print_raw (os); } // Octave changeset bcd71a2531d3 (Jan 31st 2014) made // octave_base_value::print() non-const, after that this virtual // function is not re-defined by the above print() function. Having // both const and non-const print() here seems to work both with // Octave < and >= bcd71a2531d3 (print() is only called over the // parent class virtual function). void print (std::ostream& os, bool pr_as_read_syntax = false) { print_raw (os); } bool print_as_scalar (void) const { return true; } octave_parallel_connections_rep *get_rep (void) const { return rep; } private: // needed by Octave for register_type(), also used here in indexing octave_parallel_connections (void) : rep (new octave_parallel_connections_rep (new octave_parallel_network (), "", false)) { dlprintf ("pconnections default ctor called\n"); } octave_parallel_connections_rep *rep; DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; #endif // __OCT_PARALLEL_CONNECTION__ /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */ parallel-3.1.3/src/PaxHeaders.30520/undef-ah-octave.h0000644000000000000000000000013213331003466016745 xustar0030 mtime=1533282102.574478286 30 atime=1533282227.592946708 30 ctime=1533282233.633065964 parallel-3.1.3/src/undef-ah-octave.h0000644000175000017500000000070613331003466017146 0ustar00olafolaf00000000000000/* To be included at the top of config.h (by autoheader). Avoid warnings for redefining AH-generated preprocessor symbols of Octave. */ #ifdef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif #ifdef PACKAGE_NAME #undef PACKAGE_NAME #endif #ifdef PACKAGE_STRING #undef PACKAGE_STRING #endif #ifdef PACKAGE_TARNAME #undef PACKAGE_TARNAME #endif #ifdef PACKAGE_URL #undef PACKAGE_URL #endif #ifdef PACKAGE_VERSION #undef PACKAGE_VERSION #endif parallel-3.1.3/src/PaxHeaders.30520/select.cc0000644000000000000000000000013213331003466015414 xustar0030 mtime=1533282102.574478286 30 atime=1533282231.913032004 30 ctime=1533282233.633065964 parallel-3.1.3/src/select.cc0000644000175000017500000002152213331003466015614 0ustar00olafolaf00000000000000// Copyright (C) 2007-2018 Olaf Till // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; If not, see . #include #include #ifdef POSIX #include #else #include #include #include #endif #include #include #include "error-helpers.h" DEFUN_DLD (select, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{n}, @var{ridx}, @var{widx}, @var{eidx}] =} select (@var{read_fids}, @var{write_fids}, @var{except_fids}, @var{timeout}[, @var{nfds}])\n\ Calls Unix @code{select}, see the respective manual.\n\ \n\ The following interface was chosen:\n\ @var{read_fids}, @var{write_fids}, @var{except_fids}: vectors of stream-ids.\n\ @var{timeout}: seconds, negative for infinite.\n\ @var{nfds}: optional, default is Unix' FD_SETSIZE (platform specific).\n\ An error is returned if nfds or a filedescriptor belonging to a stream-id\n\ plus one exceeds FD_SETSIZE.\n\ Return values are:\n\ @var{n}: number of ready streams.\n\ @var{ridx}, @var{widx}, @var{eidx}: index vectors of ready streams in\n\ @var{read_fids}, @var{write_fids}, and @var{except_fids}, respectively.\n\ @end deftypefn") { /* This routine assumes that Octaves stream-id and the corresponding filedescriptor of the system are the same number. This should be the case in Octave >= 3.0.0. */ octave_value_list retval; int nargin = args.length (); int i, fd, fid, nfds, n, act, argc; double argtout, *fvec; timeval tout; timeval *timeout = &tout; ColumnVector read_fids, write_fids, except_fids; if (nargin == 4) nfds = FD_SETSIZE; else if (nargin == 5) { if (! args(4).is_real_scalar ()) { error ("select: 'nfds' must be a real scalar.\n"); return retval; } nfds = args(4).int_value (); if (nfds <= 0) { error ("select: 'nfds' should be greater than zero.\n"); return retval; } if (nfds > FD_SETSIZE) { error ("select: 'nfds' exceeds systems maximum given by FD_SETSIZE.\n"); return retval; } } else { error ("select: four or five arguments required.\n"); return retval; } if (! args(3).is_real_scalar ()) { error ("select: 'timeout' must be a real scalar.\n"); return retval; } if ((argtout = args(3).double_value ()) < 0) timeout = NULL; else { double ipart, fpart; fpart = modf (argtout, &ipart); tout.tv_sec = lrint (ipart); tout.tv_usec = lrint (fpart * 1000); } for (argc = 0; argc < 3; argc++) { if (! args(argc).OV_ISEMPTY ()) { if (! args(argc).OV_ISREAL ()) { error ("select: first three arguments must be real vectors.\n"); return retval; } if (args(argc).rows () != 1 && args(argc).columns () != 1) { error ("select: first three arguments must be real vectors.\n"); return retval; } switch (argc) { case 0: read_fids = ColumnVector (args(argc).vector_value ()); break; case 1: write_fids = ColumnVector (args(argc).vector_value ()); break; case 2: except_fids = ColumnVector (args(argc).vector_value ()); break; } } } fd_set rfds, wfds, efds; FD_ZERO (&rfds); FD_ZERO (&wfds); FD_ZERO (&efds); bool err; for (i = 0; i < read_fids.numel (); i++) { fid = lrint (read_fids(i)); SET_ERR (fd = OCTAVE__INTERPRETER__STREAM_LIST__LOOKUP (fid, "select") . file_number (), err); if (err || fd < 0) { error ("select: invalid file-id"); return retval; } if (fid >= FD_SETSIZE) { error ("select: filedescriptor >= FD_SETSIZE"); return retval; } FD_SET (fid, &rfds); } for (i = 0; i < write_fids.numel (); i++) { fid = lrint (write_fids(i)); SET_ERR (fd = OCTAVE__INTERPRETER__STREAM_LIST__LOOKUP (fid, "select") . file_number (), err); if (err || fd < 0) { error ("select: invalid file-id"); return retval; } if (fid >= FD_SETSIZE) { error ("select: filedescriptor >= FD_SETSIZE"); return retval; } FD_SET (fid, &wfds); } for (i = 0; i < except_fids.numel (); i++) { fid = lrint (except_fids(i)); SET_ERR (fd = OCTAVE__INTERPRETER__STREAM_LIST__LOOKUP (fid, "select") . file_number (), err); if (err || fd < 0) { error ("select: invalid file-id"); return retval; } if (fid >= FD_SETSIZE) { error ("select: filedescriptor >= FD_SETSIZE"); return retval; } FD_SET (fid, &efds); } if ((n = select (nfds, &rfds, &wfds, &efds, timeout)) == -1) { std::string err; switch (errno) { case EBADF: err = "EBADF"; break; case EINTR: err = "EINTR"; break; case EINVAL: err = "EINVAL"; break; default: err = "unknown error"; } error ("select: unix select returned error: %s\n", err.c_str ()); return retval; } if (nargout > 3) { for (i = 0, act = 0; i < except_fids.numel (); i++) if (FD_ISSET (lrint (except_fids(i)), &efds)) act++; RowVector eidx = RowVector (act); for (i = 0, fvec = eidx.fortran_vec (); i < except_fids.numel (); i++) if (FD_ISSET (lrint (except_fids(i)), &efds)) { *fvec = double (i + 1); fvec++; } retval(3) = eidx; } if (nargout > 2) { for (i = 0, act = 0; i < write_fids.numel (); i++) if (FD_ISSET (lrint (write_fids(i)), &wfds)) act++; RowVector widx = RowVector (act); for (i = 0, fvec = widx.fortran_vec (); i < write_fids.numel (); i++) if (FD_ISSET (lrint (write_fids(i)), &wfds)) { *fvec = double (i + 1); fvec++; } retval(2) = widx; } if (nargout > 1) { for (i = 0, act = 0; i < read_fids.numel (); i++) if (FD_ISSET (lrint (read_fids(i)), &rfds)) act++; RowVector ridx = RowVector (act); for (i = 0, fvec = ridx.fortran_vec (); i < read_fids.numel (); i++) if (FD_ISSET (lrint (read_fids(i)), &rfds)) { *fvec = double (i + 1); fvec++; } retval(1) = ridx; } retval(0) = n; return retval; } parallel-3.1.3/src/PaxHeaders.30520/parallel_generate_srp_data.cc0000644000000000000000000000013213331003466021460 xustar0030 mtime=1533282102.570478207 30 atime=1533282230.553005151 30 ctime=1533282233.633065964 parallel-3.1.3/src/parallel_generate_srp_data.cc0000644000175000017500000002276413331003466021671 0ustar00olafolaf00000000000000/* Copyright (C) 2015-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ #include "parallel-gnutls.h" static int assert_dir (std::string &path) { OCTAVE__SYS__FILE_STAT stat (path); if (! stat.is_dir () && mkdir (path.c_str (), 0700)) return -1; else return 0; } DEFUN_DLD (parallel_generate_srp_data, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} parallel_generate_srp_data (@var{username})\n\ @deftypefnx {Loadable Function} {} parallel_generate_srp_data (@var{username}, @var{options})\n\ Prompts for a password (press enter for a random password) and writes TLS-SRP authentication files into the directory given by:\n\ \n\ @code{fullfile (a = pkg (\"prefix\"), \"parallel-srp-data\")}\n\ \n\ Server files are placed in subdirectory @code{server}. By default, a\n\ client authentication file is placed in subdirectory\n\ @code{client}. The latter contains the given @var{username} and the\n\ cleartext password. You do not need this file if you prefer to be\n\ prompted for username and password at connection time. In this case,\n\ you can prevent the client authentication file from being written by\n\ passing as the argument @var{options} a structure with a value of\n\ @code{false} in the field @code{unattended}.\n\ \n\ For authentication, subdir @code{server}, and possibly subdir\n\ @code{client}, have to be placed together with their contents at the\n\ respective machines. They can either be placed under the directory\n\ given by:\n\ \n\ @code{fullfile (OCTAVE_HOME (), \"share\", \"octave\", \"parallel-srp-data\")}\n\ \n\ or -- which might be the same directory -- under:\n\ \n\ @code{fullfile (a = pkg (\"prefix\"), \"parallel-srp-data\")}\n\ \n\ Files in the former directory will take precedence over those in the\n\ latter. The contents of the files @code{passwd} and @code{user_passwd}\n\ (if present) must be kept secret.\n\ \n\ This function zeroizes sensitive data before releasing its memory. Due\n\ to usage of external libraries, however, it still can't be excluded\n\ that sensitive data is still on the swap device after application\n\ shutdown.\n\ \n\ @seealso{pconnect, pserver, reval, psend, precv, sclose, select_sockets}\n\ @end deftypefn") { std::string fname ("parallel_generate_srp_data"); octave_value_list retval; if (args.length () < 1 || args.length () > 2) { print_usage (); return retval; } // get username std::string username; CHECK_ERROR (username = args(0).string_value (), retval, "%s: first argument can not be converted to a string", fname.c_str ()); // default options bool clientfile (true); // get options, if any if (args.length () == 2) { octave_scalar_map options; CHECK_ERROR (options = args(1).scalar_map_value (), retval, "%s: could not convert second argument to scalar structure", fname.c_str ()); octave_value tmp; // write client data to file tmp = options.contents ("unattended"); if (tmp.is_defined ()) { CHECK_ERROR (clientfile = tmp.bool_value (), retval, "%s: could not convert option 'unattended' to bool", fname.c_str ()); } } // args.length () == 2 // define directories and filenames octave_value_list f_args (1); f_args(0) = octave_value ("prefix"); octave_value_list f_ret; CHECK_ERROR (f_ret = OCTAVE__FEVAL ("pkg", f_args, 1), retval, "%s: could not get prefix from pkg", fname.c_str ()); std::string basedir; CHECK_ERROR (basedir = f_ret(0).string_value (), retval, "%s: could not convert output of pkg ('prefix') to string)", fname.c_str ()); basedir = basedir + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "parallel-srp-data" + OCTAVE__SYS__FILE_OPS::dir_sep_str (); std::string serverdir = basedir + "server" + OCTAVE__SYS__FILE_OPS::dir_sep_str (); std::string clientdir = basedir + "client" + OCTAVE__SYS__FILE_OPS::dir_sep_str (); if (assert_dir (basedir)) { error ("%s: directory %s does not exist and can't be created, consider creating it manually", fname.c_str (), basedir.c_str ()); return retval; } if (assert_dir (serverdir)) { error ("%s: directory %s does not exist and can't be created, consider creating it manually", fname.c_str (), serverdir.c_str ()); return retval; } if (clientfile && assert_dir (clientdir)) { error ("%s: directory %s does not exist and can't be created, consider creating it manually", fname.c_str (), clientdir.c_str ()); return retval; } std::string passwd = serverdir + "passwd"; std::string passwd_conf = serverdir + "passwd.conf"; std::string user_passwd = clientdir + "user_passwd"; // get password; not supposed to be free'd again, don't do it sensitive_string user_password (getpass ("password (default is random password): ")); if (! user_password.good ()) { error ("%s: could not read password", fname.c_str ()); return retval; } if (user_password.get_size () == 0) { // no use making a random password if it is not written to a file if (! clientfile) { error ("%s: if the password is not provided by the user, option 'unattended' must not be false", fname.c_str ()); return retval; } // get a random password of 10 bytes, each restricted to 96 values user_password.fill (10); if (! user_password.good ()) { error ("%s: could not get random password", fname.c_str ()); return retval; } } // get random salt of 10 bytes, each restricted to 96 values sensitive_string salt (10); if (! salt.good ()) { error ("%s: could not get random salt", fname.c_str ()); return retval; } // let gnutls compute the srp verifier verifier v (username.c_str (), user_password.get_string (), &salt.get_val ()); if (! v.good ()) { error ("%s: could not generate verifier", fname.c_str ()); return retval; } // if desired, write client authentication information if (clientfile) { octave_parallel_stream cfio (new octave_parallel_file_streambuf (user_passwd.c_str (), O_WRONLY | O_CREAT | O_TRUNC, 0600)); if (! cfio.good ()) { error ("%s: could not open client file %s", fname.c_str (), user_passwd.c_str ()); return retval; } cfio.get_ostream () << username.c_str () << " " << user_password.get_string () << "\n"; cfio.close (); if (! cfio.good ()) { error ("%s: could not write client file", fname.c_str ()); return retval; } } // password not needed anymore, zero and free it (but only zero it // and not free it if it was made with 'getpass' user_password.free_val (); // write server passwd file or append if it exists std::string group_index ("1"); if (true) { srp_base64_encode v_enc (&(v.get_val ())); srp_base64_encode salt_enc (&(salt.get_val ())); if (! (v_enc.good () && salt_enc.good ())) return retval; octave_parallel_stream spfio (new octave_parallel_file_streambuf (passwd.c_str (), O_WRONLY | O_CREAT | O_APPEND, 0600)); if (! spfio.good ()) { error ("%s: could not open server passwd file %s", fname.c_str (), passwd.c_str ()); return retval; } spfio.get_ostream () << username.c_str () << ":" << v_enc.get_string () << ":" << salt_enc.get_string () << ":" << group_index.c_str () << "\n"; spfio.close (); if (! spfio.good ()) { error ("%s: could not write server passwd file", fname.c_str ()); return retval; } } // verifier and salt not needed anymore, zero and free them v.free_val (); salt.free_val (); // write server passwd.conf file srp_base64_encode prime_enc (&gnutls_srp_2048_group_prime); octave_parallel_stream scfio (new octave_parallel_file_streambuf (passwd_conf.c_str (), O_WRONLY | O_CREAT | O_TRUNC, 0600)); if (! scfio.good ()) { error ("%s: could not open server passwd.conf file %s", fname.c_str (), passwd_conf.c_str ()); return retval; } scfio.get_ostream () << group_index.c_str () << ":" << prime_enc.get_string () << ":" << (int) *((unsigned char *) gnutls_srp_2048_group_generator.data) << "\n"; scfio.close (); if (! scfio.good ()) { error ("%s: could not write server passwd.conf file", fname.c_str ()); return retval; } return retval; } parallel-3.1.3/src/PaxHeaders.30520/pserver.cc0000644000000000000000000000013213331003466015623 xustar0030 mtime=1533282102.570478207 30 atime=1533282227.764950104 30 ctime=1533282233.633065964 parallel-3.1.3/src/pserver.cc0000644000175000017500000011762213331003466016032 0ustar00olafolaf00000000000000/* Copyright (C) 2002 Hayato Fujiwara Copyright (C) 2010-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ // PKG_ADD: autoload ("pserver", "parallel_interface.oct"); // PKG_DEL: autoload ("pserver", "parallel_interface.oct", "remove"); #include #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // reported necessary for FreeBSD-8 #if HAVE_UNISTD_H #include #endif #include "parallel-gnutls.h" // Octave > 3.2.4 does not have these in a header file, but in // sighandlers.cc, and uses gnulib:: for these. So this is copied from // Octave-3.2.4. #define BLOCK_SIGNAL(sig, nvar, ovar) \ do \ { \ sigemptyset (&nvar); \ sigaddset (&nvar, sig); \ sigemptyset (&ovar); \ sigprocmask (SIG_BLOCK, &nvar, &ovar); \ } \ while (0) #if !defined (SIGCHLD) && defined (SIGCLD) #define SIGCHLD SIGCLD #endif // FIXME: Octave-3.2.4 had HAVE_POSIX_SIGNALS in config.h, newer // Octave has not (probably due to using gnulib?). We have not this // test in configure now, but assume HAVE_POSIX_SIGNALS defined. #define BLOCK_CHILD(nvar, ovar) BLOCK_SIGNAL (SIGCHLD, nvar, ovar) #define UNBLOCK_CHILD(ovar) sigprocmask (SIG_SETMASK, &ovar, 0) // #else // #define BLOCK_CHILD(nvar, ovar) ovar = sigblock (sigmask (SIGCHLD)) // #define UNBLOCK_CHILD(ovar) sigsetmask (ovar) static int assert_file (std::string &path) { OCTAVE__SYS__FILE_STAT stat (path); if (! stat.is_reg ()) return -1; else return 0; } /* children are not killed on parent exit; for that octave_child_list can not be used and an own SIGCHLD handler is needed */ static bool pserver_child_event_handler (pid_t pid, int ev) { return 1; // remove child from octave_child_list } void reval_loop (octave_parallel_stream &cstr) { dsprintf ("reval, trying to write and read dummy\n"); // send and read the final character of the initialization protocol // to and from the client char dummy = '\n'; cstr.get_ostream () << dummy; dsprintf ("reval, wrote dummy (%i)\n", dummy); cstr.get_istream () >> std::noskipws >> dummy; dsprintf ("reval, read dummy (%i)\n", dummy); if (! cstr.good ()) { error ("could not finish initialization"); _exit (1); } bool firsttime = true; dsprintf ("reval, entering loop\n"); while (true) // function does not return { std::string s; if (firsttime) { dsprintf ("reval, setting command to 'rehash ()' at first repetition of loop\n"); s = "rehash ()\n"; // this avoided some problems firsttime = false; } else { dsprintf ("reval loop, before network_recv_string\n"); if (cstr.network_recv_string (s)) { error ("error reading command"); _exit (1); } dsprintf ("reval loop, after successful network_recv_string\n"); } bool err; int p_err; SET_ERR (OCTAVE__EVAL_STRING (s, false, p_err, 0), err); dsprintf ("reval loop, after evaluating string\n"); uint32_t nl = 0; if (err) { dsprintf ("reval loop, evaluation caused error\n"); nl = 1; } else if (p_err) { dsprintf ("reval loop, p_err was set\n"); nl = 1; } if (nl) { dsprintf ("reval loop, before sending error indication\n"); if (cstr.network_send_4byteint (nl, true)) { error ("error sending error code"); _exit (1); } dsprintf ("reval loop, after successful sending error indication\n"); } else { dsprintf ("reval loop, no error, caring for Octave command number\n"); if (octave_completion_matches_called) octave_completion_matches_called = false; else command_editor::increment_current_command_number (); dsprintf ("reval loop, no error, after caring for Octave command number\n"); } } } static int check_and_write_pidfile (const char *fname, int pid) { int fd, ret, nread; while ((fd = open (fname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)) < 0 && errno == EINTR); if (fd < 0) return -1; struct flock fl; fl.l_type = F_WRLCK; fl.l_whence = SEEK_SET; fl.l_start = 0; fl.l_len = 0; while ((ret = fcntl (fd, F_SETLKW, &fl)) < 0 && errno == EINTR); if (ret < 0) { close (fd); return -1; } char b; while ((nread = read (fd, &b, 1)) < 0 && errno == EINTR); if (nread < 0 || nread == 1) { close (fd); return -1; } if (lseek (fd, 0, SEEK_SET)) { close (fd); return -1; } FILE *fstr; if (! (fstr = fdopen (fd, "w+"))) { close (fd); return -1; } if (fprintf (fstr, "%i", pid) < 0) { fclose (fstr); return -1; } if (fclose (fstr) == EOF) return -1; else return 0; } DEFUN_DLD (pserver, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} pserver ()\n\ @deftypefnx {Loadable Function} {} pserver (@var{options})\n\ This function starts a server of the parallel cluster and should be called once at any server machine.\n\ \n\ It is important to call this function in a way assuring that Octave is\n\ quit as soon as the function returns, i.e. call it e.g. like\n\ @code{octave --eval \"pserver\"} or @code{octave --eval \"pserver\n\ (struct ('fieldname', value))\"}.\n\ \n\ If a directory path corresponding to the current directory of the\n\ client exists on the server machine, it will be used as the servers\n\ current directory for the respective client (multiple clients are\n\ possible). Otherwise, @code{/tmp} will be used. The Octave functions\n\ the server is supposed to call and the files it possibly has to access\n\ must be available at the server machine. This can e.g. be achieved by\n\ having the server machine mount a network file system (which is\n\ outside the scope of this package documentation).\n\ \n\ The parent server process can only be terminated by sending it a\n\ signal. The pid of this process, as long as it is running, will be\n\ stored in the file @code{/tmp/.octave-.pid}.\n\ \n\ If a connection is accepted from a client, the server collects a\n\ network identifier and the names of all server machines of the network\n\ from the client. Then, connections are automatically established\n\ between all machines of the network. Data exchange will be possible\n\ between all machines (client or server) in both directions. Commands\n\ can only be sent from the client to any server.\n\ \n\ The opaque variable holding the network connections, in the same order\n\ as in the corresponding variable returned by @code{pconnect}, is\n\ accessible under the variable name @code{sockets} at the server\n\ side. Do not overwrite or clear this variable. The own server machine\n\ will also be contained at some index position of this variable, but\n\ will not correspond to a real connection. See @code{pconnect} for\n\ further information.\n\ \n\ @var{options}: structure of options; field @code{use_tls} is\n\ @code{true} by default (TLS with SRP authentication); if set to\n\ @code{false}, there will be no encryption or authentication. Field\n\ @code{auth_file} can be set to an alternative path to the file with\n\ authentication information (see below).\n\ \n\ The client and the server must both use or both not use TLS. If TLS is\n\ switched off, different measures must be taken to protect ports 12501\n\ and 12502 at the servers and the client against unauthorized access;\n\ e.g. by a firewall or by physical isolation of the network.\n\ \n\ For using TLS, authorization data must be present at the server\n\ machine. These data can conveniently be generated by\n\ @code{parallel_generate_srp_data}; the helptext of the latter function\n\ documents the expected location of these data.\n\ \n\ The SRP password will be sent over the encrypted TLS channel from the\n\ client to each server, to avoid permanently storing passwords at the\n\ server for server-to-server data connections. Due to inevitable usage\n\ of external libraries, memory with sensitive data can, however, be on\n\ the swap device even after shutdown of the application.\n\ \n\ @seealso{pconnect, reval, psend, precv, sclose, parallel_generate_srp_data, select_sockets}\n\ @end deftypefn") { // Contrary to what is done in the client side function connect.cc, // it is not necessarily always explicitely cared here for closing // of sockets and freeing of allocated memory in cases of // error. Since the processes exit in case of an internal error, // there is sometimes no need to do this. Exceptions may return to // the Octave prompt instead of exiting, but this is as good as // exiting provided the server was started in a way that leads to // exiting Octave as soon as the server returns. // // However, deallocation of anything which uses credentials has to // be carefully provided here also, since the destructor of the // ref-counted credentials must be called in the end to zero // sensitive data before deallocation. octave_value_list retval; std::string fname ("pserver"); if (args.length () > 1) { print_usage (); return retval; } // A negative integer might be sent as Octave data, and Octave // doesn't care about coding of negative integers. (I know, there // probably will never be a current C-compiler with something // different than twos complement, but the C-standard allows for // it.) if (octave_parallel_stream::signed_int_rep ()) { error ("This machine doesn't seem to use twos complement as negative integer representation. If you want this to be supported, please file a bug report."); return retval; } struct utsname utsname_buf; if (uname (&utsname_buf)) { error ("error calling uname()"); return retval; } std::string hostname (utsname_buf.nodename); std::string pidname ("/tmp/.octave-"); pidname = pidname + hostname + ".pid"; // default options bool use_gnutls = true; std::string cafile; // get options, if any if (args.length () == 1) { octave_scalar_map options; CHECK_ERROR (options = args(0).scalar_map_value (), retval, "%s: could not convert second argument to scalar structure", fname.c_str ()); octave_value tmp; // use TLS tmp = options.contents ("use_tls"); if (tmp.is_defined ()) { CHECK_ERROR (use_gnutls = tmp.bool_value (), retval, "%s: could not convert option 'use_tls' to bool", fname.c_str ()); } // custom authentication file tmp = options.contents ("auth_file"); if (tmp.is_defined ()) { CHECK_ERROR (cafile = tmp.string_value (), retval, "%s: could not convert option 'auth_file' to string", fname.c_str ()); } } // args.length () == 1 // check options integrity #ifndef HAVE_LIBGNUTLS if (use_gnutls) { error ("TLS not available"); return retval; } #endif if (! use_gnutls && cafile.length ()) warning ("no TLS used, option 'auth_file' has no effect"); // initialize exit function OCTAVE__FEVAL ("__pserver_exit__", octave_value (hostname), 0); int tp; if ((tp = fork ())) { if (tp == -1) error ("could not fork"); return retval; } // register exit function OCTAVE__FEVAL ("atexit", octave_value ("__pserver_exit__"), 0); /* write pidfile and mark for deletion. */ if (check_and_write_pidfile (pidname.c_str (), getpid ())) { std::cerr << "octave: " << hostname.c_str () << ": can't write pidfile, server possibly already running" << std::endl; exit (1); // clean_up_and_exit (1); } mark_for_deletion (pidname.c_str ()); std::cout << pidname.c_str () << std::endl; // avoid dumping octave_core if killed by a signal OCTAVE__FEVAL ("sigterm_dumps_octave_core", octave_value (0), 0); OCTAVE__FEVAL ("sighup_dumps_octave_core", octave_value (0), 0); /* Redirect stdin and stdout to /dev/null. */ if (! freopen ("/dev/null", "r", stdin)) { perror ("freopen"); exit (1); // clean_up_and_exit (1); } if (! freopen ("/dev/null", "w", stdout)) { perror ("freopen"); exit (1); // clean_up_and_exit (1); } std::string errname ("/tmp/octave_error-"); errname = errname + hostname.c_str () + ".log"; struct stat fstat; if (stat (errname.c_str (), &fstat) == 0) { std::string bakname ("/tmp/octave_error-"); bakname = bakname + hostname.c_str () + ".bak"; if (rename (errname.c_str (), bakname.c_str ())) { perror ("rename"); exit (1); // clean_up_and_exit (1); } } if (! freopen (errname.c_str (), "w", stderr)) { perror ("freopen"); exit (1); // clean_up_and_exit (1); } struct addrinfo *ai, hints; memset ((void *) &hints, 0, sizeof (hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; hints.ai_flags = AI_PASSIVE; if (getaddrinfo (NULL, "12502", &hints, &ai)) { perror ("getaddrinfo"); exit (1); // clean_up_and_exit (1); } int sock = socket (PF_INET, SOCK_STREAM, 0); if (sock == -1) { perror ("socket"); exit (1); // clean_up_and_exit (1); } if (bind (sock, ai->ai_addr, ai->ai_addrlen)) { perror ("bind"); exit (1); // clean_up_and_exit (1); } if (listen (sock, SOMAXCONN)) { perror ("listen"); exit (1); // clean_up_and_exit (1); } if (getaddrinfo (NULL, "12501", &hints, &ai)) { perror ("getaddrinfo"); exit (1); // clean_up_and_exit (1); } int dsock = socket (PF_INET, SOCK_STREAM, 0); if (dsock == -1) { perror ("socket"); exit (1); // clean_up_and_exit (1); } if (bind (dsock, ai->ai_addr, ai->ai_addrlen)) { perror ("bind"); exit (1); // clean_up_and_exit (1); } if (listen (dsock, SOMAXCONN)) { perror ("listen"); exit (1); // clean_up_and_exit (1); } freeaddrinfo (ai); int server_no = -1; // for debugging for(;;) { server_no++; dsprintf ("server_no: %i, trying to accept command stream\n", server_no); int asock = accept (sock, 0, 0); if (asock == -1) { perror ("accept"); exit (1); // clean_up_and_exit (1); } dsprintf ("%i: accepted command stream\n", server_no); /* Normal production daemon. Fork, and have the child process the connection. The parent continues listening. */ // remove non-existing children from octave_child_list OCTAVE_QUIT; sigset_t nset, oset, dset; BLOCK_CHILD (nset, oset); BLOCK_SIGNAL (SIGTERM, nset, dset); BLOCK_SIGNAL (SIGHUP, nset, dset); // restores all signals to state before BLOCK_CHILD #define RESTORE_SIGNALS(ovar) UNBLOCK_CHILD(ovar) int pid; if ((pid = fork ()) == -1) { perror ("fork"); exit (1); // clean_up_and_exit (1); } else if (pid == 0) { int tp; if ((tp = fork ())) { if (tp == -1) { perror ("fork"); _exit (1); } else _exit (0); } dsprintf ("%i: child after fork\n", server_no); close (sock); signal (SIGCHLD, SIG_DFL); signal (SIGTERM, SIG_DFL); signal (SIGQUIT, SIG_DFL); RESTORE_SIGNALS (oset); #ifdef HAVE_LIBGNUTLS struct __ccredguard { octave_parallel_gnutls_srp_client_credentials *__c; __ccredguard (void) : __c (NULL) { } ~__ccredguard (void) { if (__c && ! __c->check_ref ()) delete __c; } octave_parallel_gnutls_srp_client_credentials *__get (void) { return __c; } void __set (octave_parallel_gnutls_srp_client_credentials *__ic) { __c = __ic; } void __release (void) { __c = NULL; } } __ccg; octave_parallel_gnutls_srp_client_credentials *ccred; struct __scredguard { octave_parallel_gnutls_srp_server_credentials *__c; __scredguard (void) : __c (NULL) { } ~__scredguard (void) { if (__c && ! __c->check_ref ()) delete __c; } octave_parallel_gnutls_srp_server_credentials *__get (void) { return __c; } void __set (octave_parallel_gnutls_srp_server_credentials *__ic) { __c = __ic; } void __release (void) { __c = NULL; } } __scg; octave_parallel_gnutls_srp_server_credentials *scred; if (use_gnutls) { gnutls_global_init (); #ifdef HAVE_LIBGNUTLS_EXTRA gnutls_global_init_extra (); // for SRP parallel_gnutls_set_mem_functions (); #endif dsprintf ("%i: after initializing gnutls\n", server_no); // generate credentials if (! cafile.length ()) { #ifdef HAVE_OCTAVE_CONFIG_FCNS std::string octave_home = octave::config::octave_home (); #else extern std::string Voctave_home; std::string octave_home = Voctave_home; #endif cafile = octave_home + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "share" + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "octave" + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "parallel-srp-data" + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "server" + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "passwd"; if (assert_file (cafile)) { octave_value_list f_args (1); f_args(0) = octave_value ("prefix"); octave_value_list f_ret; CHECK_ERROR_EXIT1 (f_ret = OCTAVE__FEVAL ("pkg", f_args, 1), "%s: could not get prefix from pkg", fname.c_str ()); CHECK_ERROR_EXIT1 (cafile = f_ret(0).string_value (), "%s: could not convert output of pkg ('prefix') to string)", fname.c_str ()); cafile = cafile + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "parallel-srp-data" + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "server" + OCTAVE__SYS__FILE_OPS::dir_sep_str () + "passwd"; if (assert_file (cafile)) { error ("%s: no regular file found at default password file paths", fname.c_str ()); _exit (1); } } } else if (assert_file (cafile)) { error ("%s: no regular file found at password file path given by user", fname.c_str ()); _exit (1); } __scg.__set (scred = new octave_parallel_gnutls_srp_server_credentials (cafile)); dsprintf ("%i: after generating credentials\n", server_no); if (! __scg.__get ()->check_cred ()) { error ("%s: could not create credentials", fname.c_str ()); _exit (1); } } #endif // HAVE_LIBGNUTLS // determine own number of usable processor cores uint32_t nproc = num_processors (NPROC_CURRENT); // The servers command stream will not be inserted into a // connection object. octave_parallel_streambuf *cmd_strb; #ifdef HAVE_LIBGNUTLS if (use_gnutls) { dsprintf ("%i: will generate gnutls streambuf\n", server_no); cmd_strb = new octave_parallel_gnutls_streambuf (asock, scred, true); __scg.__release (); dsprintf ("%i: generated gnutls streambuf\n", server_no); } else #endif cmd_strb = new octave_parallel_socket_streambuf (asock, true); octave_parallel_stream cmd_str (cmd_strb); if (! cmd_str.good ()) { error ("could not create command stream"); _exit (1); } uint32_t nhosts; cmd_str.network_recv_4byteint (nhosts); dsprintf ("%i: received nhosts (%i), good: %i\n", server_no, nhosts, cmd_str.good ()); cmd_str.network_send_4byteint (nproc, true); dsprintf ("%i: sent nproc (%u), good: %i\n", server_no, nproc, cmd_str.good ()); uint32_t me; cmd_str.network_recv_4byteint (me); dsprintf ("%i: received me (%i), good: %i\n", server_no, me, cmd_str.good ()); std::string uuid; cmd_str.network_recv_string (uuid); dsprintf ("%i: received uuid (%s), good: %i\n", server_no, uuid.c_str (), cmd_str.good ()); if (! cmd_str.good ()) // check before using the received 'nhosts' { error ("communication error in initialization"); _exit (1); } Array hosts (dim_vector (nhosts, 1)); for (uint32_t i = 0; i < nhosts; i++) { cmd_str.network_recv_string (hosts(i)); dsprintf ("%i: received hostname no %i (%s)\n", server_no, i, hosts(i).c_str ()); } dsprintf ("will now change name of error file\n"); errname = std::string ("/tmp/octave_error-") + hostname.c_str () + "_" + uuid.c_str () + ".log"; if (stat (errname.c_str (), &fstat) == 0) { std::string bakname ("/tmp/octave_error-"); bakname = bakname + hostname.c_str () + "_" + uuid.c_str () + ".bak"; if (rename (errname.c_str (), bakname.c_str ())) { perror ("rename"); _exit (1); } } if (! freopen (errname.c_str (), "w", stderr)) { perror ("freopen"); _exit (1); } std::string directory; cmd_str.network_recv_string (directory); dsprintf ("%i: received directory (%s)\n", server_no, directory.c_str ()); #define BUFLEN 1024 struct __pwguard { char *__pw; int __len; __pwguard (int __alen) : __pw (new char[__alen]), __len (__alen) { } void __free (void) { if (__pw) { memset ((void *) __pw, 0, __len); delete [] __pw; __pw = NULL; } } ~__pwguard (void) { __free (); } char *__get (void) { return __pw; } } __pwg (BUFLEN); if (use_gnutls) { cmd_str.network_recv_string (__pwg.__get (), BUFLEN); if (me == nhosts) // we won't need it __pwg.__free (); dsprintf ("%i: received password (%s)\n", server_no, __pwg.__get ()); } if (! cmd_str.good ()) { error ("communication error in initialization"); _exit (1); } // client may shut down before starting data connections (if // it was unable to establish all command connections) struct pollfd pfd[2]; pfd[0].fd = asock; pfd[0].events = POLLIN | POLLHUP; // POLLHUP meaningless here? pfd[0].revents = 0; pfd[1].fd = dsock; pfd[1].events = POLLIN; // will be set if accept is possible pfd[1].revents = 0; if (poll (pfd, 2, -1) == -1) { error ("error in poll()"); _exit (1); } if (pfd[0].revents) { error ("unexpected event at command socket"); _exit (1); } octave_parallel_network *network; struct __netwguard { octave_parallel_network *__n; __netwguard (octave_parallel_network *__an) : __n (__an) { __n->get_ref (); } ~__netwguard (void) { if (__n->release_ref () <= 0) delete __n; } } __ng (network = new octave_parallel_network (nhosts + 1)); for (uint32_t i = 0; i < me; i++) { // recv; dsprintf ("%i: trying to accept data connection, %i\n", server_no, i); int not_connected = 1; for (int j = 0; j < N_CONNECT_RETRIES; j++) { struct sockaddr_in rem_addr; socklen_t addrlen = sizeof (rem_addr); int adsock = accept (dsock, (sockaddr *) &rem_addr, &addrlen); if (adsock == -1) { perror ("accept, data stream"); _exit (1); } dsprintf ("server %i, host %i, retry %i, accept successful\n", server_no, i, j); if (addrlen > sizeof (rem_addr)) { perror ("accept, data stream, address buffer to short"); _exit (1); } struct __sockguard { __sockguard (int __isock) { __sock = __isock; } ~__sockguard (void) { if (__sock > -1) close (__sock); } void __release (void) { __sock = -1; } int __sock; } __sockg (adsock); #define HOSTNAMEBUFLEN 257 char peername[HOSTNAMEBUFLEN]; if (getnameinfo ((sockaddr *) &rem_addr, addrlen, (char *) peername, HOSTNAMEBUFLEN, NULL, 0, 0)) { error ("getnameinfo returned an error"); _exit (1); } octave_parallel_connection *conn = new octave_parallel_connection (peername, true, uuid.c_str ()); // you don't know the position to insert the // connection (protecting it) yet, an exception may // be thrown before you know it struct __connguard { __connguard (octave_parallel_connection *__ipt) { __pt = __ipt; } ~__connguard (void) { if (__pt) delete __pt; } void __set (octave_parallel_connection *__ipt) { __pt = __ipt; } octave_parallel_connection *__pt; void __release (void) { __pt = NULL; } } __conng (conn); #ifdef HAVE_LIBGNUTLS if (use_gnutls) { conn->insert_data_stream (new octave_parallel_stream (new octave_parallel_gnutls_streambuf (adsock, scred, true))); dsprintf ("server %i, host %i, retry %i, generated gnutls streambuf\n", server_no, i, j); } else #endif conn->insert_data_stream (new octave_parallel_stream (new octave_parallel_socket_streambuf (adsock, true))); __sockg.__release (); if (! conn->get_data_stream ()->good ()) { error ("could not create data stream to %s", peername); _exit (1); } std::string duuid; conn->get_data_stream ()->network_recv_string (duuid); dsprintf ("server %i, host %i, retry %i, received uuid (%s)\n", server_no, i, j, duuid.c_str ()); uint32_t host_n; conn->get_data_stream ()->network_recv_4byteint (host_n); dsprintf ("server %i, host %i, retry %i, received host_n (%i)\n", server_no, i, j, host_n); if (! conn->get_data_stream ()->good ()) { error ("communication error in initialization"); _exit (1); } if (uuid.compare (duuid)) { // a different call to 'connect', i.e. a different network conn->get_data_stream ()->network_send_4byteint (-1); if (conn->delete_data_stream ()) { error ("could not delete data stream"); _exit (1); } dsprintf ("server %i, host %i, retry %i, sent result -1\n", server_no, i, j); sleep (1); } else if (me <= host_n || network->is_connection (host_n)) { // we should never get here (since duuid == uuid) conn->get_data_stream ()->network_send_4byteint (-2); error ("server %i, host %i, retry %i, internal error, unexpected host id %i, is_connection(host id): %i", server_no, i, j, host_n, network->is_connection (host_n)); _exit (1); } else { conn->get_data_stream ()->network_send_4byteint (0); int err = conn->connection_read_header (); minimal_write_header (conn->get_data_stream ()->get_ostream ()); if (err || ! conn->get_data_stream ()->good ()) { error ("communication error in initialization"); _exit (1); } network->insert_connection (conn, host_n); __conng.__release (); not_connected = 0; dsprintf ("server %i, host %i, retry %i, good result sent, header read, header written and data stream good, breaking\n", server_no, i, j); break; } } if (not_connected) { error ("maximum number of connect retries exceeded"); _exit (-1); } } close (dsock); // a pseudo-connection, representing the own node in the network octave_parallel_connection *conn = new octave_parallel_connection (true, uuid.c_str ()); network->insert_connection (conn, me); dsprintf ("server %i inserted pseudoconnection at %i\n", server_no, me); // store number of available processor cores at the own // machine, although this is not necessary (but we have this // information here ...) conn->set_nproc (nproc); #ifdef HAVE_LIBGNUTLS if (use_gnutls && me < nhosts) { const char *username = static_cast(cmd_strb)-> server_get_username (); dsprintf ("server %i determined username %s from command stream, will now allocate client credentials (for data connections) with this username and password %s\n", server_no, username, __pwg.__get ()); __ccg.__set (ccred = new octave_parallel_gnutls_srp_client_credentials (username, __pwg.__get ())); } #endif for (uint32_t i = me + 1; i <= nhosts; i++) { // connect; dsprintf ("connect, server %i, host %i\n", server_no, i); struct addrinfo *ai = NULL, hints; memset ((void *) &hints, 0, sizeof (hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; hints.ai_flags = 0; if (getaddrinfo (hosts(i - 1).c_str (), "12501", &hints, &ai)) { error ("getaddrinfo returned an error"); _exit (1); } struct __aiguard { __aiguard (struct addrinfo *__iai) { __ai = __iai; } ~__aiguard (void) { if (__ai) freeaddrinfo (__ai); } struct addrinfo *__ai; } __aig (ai); int not_connected = 1; for (int j = 0; j < N_CONNECT_RETRIES; j++) { int dsock = socket (PF_INET, SOCK_STREAM, 0); if (dsock == -1) { perror ("socket"); _exit (1); } struct __sockguard { __sockguard (int __isock) { __sock = __isock; } ~__sockguard (void) { if (__sock > -1) close (__sock); } void __release (void) { __sock = -1; } int __sock; } __sockg (dsock); if (connect (dsock, ai->ai_addr, ai->ai_addrlen) == 0) { dsprintf ("connect, server %i, host %i, retry %i, connect succesful\n", server_no, i, j); octave_parallel_connection *conn = new octave_parallel_connection (hosts(i - 1).c_str (), true, uuid.c_str ()); network->insert_connection (conn, i); #ifdef HAVE_LIBGNUTLS if (use_gnutls) { conn->insert_data_stream (new octave_parallel_stream (new octave_parallel_gnutls_streambuf (dsock, ccred, false))); __ccg.__release (); dsprintf ("connect, server %i, host %i, retry %i, generated gnutls streambuf\n", server_no, i, j); } else #endif conn->insert_data_stream (new octave_parallel_stream (new octave_parallel_socket_streambuf (dsock, false))); __sockg.__release (); if (! conn->get_data_stream ()->good ()) { error ("could not create data stream to %s", hosts(i - 1).c_str ()); _exit (1); } conn->get_data_stream ()-> network_send_string (uuid.c_str ()); dsprintf ("connect, server %i, host %i, retry %i, uuid written (%s)\n", server_no, i, j, uuid.c_str ()); conn->get_data_stream ()->network_send_4byteint (me, true); dsprintf ("connect, server %i, host %i, retry %i, 'me' written (%i)\n", server_no, i, j, me); int32_t res; conn->get_data_stream ()->network_recv_4byteint (res); if (! conn->get_data_stream ()->good ()) { error ("communication error in initialization"); _exit (1); } if (res == -1) { if (conn->delete_data_stream ()) { error ("could not delete data stream"); _exit (1); } dsprintf ("connect, server %i, host %i, retry %i, sleeping after bad result\n", server_no, i, j); usleep (5000); } else if (res) { error ("unexpected error in remote server"); _exit (1); } else { minimal_write_header (conn->get_data_stream ()->get_ostream ()); if (conn->connection_read_header () || ! conn->get_data_stream ()->good ()) { error ("communication error in initialization"); _exit (1); } not_connected = 0; dsprintf ("connect, server %i, host %i, retry %i, good result read, header written and read and datastream good, breaking\n", server_no, i, j); break; } } else if (errno != ECONNREFUSED && errno != EINTR) { perror ("connect"); break; } else usleep (5000); } if (not_connected) { error ("unable to connect to %s", hosts(i - 1).c_str ()); _exit (1); } } octave_parallel_connections *conns = new octave_parallel_connections (network, uuid.c_str (), true); octave_value sockets (conns); __pwg.__free (); #ifdef HAVE_OCTAVE_INTERPRETER_H OCTAVE__INTERPRETER::the_interpreter () -> interactive (false); #else interactive = false; #endif // install 'sockets' as Octave variable OCTAVE__INTERPRETER__SYMBOL_TABLE__ASSIGN ("sockets", sockets); dsprintf ("'sockets' installed\n"); int cd_ok = octave_env::chdir (directory.c_str ()); if (! cd_ok) { octave_env::chdir ("/tmp"); dsprintf ("performed chdir to /tmp\n"); } else dsprintf ("performed chdir to %s\n", directory.c_str ()); dsprintf ("calling function reval_loop\n"); reval_loop (cmd_str); // does not return } // parent waitpid (pid, NULL, 0); // child with pid has forked another child // FIXME: forgotten how this is organized in Octave, find it out // again and at least make a comment which better explains it. OCTAVE_CHILD_LIST insert (pid, pserver_child_event_handler); RESTORE_SIGNALS (oset); close (asock); } // This code is currently not reached since the server parent // process can only be killed by a signal. close (sock); exit (1); // clean_up_and_exit (1); // Silence compiler warning. exit (0); } parallel-3.1.3/src/PaxHeaders.30520/p-connection.cc0000644000000000000000000000013213331003466016531 xustar0030 mtime=1533282102.566478128 30 atime=1533282102.566478128 30 ctime=1533282233.633065964 parallel-3.1.3/src/p-connection.cc0000644000175000017500000001017013331003466016726 0ustar00olafolaf00000000000000/* Copyright (C) 2015-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ #include #include #include #include "parallel-gnutls.h" NO_INSTANTIATE_ARRAY_SORT (octave_parallel_connection *); INSTANTIATE_ARRAY (octave_parallel_connection *, OCTAVE_API); // at 'p' 37 bytes must be available int oct_parallel_store_unique_identifier (char *p) { std::ifstream ifs ("/proc/sys/kernel/random/uuid"); p[0] = '\0'; ifs.getline (p, 37); ifs.close (); if (ifs.bad () || strlen (p) != 36) { error ("could not read uuid"); return -1; } else return 0; } int octave_parallel_connection::wait_for_errors_or_data (void) { if (! cmd_stream) { _p_error ("can't poll since no command stream present"); return -1; } if (! data_stream) { _p_error ("can't poll since no data stream present"); return -1; } if (! cmd_stream->get_strbuf ()->good ()) { _p_error ("can't poll since command stream not good"); return -1; } if (! data_stream->get_strbuf ()->good ()) { _p_error ("can't poll since data stream not good"); return -1; } struct pollfd pfd[2]; pfd[0].fd = cmd_stream->get_strbuf ()->get_fid (); pfd[0].events = POLLIN; pfd[0].revents = 0; pfd[1].fd = data_stream->get_strbuf ()->get_fid (); pfd[1].events = POLLIN; pfd[1].revents = 0; int ret = 0; // block until something is readable if (poll (pfd, 2, -1) == -1) { _p_error ("error in poll()"); return (-1); } if (pfd[0].revents) ret = poll_for_errors (); return ret; } DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_parallel_connections, "parallel cluster connections", "pconnections") octave_value octave_parallel_connections::do_index_op (const octave_value_list& idx, bool resize_ok) { octave_value err_retval; octave_idx_type n_idx = idx.length (); switch (n_idx) { case 0: // but actually this seems to be handled before, directly, by Octave return octave_value (this, true); case 2: { idx_vector i; bool err; SET_ERR (i = idx(1).index_vector (), err); if (err || ! i.is_colon ()) { error ("only colon allowed as second index"); return err_retval; } } case 1: { idx_vector i; CHECK_ERROR (i = idx(0).index_vector (), err_retval, "invalid index"); if (i.is_colon ()) return octave_value (this, true); if (! i.length ()) return octave_value (new octave_parallel_connections ()); octave_idx_type n = rep->subnet.numel (); if (i.extent (n) != n) { error ("index out of range"); return err_retval; } octave_idx_type len = i.length (); if (i.IDXVECTOR_ISVECTOR ()) { if (i.sorted (true).length () < len) { error ("index not unique"); return err_retval; } } octave_parallel_network::connarray nsubnet (dim_vector (len, 1)); i.index (rep->subnet.data (), n, nsubnet.fortran_vec ()); return octave_value (new octave_parallel_connections (rep->network, rep->uuid.c_str (), rep->server, nsubnet)); } default: error ("no more than 2 indices possible for this type"); return err_retval; } } parallel-3.1.3/src/PaxHeaders.30520/reval.cc0000644000000000000000000000013213331003466015246 xustar0030 mtime=1533282102.570478207 30 atime=1533282228.448963609 30 ctime=1533282233.633065964 parallel-3.1.3/src/reval.cc0000644000175000017500000001227713331003466015455 0ustar00olafolaf00000000000000/* Copyright (C) 2002 Hayato Fujiwara Copyright (C) 2010-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ // PKG_ADD: autoload ("reval", "parallel_interface.oct"); // PKG_DEL: autoload ("reval", "parallel_interface.oct", "remove"); #include #include #include #include #include #include #include #include #include #include #include #include #include #include "parallel-gnutls.h" DEFUN_DLD (reval, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} reval (@var{commands}, @var{connections})\n\ Evaluate @var{commands} at all remote hosts specified by @var{connections}.\n\ \n\ This function can only be successfully called at the client\n\ machine. @var{commands} must be a string containing Octave commands\n\ suitable for execution with Octaves @code{eval()} function. See\n\ @code{pconnect} for a description of the @var{connections}\n\ variable. @var{connections} can contain all connections of the\n\ network, a subset of them, or a single connection. The local machine\n\ (client), if contained in @var{connections}, is\n\ ignored. @var{commands} is executed in the same way at each specified\n\ machine.\n\ \n\ @seealso{pconnect, pserver, psend, precv, sclose, parallel_generate_srp_data, select_sockets}\n\ @end deftypefn") { std::string fname ("reval"); octave_value retval; if (args.length () != 2 || args(1).type_id () != octave_parallel_connections::static_type_id ()) { print_usage (); return retval; } octave_value val = args(0); charMatrix cm; CHECK_ERROR (cm = val.char_matrix_value (), retval, "%s: could not convert first argument to char matrix", fname.c_str ()); int rows = val.rows (); int cols = val.columns (); const octave_base_value &rep = args(1).get_rep (); const octave_parallel_connections &cconns = dynamic_cast (rep); octave_parallel_connections_rep *conns = cconns.get_rep (); int nconns = conns->get_connections ().numel (); if (conns->get_whole_network ()->is_closed ()) { error ("%s: network is closed", fname.c_str ()); return retval; } if (conns->is_server ()) { error ("%s: 'reval' can't be called at the server side", fname.c_str ()); return retval; } inthandler_dont_restart_syscalls __inthandler_guard__; // check each connection before a command is sent over any if (nconns < conns->get_all_connections ().numel ()) // it's a subnet for (int i = 0; i < nconns; i++) if (conns->get_connections ()(i)->is_pseudo_connection ()) { error ("%s: using a subnet and client was given as one of the servers (index %i)", fname.c_str (), i + 1); return retval; } bool command_errors = false, stream_errors = false; int err; for (int i = 0; i < nconns; i++) { if (conns->get_connections ()(i)->is_pseudo_connection ()) continue; if ((err = conns->get_connections ()(i)->poll_for_errors ())) { if (err > 0) { _p_error ("%s: a previous command at server with index %i caused an error", fname.c_str (), i + 1); command_errors = true; } else // err < 0 { _p_error ("%s: communication error with server with index %i", fname.c_str (), i + 1); stream_errors = true; } } } if (stream_errors) conns->close (); if (stream_errors || command_errors) { error ("error in reval"); return retval; } std::string command (cols + 1, '\n'); // all but the last '\n' will // be overwritten for (int i = 0; i < nconns; i++) { if (conns->get_connections ()(i)->is_pseudo_connection ()) continue; for (int j = 0; j < rows; j++) { command.replace (0, cols, cm.extract (j, 0, j, cols - 1).data (), cols); if (conns->get_connections ()(i)->get_cmd_stream ()-> network_send_string (command.c_str ())) { conns->close (); error ("%s: error sending command to server with index %i", fname.c_str (), i + 1); return retval; } } } return retval; } /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */ parallel-3.1.3/src/PaxHeaders.30520/p-streams.h0000644000000000000000000000013213331003466015712 xustar0030 mtime=1533282102.566478128 30 atime=1533282227.616947181 30 ctime=1533282233.633065964 parallel-3.1.3/src/p-streams.h0000644000175000017500000005331713331003466016121 0ustar00olafolaf00000000000000/* Copyright (C) 2015-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ #ifndef __OCT_PARALLEL_STREAMS__ #define __OCT_PARALLEL_STREAMS__ #ifdef HAVE_LIBGNUTLS #include #ifdef HAVE_LIBGNUTLS_EXTRA #include #endif #endif #include #include #include #include #include #include enum encryption_type { ENCR_RAW, // bare sockets ENCR_TLS_SRP // gnutls TLS SRP }; #define PROTOCOL_VERSION 1 /* Although we use the standard file format, we can't rely on gnutls_srp_set_server_credentials_file(), since current gnutls uses standard C library streams to read the files (external user space buffers) and own automatic variables which are not zero'ed to hold the sensitive data. */ #ifdef HAVE_LIBGNUTLS extern "C" int octave_parallel_server_credentials_callback (gnutls_session_t session, const char *username, gnutls_datum_t *salt, gnutls_datum_t *verifier, gnutls_datum_t *g, gnutls_datum_t *n); #endif // It is better to have classes for handling errors in input and // output. For some tasks we can't use default standard C++ // io-classes: file-io with sensitive data should not be buffered, // sockets have a system file-descriptor in the first place (and on // some systems 'read' and 'write' may not work for them), and gnutls // connections have special functions for sending and receiving. On // the other hand, it is necessary to have a std::ostream and a // std::istream for the connection, since Octaves functions for saving // and loading data require them. // // To address these related problems, a common parent class, derived // from std::streambuf, and several derived classes are declared // here. Also, a class is provided which takes one of these // streambuf objects and also contains a std::ostream and a // std::istream which reference the streambuf object. // parent class class octave_parallel_streambuf : public std::streambuf { public: octave_parallel_streambuf (void) : readable (false), writeable (false), fid (-1), store_errno (0) { // no character in the one-character-wide buffer at the beginning setg (&inbuf, (&inbuf) + 1, (&inbuf) + 1); } virtual ~octave_parallel_streambuf (void) { inbuf = '\0'; } virtual bool good (void) = 0; virtual bool connection_state_undefined (void) { return false; } virtual void set_connection_state_undefined (void) { } void close (void) { if (fid >= 0) { int ret; // don't repeat interrupted close() ret = do_close (); if (ret == -1) store_errno = errno; fid = -1; } } ssize_t write (const void *buf, size_t count) { if (! good ()) return -1; if (fid < 0) return -1; if (count == 0) return 0; // if nothing needs to be written, there's no need to // risk write() still being interrupted by a signal ssize_t ret; size_t left = count; // If write returns zero though count is positive, the reason must // be something different than being interrupted by a signal, // since in the latter case write would return -1 if no data was // written at all. do { if ((ret = do_write ((char *) buf + count - left, left)) > 0) left -= ret; } while (left && ret > 0); // don't repeat interrupted write() // while (left && // ((ret == -1 && errno == EINTR) || // ret > 0)); if (ret == -1) store_errno = errno; else if (left) store_errno = -1; if (store_errno) return -1; else return count; } virtual int gnutls_write_alert_for_flushing (void) { if (! good () || fid < 0) return -1; else return 0; } ssize_t read (void *buf, size_t count) { if (! good ()) return -1; if (fid < 0) return -1; if (count == 0) return 0; int ndiff = 0; if (gptr () != egptr ()) { *((char *) buf) = *(gptr ()); gbump (1); buf = (void *)(((char *) buf) + 1); count--; ndiff = 1; } int ret = read_directly (buf, count); if (ret > -1) ret += ndiff; return ret; } bool readable; bool writeable; int get_fid (void) { return fid; } // redefined streambuf virtual functions std::streamsize xsputn (const char *buf, std::streamsize count) { ssize_t ret = write ((const void *) buf, count); return ret >= 0 ? ret : 0; } int overflow (int c = traits_type::eof ()) { if (c != traits_type::eof ()) { traits_type::char_type tc = traits_type::to_char_type (c); if (write ((void *) &tc, sizeof (traits_type::char_type)) == -1) return traits_type::eof (); } return traits_type::to_int_type (c); } std::streamsize xsgetn (char *buf, std::streamsize count) { ssize_t ret = read ((void *) buf, count); return ret >= 0 ? ret : 0; } // the only member capable of storing something in the input buffer; // and the only reading member which never increases gptr() int underflow (void) { if (gptr () != egptr ()) return traits_type::to_int_type (*(gptr ())); else { if (read_directly ((void *) eback (), 1) == -1) return traits_type::to_int_type (traits_type::eof ()); else { gbump (-1); return traits_type::to_int_type (*(gptr ())); } } } int uflow (void) { if (gptr () != egptr ()) { gbump (1); return traits_type::to_int_type (*(gptr () - 1)); } else { traits_type::char_type ret; if (read_directly ((void *) &ret, sizeof (traits_type::char_type)) == -1) return traits_type::to_int_type (traits_type::eof ()); else return traits_type::to_int_type (ret); } } int network_send_4byteint (uint32_t v, bool) { uint32_t t = htonl (v); write ((void *) &t, 4); if (good ()) return 0; else return -1; } int network_recv_4byteint (uint32_t &v) { uint32_t t; read ((void *) &t, 4); if (! good ()) return -1; v = ntohl (t); return 0; } int network_send_4byteint (int32_t v) { if (signed_int_rep () && v < 0) { once_gripe_neg_int_rep (); return -1; } union { int32_t s; uint32_t u; } cast; cast.s = v; return network_send_4byteint (cast.u, true); } int network_recv_4byteint (int32_t &v) { uint32_t t; union { int32_t s; uint32_t u; } cast; read ((void *) &t, 4); if (! good ()) return -1; cast.u = ntohl (t); v = cast.s; if (signed_int_rep () && v < 0) { once_gripe_neg_int_rep (); return -1; } return 0; } int network_send_string (const char *s) { uint32_t l = strlen (s); uint32_t t = htonl (l); write ((void *) &t, 4); write ((const void *) s, l); if (good ()) return 0; else return -1; } int network_recv_string (char *s, uint32_t maxl) { uint32_t l, t; read ((void *) &t, 4); if (! good ()) return -1; l = ntohl (t); if (l > maxl - 1) { _p_error ("string to be received would be longer than buffer"); return -1; } s[l] = '\0'; read ((void *) s, l); if (good ()) return 0; else return -1; } int network_recv_string (std::string &str) { uint32_t l, t; read ((void *) &t, 4); if (! good ()) return -1; l = ntohl (t); struct __bufguard { __bufguard (octave_idx_type __l) : __buf (new char[__l]) {} ~__bufguard (void) { delete [] __buf; } char* __get (void) { return __buf; } char *__buf; } __bufg (l); read (__bufg.__get (), l); std::string tstr (__bufg.__get (), l); str = tstr; if (good ()) return 0; else return -1; } static int signed_int_rep (void) { // I know this is paranoid, and that current Octave itself just // relies on twos complement in saving/loading signed integers. static int ret = -1; if (ret == -1) { union { uint32_t u; int32_t s; } t; t.s = -1; if (t.u != 0xFFFFFFFF) ret = 1; else ret = 0; } return ret; } protected: int fid; int store_errno; virtual ssize_t do_write (const void *buf, size_t count) = 0; virtual ssize_t do_read (void *buf, size_t count) = 0; virtual int do_close (void) = 0; private: ssize_t read_directly (void *buf, size_t count) { if (! good ()) return -1; if (fid < 0) return -1; if (count == 0) return 0; // if nothing needs to be written, there's no need to // risk read() still being interrupted by a signal ssize_t ret; size_t left = count; // If read returns zero though count is positive, the reason must // be something different than being interrupted by a signal, // since in the latter case read would return -1 if no data was // written at all. do { if ((ret = do_read ((char *) buf + count - left, left)) > 0) left -= ret; } while (left && ret > 0); // don't repeat interrupted read() // while (left && // ((ret == -1 && errno == EINTR) || // ret > 0)); if (ret == -1) store_errno = errno; else if (left) store_errno = -1; if (store_errno) return -1; else return count; } // We need to provide an input buffer of at least one character to // be able to implement underflow(), needed by sgetc(), possibly // needed by istream.getline(). This buffer must be zero'ed at // destruction. char inbuf; void once_gripe_neg_int_rep (void) { static bool first_time = true; if (first_time) { _p_error ("This machine doesn't seem to use twos complement as negative integer representation. If you want this to be supported, please file a bug report."); first_time = false; } } }; // class octave_parallel_streambuf // To avoid user space buffers, provided by external libraries, which // can not be zero'ed after use, we have to directly use system calls // for reading and writing sensitive data from/to files. Luckily, for // this small amount of file-io we don't need to construct a custom // user space buffer. class octave_parallel_file_streambuf : public octave_parallel_streambuf { public: octave_parallel_file_streambuf (const char *path, int flags, mode_t mode = 0) { while ((fid = open (path, flags, mode)) == -1 && errno == EINTR); if (fid == -1) store_errno = errno; else { // care is needed here, one of the flag constants can // represent the value zero (O_RDONLY on my system), so that // checking for (flags & flag_constant) does not work if ((O_RDONLY == 0 && ! (flags & O_WRONLY)) || (O_RDONLY && flags & (O_RDONLY | O_RDWR))) readable = true; if ((O_WRONLY == 0 && ! (flags & O_RDONLY)) || (O_WRONLY && flags & (O_WRONLY | O_RDWR))) writeable = true; } } ~octave_parallel_file_streambuf (void) { if (fid >= 0) while (::close (fid) == -1 && errno == EINTR); } bool good (void) { return (store_errno == 0); } protected: ssize_t do_read (void *buf, size_t count) { return ::read (fid, buf, count); } ssize_t do_write (const void *buf, size_t count) { return ::write (fid, buf, count); } int do_close (void) { return ::close (fid); } }; // class octave_parallel_file_streambuf #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_PSSTREAMBUF \ BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_1; \ undefined_connection_state = true; \ octave_rethrow_exception (); \ BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_2 // TCP sockets without authentication or encryption, as an alternative // to encrypted connections (currently only TLS-SRP), which are (is) // derived from this. class octave_parallel_socket_streambuf : public octave_parallel_streambuf { public: // this needs c++11 octave_parallel_socket_streambuf (int sid, bool server) : octave_parallel_socket_streambuf (sid, server, ENCR_RAW) { } // This is extra, so that (derived) encrypted connection streambufs // can give it their own 'encrtype' argument to communicate and // check encryption type before encryption starts. octave_parallel_socket_streambuf (int sid, bool server, encryption_type encrtype); ~octave_parallel_socket_streambuf (void) { if (fid >= 0) while (::close (fid) == -1 && errno == EINTR); } bool good (void) { return (store_errno == 0); } bool connection_state_undefined (void) { return undefined_connection_state; } void set_connection_state_undefined (void) { undefined_connection_state = true; } // redefined streambuf virtual functions std::streamsize showmanyc () { if (! good () || fid == -1) return -1; struct pollfd pfd; pfd.fd = fid; pfd.events = POLLIN; pfd.revents = 0; std::streamsize ret; if ((ret = poll (&pfd, 1, 0)) == 1 && pfd.revents & POLLIN) return 1; else { if (ret < 0) store_errno = -1; return ret; } } protected: ssize_t do_read (void *buf, size_t count) { return ::recv (fid, buf, count, 0); } ssize_t do_write (const void *buf, size_t count) { return ::send (fid, buf, count, 0); } int do_close (void) { return ::close (fid); } bool undefined_connection_state; }; // for usage with class octave_parallel_gnutls_streambuf, one parent // class and one derived class for server and client, respectively; // objects meant to be allocated; the class storing the pointer should // check the refcount and care for deallocation #ifdef HAVE_LIBGNUTLS class octave_parallel_gnutls_srp_credentials { public: octave_parallel_gnutls_srp_credentials (void) : cred (NULL), refcount (0) { } virtual ~octave_parallel_gnutls_srp_credentials (void) { } void *get_ref (void) { refcount++; dlprintf ("cred incr its refcount to %i\n", refcount); return cred; } int release_ref (void) { dlprintf ("cred will decr its refcount to %i\n", refcount - 1); return --refcount; } int check_ref (void) { dlprintf ("cred refcount was checked, is %i\n", refcount); return refcount; } void *check_cred (void) { return cred; } protected: void *cred; virtual void free_credentials (void) = 0; private: int refcount; }; // see comment of parent class class octave_parallel_gnutls_srp_client_credentials : public octave_parallel_gnutls_srp_credentials { public: octave_parallel_gnutls_srp_client_credentials (const char *user, char *apasswd = NULL); octave_parallel_gnutls_srp_client_credentials (std::string passwd_file); ~octave_parallel_gnutls_srp_client_credentials (void) { dlprintf ("ccred destr called\n"); if (password) { memset ((void *) password, '\0', strlen (password)); if (pw_allocated) delete [] password; } if (cred) { dlprintf ("ccred destr will call 'free_credentials()'\n"); free_credentials (); } } const char *get_passwd (void) { return password; } protected: void free_credentials (void) { gnutls_srp_free_client_credentials ((gnutls_srp_client_credentials_t) cred); cred = NULL; } private: char *password; bool pw_allocated; }; // see comment of parent class class octave_parallel_gnutls_srp_server_credentials : public octave_parallel_gnutls_srp_credentials { public: octave_parallel_gnutls_srp_server_credentials (std::string &passwd_file) { if (! gnutls_srp_allocate_server_credentials ((gnutls_srp_server_credentials_t *) &cred)) { // initialize filename in callback function octave_parallel_server_credentials_callback (NULL, passwd_file.c_str (), NULL, NULL, NULL, NULL); gnutls_srp_set_server_credentials_function ((gnutls_srp_server_credentials_t) cred, octave_parallel_server_credentials_callback); } } ~octave_parallel_gnutls_srp_server_credentials (void) { if (cred) free_credentials (); } protected: void free_credentials (void) { gnutls_srp_free_server_credentials ((gnutls_srp_server_credentials_t) cred); cred = NULL; } }; // TCP sockets with a gnutls connection. class octave_parallel_gnutls_streambuf : public octave_parallel_socket_streambuf { public: octave_parallel_gnutls_streambuf (int sid, octave_parallel_gnutls_srp_credentials *accred, bool server); ~octave_parallel_gnutls_streambuf (void) { if (session) gnutls_deinit (session); if (ccred) dlprintf ("gstreambuf destructor will requcest decr of cred refcount\n"); int tpdebug; if (ccred && (tpdebug = ccred->release_ref ()) <= 0) { dlprintf ("gstreambuf destructor got decr cred refcount of %i and will delete cred\n", tpdebug); delete ccred; } } bool good (void) { return (store_errno == 0); } const char *server_get_username (void) { return gnutls_srp_server_get_username (session); } int gnutls_write_alert_for_flushing (void) { if (! good () || fid < 0) return -1; int ret; // this is a dummy alert to force flushing while ((ret = gnutls_alert_send (session, GNUTLS_AL_WARNING, GNUTLS_A_INTERNAL_ERROR)) == GNUTLS_E_AGAIN); // don't repeat if interrupted // GNUTLS_E_INTERRUPTED || // ret == GNUTLS_E_AGAIN); if (ret != GNUTLS_E_SUCCESS) { store_errno = -1; return -1; } else return 0; } protected: ssize_t do_read (void *buf, size_t count) { ssize_t ret; while ((ret = gnutls_record_recv (session, buf, count)) == GNUTLS_E_WARNING_ALERT_RECEIVED) gnutls_alert_get (session); // discard the alert if (ret < 0) { // although checking GNUTLS_E_AGAIN is probably not necessary // with blocking calls configured if (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN) errno = EINTR; ret = -1; } return ret; } ssize_t do_write (const void *buf, size_t count) { ssize_t ret; while ((ret = gnutls_record_send (session, buf, count)) == GNUTLS_E_WARNING_ALERT_RECEIVED) gnutls_alert_get (session); // discard the alert if (ret < 0) { // although checking GNUTLS_E_AGAIN is probably not necessary // with blocking calls configured if (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN) errno = EINTR; ret = -1; } return ret; } int do_close (void) { if (session) { gnutls_deinit (session); session = NULL; } if (ccred && ccred->release_ref () <= 0) delete ccred; ccred = NULL; return octave_parallel_socket_streambuf::do_close (); } octave_parallel_gnutls_srp_credentials *ccred; void *cred; gnutls_session_t session; }; #endif // HAVE_LIBGNUTLS class octave_parallel_stream { public: octave_parallel_stream (octave_parallel_streambuf *strbuf_arg) : strbuf (strbuf_arg), istr (NULL), ostr (NULL) { if (strbuf->readable) istr = new std::istream (strbuf); if (strbuf->writeable) ostr = new std::ostream (strbuf); } ~octave_parallel_stream (void) { if (istr) delete istr; if (ostr) delete ostr; dlprintf ("pstream destructor will delete streambuf\n"); delete strbuf; } bool good (void) const { return strbuf->good (); } void close (void) const { if (strbuf) strbuf->close (); } std::istream &get_istream (void) const { return *istr; } std::ostream &get_ostream (void) const { return *ostr; } int network_send_4byteint (uint32_t v, bool) const { return strbuf->network_send_4byteint (v, true); } int network_recv_4byteint (uint32_t &v) const { return strbuf->network_recv_4byteint (v); } int network_send_4byteint (int32_t v) const { return strbuf->network_send_4byteint (v); } int network_recv_4byteint (int32_t &v) const { return strbuf->network_recv_4byteint (v); } int network_send_string (const char *s) const { return strbuf->network_send_string (s); } int network_recv_string (char *s, int maxl) const { return strbuf->network_recv_string (s, maxl); } int network_recv_string (std::string &str) const { return strbuf->network_recv_string (str); } octave_parallel_streambuf *get_strbuf (void) { return strbuf; } static int signed_int_rep (void) { return octave_parallel_streambuf::signed_int_rep (); } private: octave_parallel_streambuf *strbuf; std::istream *istr; std::ostream *ostr; }; #endif // __OCT_PARALLEL_STREAMS__ /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */ parallel-3.1.3/src/PaxHeaders.30520/error-helpers.cc0000644000000000000000000000013213331003466016726 xustar0030 mtime=1533282102.534477496 30 atime=1533282102.534477496 30 ctime=1533282233.633065964 parallel-3.1.3/src/error-helpers.cc0000644000175000017500000000256413331003466017133 0ustar00olafolaf00000000000000/* Copyright (C) 2016-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ #include #include "error-helpers.h" // call verror #ifdef HAVE_OCTAVE_VERROR_ARG_EXC void c_verror (OCTAVE__EXECUTION_EXCEPTION& e, const char *fmt, ...) { va_list args; va_start (args, fmt); verror (e, fmt, args); va_end (args); } #else void c_verror (const OCTAVE__EXECUTION_EXCEPTION&, const char *fmt, ...) { va_list args; va_start (args, fmt); verror (fmt, args); va_end (args); } #endif void _p_error (const char *fmt, ...) { va_list args; va_start (args, fmt); std::ostringstream output_buf; octave_vformat (output_buf, fmt, args); std::string msg = output_buf.str (); if (msg[msg.length () - 1] != '\n') msg += "\n"; std::cerr << msg; va_end (args); } parallel-3.1.3/src/PaxHeaders.30520/precv.cc0000644000000000000000000000013113331003466015253 xustar0030 mtime=1533282102.570478207 29 atime=1533282228.79697048 30 ctime=1533282233.633065964 parallel-3.1.3/src/precv.cc0000644000175000017500000001037713331003466015462 0ustar00olafolaf00000000000000// Copyright (C) 2002 Hayato Fujiwara // Copyright (C) 2010-2018 Olaf Till // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; If not, see . // PKG_ADD: autoload ("precv", "parallel_interface.oct"); // PKG_DEL: autoload ("precv", "parallel_interface.oct", "remove"); #include #include #include #include #include #include "parallel-gnutls.h" #if HAVE_UNISTD_H #include #endif DEFUN_DLD (precv, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} precv (@var{single_connection})\n\ Receive a data value from the parallel cluster machine specified by @var{single_connection}.\n\ \n\ This function can be called both at the client machine and (with\n\ @code{reval}) at a server machine. @var{single_connection} must be a\n\ single connection obtained by indexing the @var{connections}\n\ variable. Please see @code{pconnect} for a description of the\n\ @var{connections} variable, and @code{pserver} for a description of\n\ this variable (named @code{sockets}) at the server side. If\n\ @var{single_connection} corresponds to the machine at which\n\ @code{precv} was called, an error is thrown.\n\ \n\ The value received with @code{precv} must be sent with @code{psend}\n\ from another machine of the cluster. Note that data can be transferred\n\ this way between each pair of machines, even sent by a server and\n\ received by a different server.\n\ \n\ If @code{precv} is called at the client machine, a corresponding\n\ @code{psend} should have been called before at the source machine,\n\ otherwise the client will hang.\n\ \n\ @seealso{pconnect, pserver, reval, psend, sclose, parallel_generate_srp_data, select_sockets}\n\ @end deftypefn") { std::string fname ("precv"); octave_value retval; if (args.length () != 1 || args(0).type_id () != octave_parallel_connections::static_type_id ()) { print_usage (); return retval; } const octave_base_value &rep = args(0).get_rep (); const octave_parallel_connections &cconns = dynamic_cast (rep); octave_parallel_connections_rep *conns = cconns.get_rep (); int nconns = conns->get_connections ().numel (); if (conns->get_whole_network ()->is_closed ()) { error ("%s: network is closed", fname.c_str ()); return retval; } if (nconns == 0) return retval; if (nconns > 1) { error ("%s: data can only be read from a single connection", fname.c_str ()); return retval; } octave_parallel_connection *conn = conns->get_connections ()(0); if (conn->is_pseudo_connection ()) { error ("%s: the own node was specified to read data from", fname.c_str ()); return retval; } inthandler_dont_restart_syscalls __inthandler_guard__; if (! conns->is_server ()) { int err; if ((err = conn->wait_for_errors_or_data ())) { if (err > 0) error ("%s: a previous command at the server caused an error", fname.c_str ()); else // err < 0 { conns->close (); error ("%s: communication error", fname.c_str ()); } return retval; } } octave_value tc; if (conn->connection_read_data (tc) || ! conn->get_data_stream ()->good ()) { conns->close (); error ("%s: error in reading variable data\n", fname.c_str ()); return retval; } if (! tc.is_defined ()) { conns->close (); error ("%s: error in reading variable\n", fname.c_str ()); return retval; } return retval = tc; } parallel-3.1.3/src/PaxHeaders.30520/fload.cc0000644000000000000000000000013113331003466015221 xustar0030 mtime=1533282102.538477575 29 atime=1533282230.90901218 30 ctime=1533282233.633065964 parallel-3.1.3/src/fload.cc0000644000175000017500000000371413331003466015425 0ustar00olafolaf00000000000000/* Copyright (C) 2009 VZLU Prague, a.s., Czech Republic This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see . */ // Author: Jaroslav Hajek #include #include #include "minimal-load-save.h" DEFUN_DLD (fload, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{var} =} fload (@var{fid})\n\ Loads a single variable of any type from a binary stream, where it was previously\n\ saved with fsave.\n\ Not suitable for data transfer between machines of different type.\n\ @end deftypefn") { octave_value retval; int nargin = args.length (); if (nargin == 1) { int fid = OCTAVE__INTERPRETER__STREAM_LIST__GET_FILE_NUMBER (args (0)); OCTAVE__STREAM octs = OCTAVE__INTERPRETER__STREAM_LIST__LOOKUP (fid, "fload"); std::istream *is = octs.input_stream (); if (is) { bool swap; OCTAVE__MACH_INFO::float_format flt_fmt; if (minimal_read_header (*is, swap, flt_fmt)) { error ("fload: could not read binary header"); return retval; } if (minimal_read_data (*is, retval, swap, flt_fmt)) { error ("fload: failed to extract value"); return retval; } } else error ("fload: stream not opened for reading."); } else print_usage (); return retval; } parallel-3.1.3/src/PaxHeaders.30520/network_get_info.cc0000644000000000000000000000013213331003466017500 xustar0030 mtime=1533282102.566478128 30 atime=1533282229.844991172 30 ctime=1533282233.633065964 parallel-3.1.3/src/network_get_info.cc0000644000175000017500000001117613331003466017704 0ustar00olafolaf00000000000000/* Copyright (C) 2010-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ // PKG_ADD: autoload ("network_get_info", "parallel_interface.oct"); // PKG_DEL: autoload ("network_get_info", "parallel_interface.oct", "remove"); #include #include #include #include #include #include #include #include #include #include #include #include #include #include "parallel-gnutls.h" DEFUN_DLD (network_get_info, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} network_get_info (@var{connections})\n\ Return an informational structure-array with one entry for each machine specified by @var{connections}.\n\ \n\ This function can only be successfully called at the client\n\ machine. See @code{pconnect} for a description of the\n\ @var{connections} variable. @var{connections} can contain all\n\ connections of the network, a subset of them, or a single\n\ connection. For the local machine (client), if contained in\n\ @var{connections}, some fields of the returned structure may be\n\ empty.\n\ \n\ The fields of the returned structure are @code{local_machine}: true\n\ for the connection representing the local machine, @code{nproc}:\n\ number of usable processors of the machine, @code{nlocaljobs}:\n\ configured number of local processes on the machine, @code{peername}:\n\ name of the machine (empty for local machine), @code{open}: true if\n\ the connection is open, @code{network_id}: uuid of the network,\n\ @code{real_node_id}: internal id assigned to node, @code{0} for\n\ client, servers starting with @code{1}.\n\ \n\ @seealso{pconnect, pserver, reval, psend, precv, sclose, parallel_generate_srp_data, select_sockets}\n\ @end deftypefn") { std::string fname ("network_get_info"); if (args.length () != 1 || args(0).type_id () != octave_parallel_connections::static_type_id ()) { print_usage (); return octave_value_list (); } const octave_base_value &rep = args(0).get_rep (); const octave_parallel_connections &cconns = dynamic_cast (rep); octave_parallel_connections_rep *conns = cconns.get_rep (); int nconns = conns->get_connections ().numel (); if (conns->get_whole_network ()->is_closed ()) { error ("%s: network is closed", fname.c_str ()); return octave_value_list (); } if (conns->is_server ()) { error ("%s: 'network_get_info' can't be called at the server side", fname.c_str ()); return octave_value_list (); } const char *fieldnames[] = {"local_machine", "nproc", "nlocaljobs", "peername", "open", "network_id", "real_node_id", NULL}; octave_fields fields (fieldnames); octave_map retval (dim_vector (nconns, 1), fields); octave_scalar_map node_info (fields); for (octave_idx_type i = 0; i < nconns; i++) { if (conns->get_connections ()(i)->is_pseudo_connection ()) node_info.setfield ("local_machine", true); else node_info.setfield ("local_machine", false); node_info.setfield ("nproc", conns->get_connections ()(i)->get_nproc ()); node_info.setfield ("nlocaljobs", conns->get_connections ()(i)->get_nlocaljobs ()); node_info.setfield ("peername", conns->get_connections ()(i)->get_peer_name ()); node_info.setfield ("open", conns->get_connections ()(i)->is_open ()); node_info.setfield ("network_id", conns->get_connections ()(i)->get_uuid ()); node_info.setfield ("real_node_id", conns->get_connections ()(i)->peer_node_n); retval.assign (i, node_info); } return octave_value (retval); } /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */ parallel-3.1.3/src/PaxHeaders.30520/network_set.cc0000644000000000000000000000013213331003466016501 xustar0030 mtime=1533282102.566478128 30 atime=1533282230.200998201 30 ctime=1533282233.633065964 parallel-3.1.3/src/network_set.cc0000644000175000017500000000723013331003466016701 0ustar00olafolaf00000000000000/* Copyright (C) 2010-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ // PKG_ADD: autoload ("network_set", "parallel_interface.oct"); // PKG_DEL: autoload ("network_set", "parallel_interface.oct", "remove"); #include #include #include #include #include #include #include #include #include #include #include #include #include #include "parallel-gnutls.h" DEFUN_DLD (network_set, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} network_set (@var{connections}, @var{key}, @var{val})\n\ Set the property named by @var{key} to the value @var{val} for each machine specified by @var{connections}.\n\ \n\ This function can only be successfully called at the client\n\ machine. See @code{pconnect} for a description of the\n\ @var{connections} variable. @var{connections} can contain all\n\ connections of the network, a subset of them, or a single\n\ connection.\n\ \n\ Possible values of @var{key}: @code{'nlocaljobs'}: configured number\n\ of local processes on the machine (usable by functions for parallel\n\ execution); needs a non-negative integer in @var{val}, @code{0} means\n\ not specified.\n\ \n\ @seealso{pconnect, pserver, reval, psend, precv, sclose, parallel_generate_srp_data, select_sockets}\n\ @end deftypefn") { std::string fname ("network_set"); octave_value retval; if (args.length () != 3 || args(0).type_id () != octave_parallel_connections::static_type_id ()) { print_usage (); return retval; } const octave_base_value &rep = args(0).get_rep (); const octave_parallel_connections &cconns = dynamic_cast (rep); octave_parallel_connections_rep *conns = cconns.get_rep (); int nconns = conns->get_connections ().numel (); if (conns->get_whole_network ()->is_closed ()) { error ("%s: network is closed", fname.c_str ()); return retval; } if (conns->is_server ()) { error ("%s: 'network_set' can't be called at the server side", fname.c_str ()); return retval; } std::string key; CHECK_ERROR (key = args(1).string_value (), retval, "%s: second argument must be a string", fname.c_str ()); int arg; if (! key.compare ("nlocaljobs")) { CHECK_ERROR (arg = args(2).int_value (), retval, "%s: argument for key 'nlocaljobs' could not be converted to a non-negative integer", fname.c_str ()); if (arg < 0) { error ("%s: argument for key 'nlocaljobs' could not be converted to a non-negative integer", fname.c_str ()); return retval; } } else { error ("%s: key '%s' not recognized", fname.c_str (), key.c_str ()); return retval; } for (int i = 0; i < nconns; i++) conns->get_connections ()(i)->set_nlocaljobs (arg); return retval; } /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */ parallel-3.1.3/src/PaxHeaders.30520/minimal-load-save.cc0000644000000000000000000000013013331003466017432 xustar0029 mtime=1533282102.55847797 29 atime=1533282102.55847797 30 ctime=1533282233.633065964 parallel-3.1.3/src/minimal-load-save.cc0000644000175000017500000000654113331003466017640 0ustar00olafolaf00000000000000/* Copyright (C) 2016-2018 Olaf Till . */ #include #include #include #include #include "config.h" #include "error-helpers.h" int minimal_read_header (std::istream& is, bool& swap, OCTAVE__MACH_INFO::float_format& flt_fmt) { /* slightly changed from load-save.cc (read_binary_file_header()) to reduce overhead */ const int magic_len = 2; char magic[magic_len+1]; is.read (magic, magic_len); magic[magic_len] = '\0'; if (strncmp (magic, "1L", magic_len) == 0) swap = OCTAVE__MACH_INFO::words_big_endian (); else if (strncmp (magic, "1B", magic_len) == 0) swap = ! OCTAVE__MACH_INFO::words_big_endian (); else { _p_error ("could not read binary header"); return -1; } char tmp = 0; is.read (&tmp, 1); flt_fmt = mopt_digit_to_float_format (tmp); if (flt_fmt == OCTAVE__MACH_INFO::flt_fmt_unknown) { _p_error ("unrecognized binary format"); return -1; } return 0; } int minimal_read_data (std::istream& is, octave_value& val, bool swap, OCTAVE__MACH_INFO::float_format flt_fmt) { int32_t len; if (! is.read (reinterpret_cast (&len), 4)) { _p_error ("could not load variable"); return -1; } if (swap) swap_bytes<4> (&len); { OCTAVE_LOCAL_BUFFER (char, buf, len+1); if (! is.read (buf, len)) { _p_error ("could not load variable"); return -1; } buf[len] = '\0'; std::string typ (buf); val = octave_value_typeinfo::lookup_type (typ); } if (! val.load_binary (is, swap, flt_fmt)) { _p_error ("could not load variable"); return -1; } return 0; } void minimal_write_header (std::ostream& os) { /* slightly changed from load-save.cc (write_header(,LS_BINARY)) to reduce overhead */ os << (OCTAVE__MACH_INFO::words_big_endian () ? "1B" : "1L"); OCTAVE__MACH_INFO::float_format flt_fmt = OCTAVE__MACH_INFO::native_float_format (); char tmp = static_cast (float_format_to_mopt_digit (flt_fmt)); os.write (&tmp, 1); } int minimal_write_data (std::ostream& os, octave_value& val) { /* Much here is cut-and-pasted from ls-oct-binary.cc (save_binary_data()) in Octave. */ // Write the string corresponding to the octave_value type. std::string typ = val.type_name (); int32_t len = typ.length (); os.write (reinterpret_cast (&len), 4); const char *btmp = typ.data (); os.write (btmp, len); // Call specific save function bool save_as_floats = false; if (! val.save_binary (os, save_as_floats) || ! os) { _p_error ("could not save variable."); return -1; } return 0; } parallel-3.1.3/src/PaxHeaders.30520/configure.ac0000644000000000000000000000013213331003466016114 xustar0030 mtime=1533282102.534477496 30 atime=1533282102.654479866 30 ctime=1533282233.633065964 parallel-3.1.3/src/configure.ac0000644000175000017500000003124413331003466016316 0ustar00olafolaf00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. # ### Copyright (C) 2015-2018 Olaf Till ### ### This program is free software; you can redistribute it and/or ### modify it under the terms of the GNU General Public License as ### published by the Free Software Foundation; either version 3 of the ### License, or (at your option) any later version. ### ### This program is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ### General Public License for more details. ### ### You should have received a copy of the GNU General Public License ### along with this program; if not, see ### . AC_PREREQ(2.62) AC_INIT(parallel, 3.1.3, i7tiol@t-online.de) AC_CONFIG_SRCDIR([pconnect.cc]) AC_CONFIG_HEADERS([config.h]) # Avoid warnings for redefining AH-generated preprocessor symbols of # Octave. AH_TOP([#include "undef-ah-octave.h"]) AC_CONFIG_MACRO_DIRS([m4]) # Checks for programs. AC_CHECK_PROG(MKOCTFILE, mkoctfile, mkoctfile) if test -z "$MKOCTFILE"; then AC_MSG_ERROR([mkoctfile not found], 1); fi AC_CHECK_PROG(OCTAVE_CONFIG, octave-config, octave-config) if test -z "$OCTAVE_CONFIG"; then AC_MSG_ERROR([octave-config not found], 1); fi AC_PROG_SED # The same value of CXX as Octave was compiled with is supposed to be # used. CXX=${CXX:-`${MKOCTFILE} -p CXX`} # The AC_PROG_CXX macro is locally defined to a recent version which # checks for C++11. If necessary, a suitable option is appended to # CXX. AC_PROG_CXX # Require C++11. if test "x$ac_prog_cxx_stdcxx" != "xcxx11"; then AC_MSG_ERROR([could not enforce using C++11 features]) fi AC_PROG_CXXCPP AC_PROG_CC ## The first AC_CHECK_HEADER should be called unconditionally, since ## this macro arranges some preconditions only the first time it is ## expanded. AC_CHECK_HEADER([gnutls/gnutls.h]) ## On some platforms only the functions for local parallelism can be ## installed. AC_ARG_ENABLE([cluster], [AS_HELP_STRING([--enable-cluster], [build functions for parallelism over clusters (default is yes)])]) if test "x$enable_cluster" = "xno"; then AC_SUBST([REDUCED_BUILD], [yes]) AC_MSG_WARN([As requested, the functions for parallelism over clusters will not be built.]) else AC_SUBST([REDUCED_BUILD], [no]) # Checks for gnutls libraries. if test "x$ac_cv_header_gnutls_gnutls_h" = "xyes"; then AC_CHECK_LIB([gnutls], [gnutls_global_init], [[echo -n ""]]) if test "x$ac_cv_lib_gnutls_gnutls_global_init" = "xyes"; then LIBS="-lgnutls $LIBS" AC_CHECK_PROG(PKG_CONFIG, pkg-config, pkg-config) if test -z "$PKG_CONFIG"; then AC_SUBST([HAVE_GNUTLS], [no]) AC_MSG_WARN([TLS disabled since pkg-config not found]) else AC_LINK_IFELSE( [AC_LANG_PROGRAM([[#include ] [#include ]], [[printf ("%u", gnutls_srp_2048_group_prime.size);]])], [AC_DEFINE([HAVE_LIBGNUTLS], 1, [Define as 1 if gnutls library is present.]) AC_SUBST([HAVE_GNUTLS], [yes]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[const gnutls_datum_t *dat = NULL;] [gnutls_datum_t *res = NULL;] [gnutls_srp_base64_decode2 (dat, res);]])], [AC_DEFINE([HAVE_GNUTLS_SRP_BASE64_DECODE2], 1, [Define as 1 if libgnutls has gnutls_srp_base64_decode2])])], [AC_SUBST([HAVE_GNUTLS], [no]) AC_MSG_WARN([TLS disabled since symbol gnutls_srp_2048_group_prime not found in gnutls library - built with --disable-srp-authentication?])]) fi AC_CHECK_LIB([gnutls-extra], [gnutls_global_init_extra], [[echo -n ""]]) if test "x$ac_cv_lib_gnutls_extra_gnutls_global_init_extra" = "xyes"; then LIBS="-lgnutls-extra $LIBS" AC_DEFINE([HAVE_LIBGNUTLS_EXTRA], 1, [Define as 1 if gnutls extra library is present.]) AC_SUBST([HAVE_GNUTLS_EXTRA], [yes]) else AC_SUBST([HAVE_GNUTLS_EXTRA], [no]) fi else AC_SUBST([HAVE_GNUTLS], [no]) AC_MSG_WARN([TLS disabled since no gnutls library found]) fi else AC_SUBST([HAVE_GNUTLS], [no]) AC_MSG_WARN([TLS disabled since gnutls/gnutls.h not found or not compilable]) fi fi # Checks for socket libraries. AC_CHECK_HEADER([sys/socket.h]) if test "x$ac_cv_header_sys_socket_h" = "xyes"; then AC_CHECK_FUNC([socket], , [AC_MSG_ERROR([function socket not found])]) else # winsock2 stuff AC_CHECK_HEADER([winsock2.h]) if test "x$ac_cv_header_winsock2_h" = "xno"; then AC_MSG_ERROR([neither sys/socket.h nor winsock2.h found]) else AC_CHECK_LIB([ws2_32], [socket]) if test "x$ac_cv_lib_ws2_32_socket" = "xyes"; then AC_SUBST([HAVE_WINSOCK], [yes]) else AC_MSG_ERROR([found winsock2.h but no corresponding library]) fi fi fi # Checks for header files. AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h sys/malloc.h netdb.h netinet/in.h stdio_ext.h stdlib.h string.h sys/time.h termios.h unistd.h]) if test "x$ac_cv_header_malloc_h" = "xno"; then if test "x$ac_cv_header_sys_malloc_h" = "xno"; then AC_MSG_ERROR([neither malloc.h nor sys/malloc.h found]) fi fi # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_TYPE_INT32_T AC_TYPE_MODE_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_UINT32_T # Checks for library functions. AC_FUNC_ERROR_AT_LINE AC_FUNC_FORK AC_FUNC_FSEEKO AC_FUNC_MALLOC AC_TYPE_SIGNAL AC_CHECK_FUNCS([memset mkdir modf select strchr strdup uname], , [AC_MSG_ERROR([required system functions not found])]) AC_CHECK_FUNC([getpass]) if test "x$ac_cv_func_getpass" = "xyes"; then AC_DEFINE([HAVE_GETPASS], 1, [Define as 1 if getpass function is present.]) AC_SUBST([HAVE_GETPASS], [yes]) else AC_SUBST([HAVE_GETPASS], [no]) fi # Start of checks for Octave features, preparations for checks. OCTLIBDIR=${OCTLIBDIR:-`$OCTAVE_CONFIG -p OCTLIBDIR`} ## We need Octaves include path both with and without '/octave' ## appended. The path without '/octave' is needed to selectively test ## for Octave headers, like octave/....h. The path with '/octave' is ## needed since some Octave headers contain include directives for ## other Octave headers with <> instead of "". OCTINCLUDEDIR=${OCTINCLUDEDIR:-`$MKOCTFILE -p INCFLAGS`} AC_LANG_PUSH([C++]) TCXXFLAGS=$CXXFLAGS TLDFLAGS=$LDFLAGS TLIBS=$LIBS TCPPFLAGS=$CPPFLAGS LDFLAGS="-L$OCTLIBDIR $LDFLAGS" LIBS="-loctinterp $LIBS" # CXXFLAGS= CPPFLAGS="$OCTINCLUDEDIR $CPPFLAGS" ## Presence of 'error_state' -- does _not_ indicate no exceptions are ## used. AC_LINK_IFELSE( [AC_LANG_PROGRAM([[#include ] [#include ]], [[printf ("%i", error_state);]])], [AC_DEFINE([HAVE_OCTAVE_ERROR_STATE], 1, [Define as 1 if liboctinterp is old enough to provide error_state.])]) ## Presence of 'verror (octave_execution_exception&, const char *, ## va_list)' AC_LINK_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[octave_execution_exception e;] [va_list args;] [verror (e, "test", args);]])], [AC_DEFINE([HAVE_OCTAVE_VERROR_ARG_EXC], 1, [Define as 1 if liboctinterp has 'verror (octave_execution_exception&, const char *, va_list)'.])]) ## Presence of octave/interpreter.h. If present, we assume that ## octave/call-stack.h is also present. Code corresponding to both of ## them was formerly in octave/toplev.h, the latter being now ## deprecated. Setting CPPFLAGS is necessary for the tests in ## OF_OCTAVE_LIST_ALT_SYMS to work correctly without messing up the ## result of the current test. AC_CHECK_HEADERS([octave/interpreter.h], [CPPFLAGS="-include octave/interpreter.h -include octave/call-stack.h $CPPFLAGS"]) ## Simple symbol alternatives of different Octave versions. OF_OCTAVE_LIST_ALT_SYMS([ [dnl [octave_execution_exception], [octave::execution_exception], [[octave::execution_exception ();]], [OCTAVE__EXECUTION_EXCEPTION], [], [] ], [dnl [file_ops], [octave::sys::file_ops], [[octave::sys::file_ops::dir_sep_str ();]], [OCTAVE__SYS__FILE_OPS], [[#include ]], [[#include ]] ], dnl include directive for old version is conditionally given by a dnl separate test [dnl [octave::application], [octave::interpreter], [[octave::interpreter::the_interpreter ();]], [OCTAVE__INTERPRETER], [], [] ], [dnl [symbol_table::assign], [octave::interpreter::the_interpreter () -> get_symbol_table ().assign], [[octave::interpreter::the_interpreter () -> get_symbol_table ();]], [OCTAVE__INTERPRETER__SYMBOL_TABLE__ASSIGN], [[#include ]], [] ], [dnl [symbol_table::is_global], [octave::interpreter::the_interpreter () -> get_current_scope ().is_global], [[octave::interpreter::the_interpreter () -> get_current_scope ();]], [OCTAVE__INTERPRETER__CURRENT_SCOPE__IS_GLOBAL], [[#include ]], [] ], [dnl [oct_mach_info], [octave::mach_info], [[std::cout << octave::mach_info::flt_fmt_unknown;]], [OCTAVE__MACH_INFO], [], [] ], [dnl [octave_stream_list::get_file_number], [octave::interpreter::the_interpreter () -> get_stream_list ().get_file_number], [[octave::interpreter::the_interpreter () -> get_stream_list ();]], [OCTAVE__INTERPRETER__STREAM_LIST__GET_FILE_NUMBER], [[#include ]], [[#include ]] ], [dnl [octave_stream_list::lookup], [octave::interpreter::the_interpreter () -> get_stream_list ().lookup], [[octave::interpreter::the_interpreter () -> get_stream_list ();]], [OCTAVE__INTERPRETER__STREAM_LIST__LOOKUP], [[#include ]], [[#include ]] ], [dnl [octave_child_list::], [octave::interpreter::the_interpreter () -> get_child_list ().], [[octave::interpreter::the_interpreter () -> get_child_list ();]], [OCTAVE_CHILD_LIST], [[#include ]], [[#include ]] ], [dnl [octave_call_stack::goto_caller_frame], [octave::interpreter::the_interpreter () -> get_call_stack ().goto_caller_frame], [[octave::interpreter::the_interpreter () -> get_call_stack ();]], [OCTAVE__INTERPRETER__CALL_STACK__GOTO_CALLER_FRAME], [], [] ], [dnl [unwind_protect], [octave::unwind_protect], [[octave::unwind_protect frame;]], [OCTAVE__UNWIND_PROTECT], [], [] ], [dnl [is_empty], [isempty], [[octave_value ().isempty ();]], [OV_ISEMPTY], [], [] ], [dnl [is_real_type], [isreal], [[octave_value ().isreal ();]], [OV_ISREAL], [], [] ], [dnl [is_vector], [isvector], [[idx_vector ().isvector ();]], [IDXVECTOR_ISVECTOR], [], [] ], [dnl [octave_stream], [octave::stream], [[octave::stream ();]], [OCTAVE__STREAM], [[#include ]], [[#include ]] ], [dnl [octave_refcount], [octave::refcount], [[octave::refcount (0);]], [OCTAVE__REFCOUNT], [[#include ]], [[#include ]] ], [dnl [feval], [octave::feval], [[octave::feval ("date");]], [OCTAVE__FEVAL], [[#include ]], [[#include ]] ], [dnl [eval_string], [octave::eval_string], [[int p_err; octave::eval_string ("date", false, p_err, 0);]], [OCTAVE__EVAL_STRING], [[#include ]], [[#include ]] ], [dnl [file_stat], [octave::sys::file_stat], [[octave::sys::file_stat ();]], [OCTAVE__SYS__FILE_STAT], [], [[#include ]] ], [dnl [add_fcn (octave_call_stack::pop)], [add_method (octave::interpreter::the_interpreter () -> get_call_stack (), &octave::call_stack::pop)], [[octave::interpreter::the_interpreter () -> get_call_stack ();]], [ADD_OCTAVE__INTERPRETER__CALL_STACK__POP], [], [] ] ], [oct-alt-includes.h]) AC_MSG_CHECKING([for octave::config::octave_home ()]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include ] [#include ]], [octave::config::octave_home ();])], [AC_DEFINE([HAVE_OCTAVE_CONFIG_FCNS], 1, [Define to 1 if you have octave::config::octave_home ()]) AC_MSG_RESULT([yes]) echo '#include ' >> oct-alt-includes.h], [AC_MSG_RESULT([no])] ) LIBS=$TLIBS LDFLAGS=$TLDFLAGS CXXFLAGS=$TCXXFLAGS CPPFLAGS=$TCPPFLAGS AC_LANG_POP([C++]) # End of checks for Octave features. AC_CONFIG_FILES([Makefile]) AC_OUTPUT AH_BOTTOM([#include "custom.h"]) parallel-3.1.3/src/PaxHeaders.30520/aclocal.m40000644000000000000000000000013213331003470015461 xustar0030 mtime=1533282104.242511221 30 atime=1533282104.430514933 30 ctime=1533282233.633065964 parallel-3.1.3/src/aclocal.m40000644000175000017500000000132713331003470015662 0ustar00olafolaf00000000000000# generated automatically by aclocal 1.15 -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_include([m4/octave-forge.m4]) m4_include([m4/std-gnu11.m4]) parallel-3.1.3/src/PaxHeaders.30520/__pserver_exit__.copy_to_m0000644000000000000000000000013213331003466021053 xustar0030 mtime=1533282102.534477496 30 atime=1533282227.396942838 30 ctime=1533282233.633065964 parallel-3.1.3/src/__pserver_exit__.copy_to_m0000644000175000017500000000224013331003466021247 0ustar00olafolaf00000000000000## Copyright (C) 2010-2016 Olaf Till ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, see . ## -*- texinfo -*- ## @deftypefn{Function File} {} __pserver_exit__ () ## ## Undocumented internal function. ## ## @end deftypefn function __pserver_exit__ (hn) ## Will be initialized and then registered as an exit function of ## Octave, so pserver does not have to wrap Octaves clean_up_and_exit ## and Octaves sigterm handler. persistent hostname; if (nargin == 1) hostname = hn; else fprintf (stderr, "exiting, %s\n", hostname); endif endfunction parallel-3.1.3/src/PaxHeaders.30520/parallel-gnutls.h0000644000000000000000000000013213331003466017105 xustar0030 mtime=1533282102.566478128 30 atime=1533282227.608947023 30 ctime=1533282233.633065964 parallel-3.1.3/src/parallel-gnutls.h0000644000175000017500000000700013331003466017300 0ustar00olafolaf00000000000000/* Copyright (C) 2015-2018 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ #ifndef __OCT_PARALLEL_GNUTLS__ #define __OCT_PARALLEL_GNUTLS__ // to have Octaves config.h included before config.h of 'parallel' #include #include "config.h" #ifdef HAVE_LIBGNUTLS #include #endif #include #include #include #include #include #include #include #ifdef HAVE_MALLOC_H #include #elif HAVE_SYS_MALLOC_H #include #else #error "No malloc.h present." #endif /* not necessary with current Octave #include #include */ #include // next is from gnulib, getpass of unistd.h is deprecated /* Get getpass declaration, if available. */ // # if defined HAVE_DECL_GETPASS && !HAVE_DECL_GETPASS #ifndef HAVE_GETPASS /* Read a password of arbitrary length from /dev/tty or stdin. */ extern "C" { char *getpass (const char *prompt); } #endif // We link against the gnulib num_processors() used by Octave. nproc.h // used by Octave is not accessible. If the interface changes, this // will stop working. extern "C" { enum nproc_query { NPROC_ALL, /* total number of processors */ NPROC_CURRENT, /* processors available to the current process */ NPROC_CURRENT_OVERRIDABLE /* likewise, but overridable through the OMP_NUM_THREADS environment variable */ }; /* Return the total number of processors. The result is guaranteed to be at least 1. */ extern unsigned long int num_processors (enum nproc_query query); } // Octave includes #include #include #include #include #include #define N_CONNECT_RETRIES 10 /* define some of the following for debugging, but take care: sensitive data (e.g. the password) will be written to standard error and to logfiles */ #undef octave_parallel_debug_server // #define octave_parallel_debug_server 1 #undef octave_parallel_debug_client // #define octave_parallel_debug_client 1 #undef octave_parallel_debug_lib // #define octave_parallel_debug_lib 1 #ifdef octave_parallel_debug_server #define dsprintf(...) fprintf (stderr, __VA_ARGS__); fflush (stderr); #else #define dsprintf(...) #endif #ifdef octave_parallel_debug_client #define dcprintf(...) fprintf (stderr, __VA_ARGS__); #else #define dcprintf(...) #endif #ifdef octave_parallel_debug_lib #define dlprintf(...) fprintf (stderr, __VA_ARGS__); fflush (stderr); #else #define dlprintf(...) #endif // parallel package includes #include "error-helpers.h" #ifdef HAVE_LIBGNUTLS #include "sensitive-data.h" #endif #include "p-streams.h" #include "p-connection.h" #include "p-sighandler.h" #include "minimal-load-save.h" #ifdef HAVE_LIBGNUTLS void parallel_gnutls_set_mem_functions (void); #endif #endif // __OCT_PARALLEL_GNUTLS__ parallel-3.1.3/src/PaxHeaders.30520/gnutls-callbacks.cc0000644000000000000000000000013213331003466017366 xustar0030 mtime=1533282102.538477575 30 atime=1533282102.538477575 30 ctime=1533282233.633065964 parallel-3.1.3/src/gnutls-callbacks.cc0000644000175000017500000001450013331003466017564 0ustar00olafolaf00000000000000/* Copyright (C) 2015-2017 Olaf Till This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; If not, see . */ #include "parallel-gnutls.h" #ifdef HAVE_LIBGNUTLS_EXTRA // The condition in #ifdef is probably only roughly equivalent to what // is to be tested, but I doubt it's worth to work out a better test // (we would have to test for being present and being deprecated; if // deprecated, the function is only a stub). Use // gnutls_global_set_mem_functions() in gnutls versions still // implementing it. BTW the later versions currently don't yet seem to // care for SRP password zeroizing themselves. extern "C" void zero_free (void *p); void zero_free (void *p) { if (p) memset (p, 0, malloc_usable_size (p)); free (p); } extern "C" void *zero_realloc (void *p, size_t s); void *zero_realloc (void *p, size_t s) { if (! p) return malloc (s); void *np = malloc (s); if (! np && s > 0) return np; int os = malloc_usable_size (p); if (np) memcpy (np, p, os < s ? os : s); memset (p, 0, os); free (p); return np; } void parallel_gnutls_set_mem_functions (void) { gnutls_global_set_mem_functions (malloc, malloc, NULL, zero_realloc, zero_free); } #endif // HAVE_LIBGNUTLS_EXTRA static int parse_tpasswd_line (char *line, int nread, const char *username, gnutls_datum_t *salt, gnutls_datum_t *verifier) { int pos; char *p; gnutls_datum_t b64entry; if (! (p = strchr (line, ':'))) { _p_error ("invalid line in password file\n"); return -1; } pos = p - line; if (! (strncmp (line, username, pos))) { // get verifier if (++pos >= nread) { _p_error ("invalid line in password file\n"); return -1; } if (! (p = strchr (line = p + 1, ':'))) { _p_error ("invalid line in password file\n"); return -1; } // base64decode verifier b64entry.data = (unsigned char *) line; pos += (b64entry.size = p - line) + 1; #ifdef HAVE_GNUTLS_SRP_BASE64_DECODE2 if (gnutls_srp_base64_decode2 (&b64entry, verifier)) #else if (gnutls_srp_base64_decode_alloc (&b64entry, verifier)) #endif { _p_error ("could not base64-decode verifier\n"); return -1; } // get salt if (pos >= nread) { _p_error ("invalid line in password file\n"); return -1; } if (! (p = strchr (line = p + 1, ':'))) { _p_error ("invalid line in password file\n"); return -1; } // base64decode salt b64entry.data = (unsigned char *) line; pos += (b64entry.size = p - line) + 1; #ifdef HAVE_GNUTLS_SRP_BASE64_DECODE2 if (gnutls_srp_base64_decode2 (&b64entry, salt)) #else if (gnutls_srp_base64_decode_alloc (&b64entry, salt)) #endif { _p_error ("could not base64-decode salt\n"); return -1; } // check index if (pos >= nread) { _p_error ("invalid line in password file\n"); return -1; } if (atoi (p + 1) != 1) { _p_error ("invalid index in password file\n"); return -1; } return 1; } // if (! (strncmp (line, username, pos))) else return 0; } #define BUFLEN 2048 int octave_parallel_server_credentials_callback (gnutls_session_t session, const char *username, gnutls_datum_t *salt, gnutls_datum_t *verifier, gnutls_datum_t *g, gnutls_datum_t *n) { /* In an initializing call with session == NULL, which is performed before setting the function as a callback, the pointer to the tpasswd filename is set. */ static const char *passwd = NULL; if (! session) { passwd = username; return 0; } /* We have been called as a callback. */ if (! passwd) { _p_error ("no password file initialized\n"); return -1; } struct __bufguard { char *__b; __bufguard (char *__ib) : __b (__ib) { } ~__bufguard (void) { memset ((void *) __b, '\0', BUFLEN); delete[] __b; } char *__get (void) { return __b; } } __bg (new char[BUFLEN]); char *line = __bg.__get (); if (! line) { _p_error ("could not allocate memory to read lines of password file\n"); return -1; } line[0] = '\0'; octave_parallel_stream spi (new octave_parallel_file_streambuf (passwd, O_RDONLY, 0)); if (! spi.good ()) { _p_error ("could not open password file\n"); return -1; } salt->data = verifier->data = g->data = n->data = NULL; salt->size = verifier->size = g->size = n->size = 0; int nread, parse_res; bool valid_user = false; while (true) { spi.get_istream ().getline (line, BUFLEN); nread = strlen (line); if (spi.get_istream ().fail ()) { if (nread == BUFLEN - 1) _p_error ("line in password file too long\n"); break; } if (nread == 0) { _p_error ("empty line in password file\n"); break; } if ((parse_res = parse_tpasswd_line (line, nread, username, salt, verifier))) { if (parse_res == 1) valid_user = true; break; } } n->data = gnutls_srp_2048_group_prime.data; n->size = gnutls_srp_2048_group_prime.size; g->data = gnutls_srp_2048_group_generator.data; g->size = gnutls_srp_2048_group_generator.size; if (valid_user) return 0; else { if (verifier->data) { gnutls_free (verifier->data); verifier->size = 0; } if (salt->data) { gnutls_free (salt->data); salt->size = 0; } return 1; } } parallel-3.1.3/src/PaxHeaders.30520/munge-texi.pl0000644000000000000000000000013213331003466016245 xustar0030 mtime=1533282102.562478049 30 atime=1533282232.581045193 30 ctime=1533282233.633065964 parallel-3.1.3/src/munge-texi.pl0000755000175000017500000001176513331003466016460 0ustar00olafolaf00000000000000#!/usr/bin/perl -w # # Copyright (C) 2012-2014 Rik Wehbring # # This file is part of Octave. # # Octave is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # Octave is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License # along with Octave; see the file COPYING. If not, see # . # copied from Octave and slightly modified by Olaf Till # Validate program call die "usage: munge-texi DOCSTRING-FILE ... < file" if (@ARGV < 1); # Constant patterns $doc_delim = qr/^\x{1d}/; $tex_delim = qr/\Q-*- texinfo -*-\E/; $comment_line = qr/^\s*(?:$|#)/; # Pre-declare hash size for efficiency keys(%help_text) = 1800; ################################################################################ # Load DOCSTRINGS into memory while expanding @seealso references foreach $DOCSTRING_file (@ARGV) { open (DOCFH, $DOCSTRING_file) or die "Unable to open $DOCSTRING_file\n"; # Skip comments while (defined ($_ = ) and /$comment_line/o) {;} # Validate DOCSTRING file format die "invalid doc file format\n" if (! /$doc_delim/o); do { s/\s*$//; # strip EOL character(s) $symbol = substr ($_,1); $docstring = extract_docstring (); if ($help_text{$symbol}) { warn "ignoring duplicate entry for $symbol\n"; } else { $help_text{$symbol} = $docstring; } } while (! eof); } ################################################################################ # Process .txi to .texi by expanding @DOCSTRING, @EXAMPLEFILE macros # Add warning header print '@c This file is generated automatically by the packages munge-texi.pl.',"\n\n"; # parse ../DESCRIPTION to get package version open (FH, "../DESCRIPTION") or die "unable to open file ../DESCRIPTION\n"; while () { # this represents the current logic of pkg if (/^Version\s*:\s*([^\s]+)/i) { $version = $1; } } close (FH); defined ($version) or die "unable to find version string in ../DESCRIPTION\n"; TXI_LINE: while () { if (/^\s*\@DOCSTRING\((\S+)\)/) { $func = $1; $docstring = $help_text{$func}; if (! $docstring) { warn "no docstring entry for $func\n"; next TXI_LINE; } $func =~ s/^@/@@/; # Texinfo uses @@ to produce '@' $docstring =~ s/^$tex_delim$/\@anchor{XREF$func}/m; print $docstring,"\n"; next TXI_LINE; } if (/^\s*\@DOCSTRINGVERBATIM\((\S+)\)/) { $func = $1; $docstring = $help_text{$func}; if (! $docstring) { warn "no docstring entry for $func\n"; next TXI_LINE; } $func =~ s/^@/@@/; # Texinfo uses @@ to produce '@' print '@anchor',"{XREF$func}\n"; $docstring =~ s/^@[cC] .*?\n//; print '@verbatim',"\n"; print $docstring,"\n"; print '@end verbatim',"\n"; next TXI_LINE; } if (/^\s*\@EXAMPLEFILE\((\S+)\)/) { $fname = "$1"; print '@verbatim',"\n"; open (EXAMPFH, $fname) or die "unable to open example file $fname\n"; while () { print $_; print "\n" if (eof and substr ($_, -1) ne "\n"); } close (EXAMPFH); print '@end verbatim',"\n\n"; next TXI_LINE; } # replace @PACKAGEVERSION with version string s/\@PACKAGEVERSION/$version/o; # pass ordinary lines straight through to output print $_; } ################################################################################ # Subroutines ################################################################################ sub extract_docstring { my ($docstring, $arg_list, $func_list, $repl, $rest_of_line); $cut = 0; DOC_LINE: while (defined ($_ = ) and ! /$doc_delim/o) { # drop text marked for cutting out if (/^\s*\@[cC]\s*BEGIN_CUT_TEXINFO\s*$/) { die "BEGIN_CUT_TEXINFO not matched by END_CUT_TEXINFO" if ($cut); $cut = 1; next DOC_LINE; } if (/^\s*\@[cC]\s*END_CUT_TEXINFO\s*$/) { die "END_CUT_TEXINFO without BEGIN_CUT_TEXINFO" if (! $cut); $cut = 0; next DOC_LINE; } if ($cut) { next DOC_LINE; } # expand any @seealso references if (m'^@seealso\s*{') { # Join multiple lines until full macro body found while (! /}/m) { $_ .= ; } ($arg_list, $rest_of_line) = m'^@seealso\s*{(.*)}(.*)?'s; $func_list = $arg_list; $func_list =~ s/\s+//gs; $repl = ""; foreach $func (split (/,/, $func_list)) { $func =~ s/^@/@@/; # Texinfo uses @@ to produce '@' $repl .= "\@ref{XREF$func,,$func}, "; } substr($repl,-2) = ""; # Remove last ', ' $_ = "\@seealso{$repl}$rest_of_line"; } $docstring .= $_; } return $docstring; } parallel-3.1.3/PaxHeaders.30520/doc0000644000000000000000000000013213331003671013525 xustar0030 mtime=1533282233.345060278 30 atime=1533282233.633065964 30 ctime=1533282233.633065964 parallel-3.1.3/doc/0000755000175000017500000000000013331003671014000 5ustar00olafolaf00000000000000parallel-3.1.3/doc/PaxHeaders.30520/parallel.txi0000644000000000000000000000013213331003466016126 xustar0030 mtime=1533282102.526477339 30 atime=1533282232.585045272 30 ctime=1533282233.633065964 parallel-3.1.3/doc/parallel.txi0000644000175000017500000003616413331003466016336 0ustar00olafolaf00000000000000\input texinfo @c %**start of header @setfilename parallel.info @settitle parallel_doc @c %**end of header @c Nowadays the predined function index has entries for each @deftypefn @c in additiont to each @findex. @defcodeindex mfn @copying General documentation for the parallel package for Octave. Copyright @copyright{} @email{Olaf Till } You can redistribute this documentation and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this documentation; if not, see . @end copying @include macros.texi @macro mysee @ifhtml see @end ifhtml @end macro @titlepage @title General documentation for the documentation package for Octave @page @vskip 0pt plus 1filll @insertcopying @end titlepage @c No table of contents. The table would occupy most of the top node in @c html and IMHO misleads the user to use the table instead of the menu @c structure of the nodes, which would let some information unused. @c @c @contents @c ------------------------------------------------------------------ @node Top @top General documentation for the parallel package for Octave @ifhtml The info version of this document is accessible, after package installation, from the Octave commandline with @code{parallel_doc()}. @end ifhtml This documentation applies to version @PACKAGEVERSION of the parallel package. The package contains functions for explicit local parallel execution, and functions for parallel execution over a cluster of machines, possibly combined with local parallel execution at each machine of the cluster. The cluster-related functions may be disabled in distributed binaries of the parallel package for some operating systems. An alternative to the parallel package is the mpi package. @menu * Installation:: Installation hints. * Local execution:: Functions for local parallel execution. * Cluster execution:: Functions for parallel execution over a cluster of machines. * Further functions:: Functions possibly helpful in parallel execution. * Documentation:: Function parallel_doc to view documentation. Indices * Function index:: Index of functions in database. * Concept index:: Concept index. @end menu @c ------------------------------------------------------------------ @node Installation @chapter Installation hints @cindex installation @emph{Note:} For using a cluster of machines, identical versions of the package are required to be installed at each machine. Maybe your distribution provides the parallel package. If not, or if you want a newer version, Octaves @code{pkg} command allows building the package from source and installing it. Note that you have to @code{load} any Octave package before you can use it. See Octaves documentation of @code{pkg}. The functions for parallel execution over a cluster of machines can be disabled by a configure option. There is currently no way, however, to specify configure options when building a package with @code{pkg}. Parallel execution over a cluster by default is protected by encryption with authentication. This needs a version of the gnutls library in which TLS-SRP is not disabled. For building the parallel package from source, this library must be present during the build; some operating systems provide development files of libraries in exta @code{...-dev} packages, which are also needed during the build. Building or using the package for cluster execution without gnutls will work, but encryption and authentication are not available in this case. @c ------------------------------------------------------------------ @node Local execution @chapter Functions for local parallel execution @cindex local execution Explicit local parallel execution, with the intent to exploit more than one local processor(-core), is performed by calling a user-defined function in parallel with several different arguments. This is done in parallel @emph{processes}, so any changes to (global) variables in the user-defined function will only be visible within the same function call. The interface of the functions for local parallel execution is similar to Octaves @code{cellfun} and @code{parcellfun} functions. Note that some operations in Octave, particularly some matrix operations, may already be performed in parallel threads. This may limit the advantage yielded by explicit local parallel execution. Also, RAM access can be a bottleneck which limits computation speed of multicore computing. @menu * parcellfun:: Function parcellfun. * pararrayfun:: Function pararrayfun. @end menu @c ------------------------------------------------------------------ @node parcellfun @section Function parcellfun @mfnindex parcellfun @c include function helptext here @DOCSTRING(parcellfun) @c ------------------------------------------------------------------ @node pararrayfun @section Function pararrayfun @mfnindex pararrayfun @c include function helptext here @DOCSTRING(pararrayfun) See also @ref{XREFparcellfun,,parcellfun}, @ref{XREFarrayfun,,arrayfun,octave}. @c ------------------------------------------------------------------ @node Cluster execution @chapter Functions for parallel execution over a cluster of machines @cindex cluster execution There are high level functions, similar to @ref{parcellfun} and @ref{pararrayfun}, which only require the user to provide a function to be called and a series of argument sets. Parallel function calls are then internally distributed over the cluster, and over the local processors (or processor cores) within the single machines of the cluster. Medium and low level functions are also provided. These require the user to program the scheduling of parallel execution. Data transfer is possible between the client machine and each server machine, but also directly between server machines. The latter feature is exploited e.g. by the @ref{install_vars} function. @menu * Security:: Security considerations. * Authentication:: Generating authentication keys. * pserver:: Starting servers. Connection-related functions * pconnect:: Establishing cluster connections. * sclose:: Closing cluster connections. * network_get_info:: Get network information. * network_set:: Set network properties. High level functions * netcellfun:: Function netcellfun. * netarrayfun:: Function netarrayfun. * install_vars:: Distribute Octave variables. Medium level functions * rfeval:: Single remote function evaluation. Low level functions * psend:: Sending Octave variables. * precv:: Receiving Octave variables. * reval:: Remote command evaluation. * select_sockets:: Call Unix @code{select} for data connections. * Limitations:: Limitations of high- and medium-level functions. * Example:: Example @end menu @c ------------------------------------------------------------------ @node Security @section Security considerations @cindex security Over a connection to a server of the parallel package arbitrary Octave commands can be executed at the server machine. This means that any change can be done to the server system and the resident data, only limited by the rights of the system account under which the server runs. By default, the server is started with authentication and encryption enabled, to avoid unauthorized access. If the server is started with authentication disabled (maybe to avoid the encryption overhead), it must be cared for that no TCP connection by unauthorized persons is possible to the server ports, possibly by running the client and all server machines behind a firewall and assuring that only trusted persons have access to any machine behind the firewall. This scenario might be achievable in home-nets. The server currently uses port 12502 for receiving commands and port 12501 for data exchange. The client and the servers used by the client with @code{pconnect} must agree on using authentication or not. Do not start the server as root. @c ------------------------------------------------------------------ @node Authentication @section Generating authentication keys @cindex authentication @mfnindex parallel_generate_srp_data @c include function helptext here @DOCSTRING(parallel_generate_srp_data) @c ------------------------------------------------------------------ @node pserver @section Starting servers @mfnindex pserver @c include function helptext here @DOCSTRING(pserver) @c ------------------------------------------------------------------ @node pconnect @section Establishing cluster connections @mfnindex pconnect @c include function helptext here @DOCSTRING(pconnect) @c ------------------------------------------------------------------ @node sclose @section Closing cluster connections @mfnindex sclose @c include function helptext here @DOCSTRING(sclose) @c ------------------------------------------------------------------ @node network_get_info @section Get network information @mfnindex network_get_info @c include function helptext here @DOCSTRING(network_get_info) @c ------------------------------------------------------------------ @node network_set @section Set network properties @mfnindex network_set @c include function helptext here @DOCSTRING(network_set) @c ------------------------------------------------------------------ @node netcellfun @section Function netcellfun @mfnindex netcellfun @c include function helptext here @DOCSTRING(netcellfun) @c ------------------------------------------------------------------ @node netarrayfun @section Function netarrayfun @mfnindex netarrayfun @c include function helptext here @DOCSTRING(netarrayfun) @c ------------------------------------------------------------------ @node install_vars @section Distribute Octave variables @mfnindex install_vars @c include function helptext here @DOCSTRING(install_vars) @c ------------------------------------------------------------------ @node rfeval @section Single remote function evaluation @mfnindex rfeval @c include function helptext here @DOCSTRING(rfeval) @c ------------------------------------------------------------------ @node psend @section Sending Octave variables @mfnindex psend @c include function helptext here @DOCSTRING(psend) @c ------------------------------------------------------------------ @node precv @section Receiving Octave variables @mfnindex precv @c include function helptext here @DOCSTRING(precv) @c ------------------------------------------------------------------ @node reval @section Remote command evaluation @mfnindex reval @c include function helptext here @DOCSTRING(reval) @c ------------------------------------------------------------------ @node select_sockets @section Call Unix @code{select} for data connections @mfnindex select sockets @c include function helptext here @DOCSTRING(select_sockets) @c ------------------------------------------------------------------ @node Limitations @section Limitations of high- and medium-level functions @cindex limitations For the function handles passed as arguments to @ref{netcellfun}, @ref{netarrayfun}, and @ref{rfeval}, the following limitations currently apply: @itemize @item If a handle to a named function is passed, this function must exist on the server machine. @item A handle to a subfunction can not be passed. @item A handle to a private function can only be passed if its file path is the same at the server. @item If an anonymous function is passed, it may not have been defined using @code{varargin}. @end itemize Anonymous functions should be usable as usual, since the function specification sent to the server will include the anonymous functions context. @c ------------------------------------------------------------------ @node Example @section Example @cindex example @example # From Octave prompt, generate authentication files, set user name to # 'test'. When prompted for a password, press . parallel_generate_srp_data ('test') # From Octave prompt, get location of the generated files. authpath = fullfile (a = pkg ("prefix"), "parallel-srp-data") Copy server files to servers, authpath is assumed to be "/home/test/octave/parallel-srp-data/", the same directory is assumed to exist on the servers. From the system shell, do e.g.: scp -r /home/test/octave/parallel-srp-data/server server1:/home/test/octave/parallel-srp-data/ scp -r /home/test/octave/parallel-srp-data/server server2:/home/test/octave/parallel-srp-data/ Start server at remote machines. From the system shell, do e.g.: ssh server1 'octave --eval "pserver"' ssh server2 'octave --eval "pserver"' # From Octave prompt, connect the cluster. conns = pconnect (@{"server1", "server2"@}) # And perform some parallel execution. Single function calls take 1 # second each. results = netcellfun (conns, @ (x) @{x, pause(1)@}@{:@}, num2cell (1:30)) # Close network. sclose (conns) @end example @c ------------------------------------------------------------------ @node Further functions @chapter Functions possibly helpful in parallel execution @menu * fsave fload:: Transfer variable within the local machine over an Octave stream. * select:: Call Unix @code{select} on Octave streams. @end menu @c ------------------------------------------------------------------ @node fsave fload @section Transfer variable within the local machine over an Octave stream @mfnindex fsave @mfnindex fload @c include function helptext here @DOCSTRING(fsave) @c include function helptext here @DOCSTRING(fload) @c ------------------------------------------------------------------ @node select @section Call Unix @code{select} on Octave streams @mfnindex select Note that for cluster connections @ref{select_sockets} should be used instead. @c include function helptext here @DOCSTRING(select) @c ------------------------------------------------------------------ @node Documentation @chapter Function parallel_doc to view documentation @cindex documentation @mfnindex parallel_doc @c include function helptext here @DOCSTRING(parallel_doc) @c ------------------------------------------------------------------ @node Function index @unnumbered Index of functions in parallel @printindex mfn @c ------------------------------------------------------------------ @node Concept index @unnumbered Concept index @printindex cp @bye parallel-3.1.3/doc/PaxHeaders.30520/parallel.texi0000644000000000000000000000013213331003670016270 xustar0030 mtime=1533282232.585045272 30 atime=1533282232.805049615 30 ctime=1533282233.633065964 parallel-3.1.3/doc/parallel.texi0000644000175000017500000013457313331003670016503 0ustar00olafolaf00000000000000@c This file is generated automatically by the packages munge-texi.pl. \input texinfo @c %**start of header @setfilename parallel.info @settitle parallel_doc @c %**end of header @c Nowadays the predined function index has entries for each @deftypefn @c in additiont to each @findex. @defcodeindex mfn @copying General documentation for the parallel package for Octave. Copyright @copyright{} @email{Olaf Till } You can redistribute this documentation and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this documentation; if not, see . @end copying @include macros.texi @macro mysee @ifhtml see @end ifhtml @end macro @titlepage @title General documentation for the documentation package for Octave @page @vskip 0pt plus 1filll @insertcopying @end titlepage @c No table of contents. The table would occupy most of the top node in @c html and IMHO misleads the user to use the table instead of the menu @c structure of the nodes, which would let some information unused. @c @c @contents @c ------------------------------------------------------------------ @node Top @top General documentation for the parallel package for Octave @ifhtml The info version of this document is accessible, after package installation, from the Octave commandline with @code{parallel_doc()}. @end ifhtml This documentation applies to version 3.1.3 of the parallel package. The package contains functions for explicit local parallel execution, and functions for parallel execution over a cluster of machines, possibly combined with local parallel execution at each machine of the cluster. The cluster-related functions may be disabled in distributed binaries of the parallel package for some operating systems. An alternative to the parallel package is the mpi package. @menu * Installation:: Installation hints. * Local execution:: Functions for local parallel execution. * Cluster execution:: Functions for parallel execution over a cluster of machines. * Further functions:: Functions possibly helpful in parallel execution. * Documentation:: Function parallel_doc to view documentation. Indices * Function index:: Index of functions in database. * Concept index:: Concept index. @end menu @c ------------------------------------------------------------------ @node Installation @chapter Installation hints @cindex installation @emph{Note:} For using a cluster of machines, identical versions of the package are required to be installed at each machine. Maybe your distribution provides the parallel package. If not, or if you want a newer version, Octaves @code{pkg} command allows building the package from source and installing it. Note that you have to @code{load} any Octave package before you can use it. See Octaves documentation of @code{pkg}. The functions for parallel execution over a cluster of machines can be disabled by a configure option. There is currently no way, however, to specify configure options when building a package with @code{pkg}. Parallel execution over a cluster by default is protected by encryption with authentication. This needs a version of the gnutls library in which TLS-SRP is not disabled. For building the parallel package from source, this library must be present during the build; some operating systems provide development files of libraries in exta @code{...-dev} packages, which are also needed during the build. Building or using the package for cluster execution without gnutls will work, but encryption and authentication are not available in this case. @c ------------------------------------------------------------------ @node Local execution @chapter Functions for local parallel execution @cindex local execution Explicit local parallel execution, with the intent to exploit more than one local processor(-core), is performed by calling a user-defined function in parallel with several different arguments. This is done in parallel @emph{processes}, so any changes to (global) variables in the user-defined function will only be visible within the same function call. The interface of the functions for local parallel execution is similar to Octaves @code{cellfun} and @code{parcellfun} functions. Note that some operations in Octave, particularly some matrix operations, may already be performed in parallel threads. This may limit the advantage yielded by explicit local parallel execution. Also, RAM access can be a bottleneck which limits computation speed of multicore computing. @menu * parcellfun:: Function parcellfun. * pararrayfun:: Function pararrayfun. @end menu @c ------------------------------------------------------------------ @node parcellfun @section Function parcellfun @mfnindex parcellfun @c include function helptext here @c parcellfun ../inst/parcellfun.m @anchor{XREFparcellfun} @deftypefn{Function File} {[@var{o1}, @var{o2}, @dots{}] =} parcellfun (@var{nproc}, @var{fun}, @var{a1}, @var{a2}, @dots{}) @deftypefnx{Function File} {} parcellfun (nproc, fun, @dots{}, "UniformOutput", @var{val}) @deftypefnx{Function File} {} parcellfun (nproc, fun, @dots{}, "ErrorHandler", @var{errfunc}) @deftypefnx{Function File} {} parcellfun (nproc, fun, @dots{}, "VerboseLevel", @var{val}) @deftypefnx{Function File} {} parcellfun (nproc, fun, @dots{}, "ChunksPerProc", @var{val}) @deftypefnx{Function File} {} parcellfun (nproc, fun, @dots{}, "CumFunc", @var{cumfunc}) Evaluates a function for multiple argument sets using multiple processes. @var{nproc} should specify the number of processes. A maximum recommended value is equal to number of CPUs on your machine or one less. @var{fun} is a function handle pointing to the requested evaluating function. @var{a1}, @var{a2} etc. should be cell arrays of equal size. @var{o1}, @var{o2} etc. will be set to corresponding output arguments. The UniformOutput and ErrorHandler options are supported with meaning identical to @dfn{cellfun}. A VerboseLevel option controlling the level output is supported. A value of 0 is quiet, 1 is normal, and 2 or more enables debugging output. The ChunksPerProc option control the number of chunks which contains elementary jobs. This option particularly useful when time execution of function is small. Setting this option to 100 is a good choice in most cases. Instead of returning a result for each argument, parcellfun returns only one cumulative result if "CumFunc" is non-empty. @var{cumfunc} must be a function which performs an operation on two sets of outputs of @var{fun} and returnes as many outputs as @var{fun}. If @var{nout} is the number of outputs of @var{fun}, @var{cumfunc} gets a previous output set of @var{fun} or of @var{cumfunc} as first @var{nout} arguments and the current output of @var{fun} as last @var{nout} arguments. The performed operation must be mathematically commutative and associative. If the operation is e.g. addition, the result will be the sum(s) of the outputs of @var{fun} over all calls of @var{fun}. Since floating point addition and multiplication are only approximately associative, the cumulative result will not be exactly reproducible. Notice that jobs are served from a single first-come first-served queue, so the number of jobs executed by each process is generally unpredictable. This means, for example, that when using this function to perform Monte-Carlo simulations one cannot expect results to be exactly reproducible. The pseudo random number generators of each process are initialised with a unique state. This currently works only for new style generators. NOTE: this function is implemented using "fork" and a number of pipes for IPC. Suitable for systems with an efficient "fork" implementation (such as GNU/Linux), on other systems (Windows) it should be used with caution. Also, if you use a multithreaded BLAS, it may be wise to turn off multi-threading when using this function. CAUTION: This function should be regarded as experimental. Although all subprocesses should be cleared in theory, there is always a danger of a subprocess hanging up, especially if unhandled errors occur. Under GNU and compatible systems, the following shell command may be used to display orphaned Octave processes: ps --ppid 1 | grep octave @end deftypefn @c ------------------------------------------------------------------ @node pararrayfun @section Function pararrayfun @mfnindex pararrayfun @c include function helptext here @c pararrayfun ../inst/pararrayfun.m @anchor{XREFpararrayfun} @deftypefn{Function File} {[@var{o1}, @var{o2}, @dots{}] =} pararrayfun (@var{nproc}, @var{fun}, @var{a1}, @var{a2}, @dots{}) @deftypefnx{Function File} {} pararrayfun (nproc, fun, @dots{}, "UniformOutput", @var{val}) @deftypefnx{Function File} {} pararrayfun (nproc, fun, @dots{}, "ErrorHandler", @var{errfunc}) Evaluates a function for corresponding elements of an array. Argument and options handling is analogical to @code{parcellfun}, except that arguments are arrays rather than cells. If cells occur as arguments, they are treated as arrays of singleton cells. Arrayfun supports one extra option compared to parcellfun: "Vectorized". This option must be given together with "ChunksPerProc" and it indicates that @var{fun} is able to operate on vectors rather than just scalars, and returns a vector. The same must be true for @var{errfunc}, if given. In this case, the array is split into chunks which are then directly served to @var{func} for evaluation, and the results are concatenated to output arrays. If "CumFunc" is also specified (see @code{parcellfun}), @var{fun} is expected to return the result of the same cumulative operation instead of vectors. @c Will be cut out in parallels info file and replaced with the same @c references explicitely there, since references to core Octave @c functions are not automatically transformed from here to there. @end deftypefn See also @ref{XREFparcellfun,,parcellfun}, @ref{XREFarrayfun,,arrayfun,octave}. @c ------------------------------------------------------------------ @node Cluster execution @chapter Functions for parallel execution over a cluster of machines @cindex cluster execution There are high level functions, similar to @ref{parcellfun} and @ref{pararrayfun}, which only require the user to provide a function to be called and a series of argument sets. Parallel function calls are then internally distributed over the cluster, and over the local processors (or processor cores) within the single machines of the cluster. Medium and low level functions are also provided. These require the user to program the scheduling of parallel execution. Data transfer is possible between the client machine and each server machine, but also directly between server machines. The latter feature is exploited e.g. by the @ref{install_vars} function. @menu * Security:: Security considerations. * Authentication:: Generating authentication keys. * pserver:: Starting servers. Connection-related functions * pconnect:: Establishing cluster connections. * sclose:: Closing cluster connections. * network_get_info:: Get network information. * network_set:: Set network properties. High level functions * netcellfun:: Function netcellfun. * netarrayfun:: Function netarrayfun. * install_vars:: Distribute Octave variables. Medium level functions * rfeval:: Single remote function evaluation. Low level functions * psend:: Sending Octave variables. * precv:: Receiving Octave variables. * reval:: Remote command evaluation. * select_sockets:: Call Unix @code{select} for data connections. * Limitations:: Limitations of high- and medium-level functions. * Example:: Example @end menu @c ------------------------------------------------------------------ @node Security @section Security considerations @cindex security Over a connection to a server of the parallel package arbitrary Octave commands can be executed at the server machine. This means that any change can be done to the server system and the resident data, only limited by the rights of the system account under which the server runs. By default, the server is started with authentication and encryption enabled, to avoid unauthorized access. If the server is started with authentication disabled (maybe to avoid the encryption overhead), it must be cared for that no TCP connection by unauthorized persons is possible to the server ports, possibly by running the client and all server machines behind a firewall and assuring that only trusted persons have access to any machine behind the firewall. This scenario might be achievable in home-nets. The server currently uses port 12502 for receiving commands and port 12501 for data exchange. The client and the servers used by the client with @code{pconnect} must agree on using authentication or not. Do not start the server as root. @c ------------------------------------------------------------------ @node Authentication @section Generating authentication keys @cindex authentication @mfnindex parallel_generate_srp_data @c include function helptext here @c parallel_generate_srp_data parallel_generate_srp_data.cc @anchor{XREFparallel_generate_srp_data} @deftypefn {Loadable Function} {} parallel_generate_srp_data (@var{username}) @deftypefnx {Loadable Function} {} parallel_generate_srp_data (@var{username}, @var{options}) Prompts for a password (press enter for a random password) and writes TLS-SRP authentication files into the directory given by: @code{fullfile (a = pkg ("prefix"), "parallel-srp-data")} Server files are placed in subdirectory @code{server}. By default, a client authentication file is placed in subdirectory @code{client}. The latter contains the given @var{username} and the cleartext password. You do not need this file if you prefer to be prompted for username and password at connection time. In this case, you can prevent the client authentication file from being written by passing as the argument @var{options} a structure with a value of @code{false} in the field @code{unattended}. For authentication, subdir @code{server}, and possibly subdir @code{client}, have to be placed together with their contents at the respective machines. They can either be placed under the directory given by: @code{fullfile (OCTAVE_HOME (), "share", "octave", "parallel-srp-data")} or -- which might be the same directory -- under: @code{fullfile (a = pkg ("prefix"), "parallel-srp-data")} Files in the former directory will take precedence over those in the latter. The contents of the files @code{passwd} and @code{user_passwd} (if present) must be kept secret. This function zeroizes sensitive data before releasing its memory. Due to usage of external libraries, however, it still can't be excluded that sensitive data is still on the swap device after application shutdown. @seealso{@ref{XREFpconnect,,pconnect}, @ref{XREFpserver,,pserver}, @ref{XREFreval,,reval}, @ref{XREFpsend,,psend}, @ref{XREFprecv,,precv}, @ref{XREFsclose,,sclose}, @ref{XREFselect_sockets,,select_sockets}} @end deftypefn @c ------------------------------------------------------------------ @node pserver @section Starting servers @mfnindex pserver @c include function helptext here @c pserver pserver.cc @anchor{XREFpserver} @deftypefn {Loadable Function} {} pserver () @deftypefnx {Loadable Function} {} pserver (@var{options}) This function starts a server of the parallel cluster and should be called once at any server machine. It is important to call this function in a way assuring that Octave is quit as soon as the function returns, i.e. call it e.g. like @code{octave --eval "pserver"} or @code{octave --eval "pserver (struct ('fieldname', value))"}. If a directory path corresponding to the current directory of the client exists on the server machine, it will be used as the servers current directory for the respective client (multiple clients are possible). Otherwise, @code{/tmp} will be used. The Octave functions the server is supposed to call and the files it possibly has to access must be available at the server machine. This can e.g. be achieved by having the server machine mount a network file system (which is outside the scope of this package documentation). The parent server process can only be terminated by sending it a signal. The pid of this process, as long as it is running, will be stored in the file @code{/tmp/.octave-.pid}. If a connection is accepted from a client, the server collects a network identifier and the names of all server machines of the network from the client. Then, connections are automatically established between all machines of the network. Data exchange will be possible between all machines (client or server) in both directions. Commands can only be sent from the client to any server. The opaque variable holding the network connections, in the same order as in the corresponding variable returned by @code{pconnect}, is accessible under the variable name @code{sockets} at the server side. Do not overwrite or clear this variable. The own server machine will also be contained at some index position of this variable, but will not correspond to a real connection. See @code{pconnect} for further information. @var{options}: structure of options; field @code{use_tls} is @code{true} by default (TLS with SRP authentication); if set to @code{false}, there will be no encryption or authentication. Field @code{auth_file} can be set to an alternative path to the file with authentication information (see below). The client and the server must both use or both not use TLS. If TLS is switched off, different measures must be taken to protect ports 12501 and 12502 at the servers and the client against unauthorized access; e.g. by a firewall or by physical isolation of the network. For using TLS, authorization data must be present at the server machine. These data can conveniently be generated by @code{parallel_generate_srp_data}; the helptext of the latter function documents the expected location of these data. The SRP password will be sent over the encrypted TLS channel from the client to each server, to avoid permanently storing passwords at the server for server-to-server data connections. Due to inevitable usage of external libraries, memory with sensitive data can, however, be on the swap device even after shutdown of the application. @seealso{@ref{XREFpconnect,,pconnect}, @ref{XREFreval,,reval}, @ref{XREFpsend,,psend}, @ref{XREFprecv,,precv}, @ref{XREFsclose,,sclose}, @ref{XREFparallel_generate_srp_data,,parallel_generate_srp_data}, @ref{XREFselect_sockets,,select_sockets}} @end deftypefn @c ------------------------------------------------------------------ @node pconnect @section Establishing cluster connections @mfnindex pconnect @c include function helptext here @c pconnect pconnect.cc @anchor{XREFpconnect} @deftypefn {Loadable Function} {@var{connections} =} pconnect (@var{hosts}) @deftypefnx {Loadable Function} {@var{connections} =} pconnect (@var{hosts}, @var{options}) Connects to a network of parallel cluster servers. As a precondition, a server must have been started at each machine of the cluster, see @code{pserver}. Connections are not guaranteed to work if client and server are from @code{parallel} packages of different versions, so versions should be kept equal. @var{hosts} is a cell-array of strings, holding the names of all server machines. The machines must be unique, and their names must be resolvable to the correct addresses also at each server machine, not only at the client. This means e.g. that the name @code{localhost} is not acceptable (exception: @code{localhost} is acceptable as the first of all names). Alternatively, but deprecated, @var{hosts} can be given as previously, as a character array with a machine name in each row. If it is given in this way, the first row must contain the name of the client machine (for backwards compatibility), so that there is one row more than the now preferred cell-array @var{hosts} would have entries. @code{pconnect} returns an opaque variable holding the network connections. This variable can be indexed to obtain a subset of connections or even a single connection. (For backwards compatibility, a second index of @code{:} is allowed, which has no effect). At the first index position is the client machine, so this position does not correspond to a real connection. At the following index positions are the server machines in the same order as specified in the cell-array @var{hosts}. So in the whole the variable of network connections has one position more than the number of servers given in @var{hosts} (except if @var{hosts} was given in the above mentioned deprecated way). You can display the variable of network connections to see what is in it. The variable of network connections, or subsets of it, is passed to the other functions for parallel cluster excecution (@code{reval}, @code{psend}, @code{precv}, @code{sclose}, @code{select_sockets} among others -- see documentation of these functions). @var{options}: structure of options; field @code{use_tls} is @code{true} by default (TLS with SRP authentication); if set to @code{false}, there will be no encryption or authentication. Field @code{password_file} can be set to an alternative path to the file with authentication information (see below). Field @code{user} can specify the username for authentication; if the username is so specified, no file with authentication information will be used at the client, but the password will be queried from the user. The client and the server must both use or both not use TLS. If TLS is switched off, different measures must be taken to protect ports 12501 and 12502 at the servers and the client against unauthorized access; e.g. by a firewall or by physical isolation of the network. For using TLS, authorization data must be present at the server machine. These data can conveniently be generated by @code{parallel_generate_srp_data}. By default, the client authentication file is created in the same run. The helptext of @code{parallel_generate_srp_data} documents the expected locations of the authentication data. The SRP password will be sent over the encrypted TLS channel from the client to each server, to avoid permanently storing passwords at the server for server-to-server data connections. Due to inevitable usage of external libraries, memory with sensitive data can, however, be on the swap device even after shutdown of the application, both at the client and at the server machines. Example (let data travel through all machines), assuming @code{pserver} was called on each remote machine and authentication data is present (e.g. generated with @code{parallel_generate_srp_data}): @example @group sockets = pconnect (@{'remote.machine.1', 'remote.machine.2'@}); reval ('psend (precv (sockets(2)), sockets(1))', sockets(3)); reval ('psend (precv (sockets(1)), sockets(3))', sockets(2)); psend ('some data', sockets(2)); precv (sockets(3)) --> ans = some data sclose (sockets); @end group @end example @seealso{@ref{XREFpserver,,pserver}, @ref{XREFreval,,reval}, @ref{XREFpsend,,psend}, @ref{XREFprecv,,precv}, @ref{XREFsclose,,sclose}, @ref{XREFparallel_generate_srp_data,,parallel_generate_srp_data}, @ref{XREFselect_sockets,,select_sockets}, @ref{XREFrfeval,,rfeval}} @end deftypefn @c ------------------------------------------------------------------ @node sclose @section Closing cluster connections @mfnindex sclose @c include function helptext here @c sclose sclose.cc @anchor{XREFsclose} @deftypefn {Loadable Function} {} sclose (@var{connections}) Close the parallel cluster network to which @var{connections} belongs. See @code{pconnect} for a description of the @var{connections} variable. All connections of the network are closed, even if @var{connections} contains only a subnet or a single connection. @seealso{@ref{XREFpconnect,,pconnect}, @ref{XREFpserver,,pserver}, @ref{XREFreval,,reval}, @ref{XREFpsend,,psend}, @ref{XREFprecv,,precv}, @ref{XREFparallel_generate_srp_data,,parallel_generate_srp_data}, @ref{XREFselect_sockets,,select_sockets}} @end deftypefn @c ------------------------------------------------------------------ @node network_get_info @section Get network information @mfnindex network_get_info @c include function helptext here @c network_get_info network_get_info.cc @anchor{XREFnetwork_get_info} @deftypefn {Loadable Function} {} network_get_info (@var{connections}) Return an informational structure-array with one entry for each machine specified by @var{connections}. This function can only be successfully called at the client machine. See @code{pconnect} for a description of the @var{connections} variable. @var{connections} can contain all connections of the network, a subset of them, or a single connection. For the local machine (client), if contained in @var{connections}, some fields of the returned structure may be empty. The fields of the returned structure are @code{local_machine}: true for the connection representing the local machine, @code{nproc}: number of usable processors of the machine, @code{nlocaljobs}: configured number of local processes on the machine, @code{peername}: name of the machine (empty for local machine), @code{open}: true if the connection is open, @code{network_id}: uuid of the network, @code{real_node_id}: internal id assigned to node, @code{0} for client, servers starting with @code{1}. @seealso{@ref{XREFpconnect,,pconnect}, @ref{XREFpserver,,pserver}, @ref{XREFreval,,reval}, @ref{XREFpsend,,psend}, @ref{XREFprecv,,precv}, @ref{XREFsclose,,sclose}, @ref{XREFparallel_generate_srp_data,,parallel_generate_srp_data}, @ref{XREFselect_sockets,,select_sockets}} @end deftypefn @c ------------------------------------------------------------------ @node network_set @section Set network properties @mfnindex network_set @c include function helptext here @c network_set network_set.cc @anchor{XREFnetwork_set} @deftypefn {Loadable Function} {} network_set (@var{connections}, @var{key}, @var{val}) Set the property named by @var{key} to the value @var{val} for each machine specified by @var{connections}. This function can only be successfully called at the client machine. See @code{pconnect} for a description of the @var{connections} variable. @var{connections} can contain all connections of the network, a subset of them, or a single connection. Possible values of @var{key}: @code{'nlocaljobs'}: configured number of local processes on the machine (usable by functions for parallel execution); needs a non-negative integer in @var{val}, @code{0} means not specified. @seealso{@ref{XREFpconnect,,pconnect}, @ref{XREFpserver,,pserver}, @ref{XREFreval,,reval}, @ref{XREFpsend,,psend}, @ref{XREFprecv,,precv}, @ref{XREFsclose,,sclose}, @ref{XREFparallel_generate_srp_data,,parallel_generate_srp_data}, @ref{XREFselect_sockets,,select_sockets}} @end deftypefn @c ------------------------------------------------------------------ @node netcellfun @section Function netcellfun @mfnindex netcellfun @c include function helptext here @c netcellfun netcellfun.copy_to_m @anchor{XREFnetcellfun} @deftypefn{Function File} {} netcellfun (@var{connections}, @var{fun}, @dots{}) Evaluates function @var{fun} in a parallel cluster and collects results. This function handles arguments and options equivalently to @code{parcellfun} and returnes equivalent output. Differently, the first argument specifies server machines for parallel remote execution, see @code{pconnect} for a description of the @var{connections} variable. A further difference is that the option "ChunksPerProc" is ignored and instead the chunk size can be specified directly with an option "ChunkSize". This function can only be successfully called at the client machine of the parallel cluster. @var{connections} can contain all connections of the network, a subset of them, or a single connection. The local machine (client), if contained in @var{connections}, is ignored. However, one of the servers can run at the local machine under certain conditions (see @code{pconnect}) and will not be ignored in this case, so that the local machine can take part in parallel execution with @code{netcellfun}. As a second level of parallelism, @var{fun} is executed at each server machine (using @code{parcellfun or pararrayfun}) by default in as many local processes in parallel as the server has processor cores available. The number of local parallel processes can be configured for each server with the "nlocaljobs" option (see @code{network_set}), a value of @code{0} means that the default value will be used, a value of @code{1} means that execution is not parallel within the server (but still parallel over the cluster). There are certain limitations on how @var{fun} can be defined. These are explained in the documentation of @code{rfeval}. Cluster execution incurs a considerable overhead. A speedup is likely if the computation time of @var{fun} is long. To speed up execution of a large set of arguments with short computation times of @var{fun}, increase "ChunkSize", possibly use "Vectorize" (see @code{pararrayfun}), and possibly experiment with increasing "nlocaljobs" from the default. @seealso{@ref{XREFnetarrayfun,,netarrayfun}, @ref{XREFpconnect,,pconnect}, @ref{XREFpserver,,pserver}, @ref{XREFsclose,,sclose}, @ref{XREFrfeval,,rfeval}, @ref{XREFinstall_vars,,install_vars}} @end deftypefn @c ------------------------------------------------------------------ @node netarrayfun @section Function netarrayfun @mfnindex netarrayfun @c include function helptext here @c netarrayfun netarrayfun.copy_to_m @anchor{XREFnetarrayfun} @deftypefn{Function File} {} netarrayfun (@var{connections}, @var{fun}, @dots{}) Evaluates function @var{fun} in a parallel cluster and collects results. This function handles arguments and options equivalently to @code{pararrayfun} and returnes equivalent output. Differently, the first argument specifies server machines for parallel remote execution, see @code{pconnect} for a description of the @var{connections} variable. A further difference is that the option "ChunksPerProc" is ignored and instead the chunk size can be specified directly with an option "ChunkSize" (option "Vectorized" can be used together with option "ChunkSize" in function @code{netarrayfun}). The further details of operation are the same as for @code{netcellfun}, please see there. @seealso{@ref{XREFnetcellfun,,netcellfun}, @ref{XREFpconnect,,pconnect}, @ref{XREFpserver,,pserver}, @ref{XREFsclose,,sclose}, @ref{XREFrfeval,,rfeval}, @ref{XREFinstall_vars,,install_vars}} @end deftypefn @c ------------------------------------------------------------------ @node install_vars @section Distribute Octave variables @mfnindex install_vars @c include function helptext here @c install_vars install_vars.copy_to_m @anchor{XREFinstall_vars} @deftypefn{Function File} {} install_vars (@var{varname}, @dots{}, @var{connections}) Install named variables at remote machines. The variables named in the arguments are distrubted to the remote machines specified by @var{connections} and installed there. The variables must be accessible within the calling function. If variables have been declared to have global scope, they will also have global scope at the remote machines. This function can only be successfully called at the client machine. See @code{pconnect} for a description of the @var{connections} variable. @var{connections} can contain all connections of the network, a subset of them, or a single connection. The local machine (client), if contained in @var{connections}, is ignored. To install, e.g., all visible variables, @code{install_vars (who ()@{:@}, @dots{});} can be used. Internally, this function sends the variables only to one server and then issues the necessary commands to distribute them to all specified servers over server-to-server data connections. @seealso{@ref{XREFpconnect,,pconnect}, @ref{XREFpserver,,pserver}, @ref{XREFsclose,,sclose}, @ref{XREFrfeval,,rfeval}, @ref{XREFnetcellfun,,netcellfun}} @end deftypefn @c ------------------------------------------------------------------ @node rfeval @section Single remote function evaluation @mfnindex rfeval @c include function helptext here @c rfeval rfeval.copy_to_m @anchor{XREFrfeval} @deftypefn{Function File} {} rfeval (@var{func}, @dots{}, @var{nout}, @var{isout}, @var{connection}) Evaluate a function at a remote machine. @var{func} is evaluated with arguments @code{@dots{}} and number of output arguments set to @var{nout} at remote machine given by @var{connection}. If @var{isout} is not empty, it must be a logical array with @var{nout} elements, which are true for each of the @var{nout} output arguments which are requested from the function; the other output arguments will be marked as not requested with @code{~} at remote execution. This function can only be successfully called at the client machine. See @code{pconnect} for a description of the @var{connection} variable. @var{connection} must contain one single connection. If an output argument is given to @code{rfeval}, the function waits for completion of the remote function call, retrieves the results and returns them. They will be returned as one cell-array with an entry for each output argument. If some output arguments are marked as not requested by setting some elements of @var{isout} to false, the returned cell-array will only have entries for the requested output arguments. For consistency, the returned cell-array can be empty. To assign the output arguments to single variables, you can for example use: @code{[a, b, c] = returned_cell_array@{:@};}. If no output argument is given to @code{rfeval}, the function does not retrieve the results of the remote function call but returns immediately. It is left to the user to retrieve the results with @code{precv}. The results will be in the same format as if returned by @code{rfeval}. Note that a cell-array, possibly empty, will always have to be retrieved, even if the remote function call should have been performed without output arguments. Parallel execution can be achieved by calling @code{rfeval} several times with different specified server machines before starting to retrieve the results. The specified function handle can refer to a function present at the executing machine or be an anonymous function. In the latter case, the function specification sent to the server includes the anonymous functions context (generation of the sent function specification is implemented in the Octave core). Sending a handle to a subfunction, however, will currently not work. Sending a handle to a private function will only work if its file path is the same at the server. Sending an anonymous function using "varargin" in the argument list will currently not work. @seealso{@ref{XREFpconnect,,pconnect}, @ref{XREFpserver,,pserver}, @ref{XREFsclose,,sclose}, @ref{XREFinstall_vars,,install_vars}, @ref{XREFnetcellfun,,netcellfun}} @end deftypefn @c ------------------------------------------------------------------ @node psend @section Sending Octave variables @mfnindex psend @c include function helptext here @c psend psend.cc @anchor{XREFpsend} @deftypefn {Loadable Function} {} psend (@var{value}, @var{connections}) Send the value in variable @var{value} to all parallel cluster machines specified by @var{connections}. This function can be called both at the client machine and (with @code{reval}) at a server machine. See @code{pconnect} for a description of the @var{connections} variable, and @code{pserver} for a description of this variable (named @code{sockets}) at the server side. @var{connections} can contain all connections of the network, a subset of them, or a single connection. The machine at which @code{psend} was called (client or server), if contained in the @var{connections} variable, is ignored. The value sent with @code{psend} must be received with @code{precv} at the target machine. Note that values can be sent to each machine, even from a server machine to a different server machine. If @code{psend} is called at the client machine, a corresponding @code{precv} should have been called before at the target machine, otherwise the client will hang if @var{value} contains large data (which can not be held by the operating systems socket buffers). @seealso{@ref{XREFpconnect,,pconnect}, @ref{XREFpserver,,pserver}, @ref{XREFreval,,reval}, @ref{XREFprecv,,precv}, @ref{XREFsclose,,sclose}, @ref{XREFparallel_generate_srp_data,,parallel_generate_srp_data}, @ref{XREFselect_sockets,,select_sockets}} @end deftypefn @c ------------------------------------------------------------------ @node precv @section Receiving Octave variables @mfnindex precv @c include function helptext here @c precv precv.cc @anchor{XREFprecv} @deftypefn {Loadable Function} {} precv (@var{single_connection}) Receive a data value from the parallel cluster machine specified by @var{single_connection}. This function can be called both at the client machine and (with @code{reval}) at a server machine. @var{single_connection} must be a single connection obtained by indexing the @var{connections} variable. Please see @code{pconnect} for a description of the @var{connections} variable, and @code{pserver} for a description of this variable (named @code{sockets}) at the server side. If @var{single_connection} corresponds to the machine at which @code{precv} was called, an error is thrown. The value received with @code{precv} must be sent with @code{psend} from another machine of the cluster. Note that data can be transferred this way between each pair of machines, even sent by a server and received by a different server. If @code{precv} is called at the client machine, a corresponding @code{psend} should have been called before at the source machine, otherwise the client will hang. @seealso{@ref{XREFpconnect,,pconnect}, @ref{XREFpserver,,pserver}, @ref{XREFreval,,reval}, @ref{XREFpsend,,psend}, @ref{XREFsclose,,sclose}, @ref{XREFparallel_generate_srp_data,,parallel_generate_srp_data}, @ref{XREFselect_sockets,,select_sockets}} @end deftypefn @c ------------------------------------------------------------------ @node reval @section Remote command evaluation @mfnindex reval @c include function helptext here @c reval reval.cc @anchor{XREFreval} @deftypefn {Loadable Function} {} reval (@var{commands}, @var{connections}) Evaluate @var{commands} at all remote hosts specified by @var{connections}. This function can only be successfully called at the client machine. @var{commands} must be a string containing Octave commands suitable for execution with Octaves @code{eval()} function. See @code{pconnect} for a description of the @var{connections} variable. @var{connections} can contain all connections of the network, a subset of them, or a single connection. The local machine (client), if contained in @var{connections}, is ignored. @var{commands} is executed in the same way at each specified machine. @seealso{@ref{XREFpconnect,,pconnect}, @ref{XREFpserver,,pserver}, @ref{XREFpsend,,psend}, @ref{XREFprecv,,precv}, @ref{XREFsclose,,sclose}, @ref{XREFparallel_generate_srp_data,,parallel_generate_srp_data}, @ref{XREFselect_sockets,,select_sockets}} @end deftypefn @c ------------------------------------------------------------------ @node select_sockets @section Call Unix @code{select} for data connections @mfnindex select sockets @c include function helptext here @c select_sockets select_sockets.cc @anchor{XREFselect_sockets} @deftypefn {Loadable Function} {} select_sockets (@var{connections}, @var{timeout}) @deftypefnx {Loadable Function} {} select_sockets (@var{connections}, @var{timeout}, @var{nfds}) Calls Unix @code{select} for data connections in a parallel cluster. This function is for advanced usage (and therefore has minimal documentation), typically the programming of schedulers. It can be called at the client or at a server. @var{connections}: valid connections object (see @code{pconnect} and @code{pserver}, possibly indexed). @var{timeout}: seconds, negative for infinite. @var{nfds}: Passed to Unix @code{select} as first argument, see documentation of Uix @code{select}. Default: @code{FD_SETSIZE} (platform specific). An error is returned if nfds or a watched filedescriptor plus one exceeds FD_SETSIZE. Returns an index vector to @var{connections} indicating connections with pending input, readable with @code{precv}. If called at the client, the command connections are included into the UNIX @code{select} call and checked for error flags, and @code{select_sockets} returns an error if a flag for a remote error is received. @seealso{@ref{XREFpconnect,,pconnect}, @ref{XREFpserver,,pserver}, @ref{XREFreval,,reval}, @ref{XREFpsend,,psend}, @ref{XREFprecv,,precv}, @ref{XREFsclose,,sclose}, @ref{XREFparallel_generate_srp_data,,parallel_generate_srp_data}} @end deftypefn @c ------------------------------------------------------------------ @node Limitations @section Limitations of high- and medium-level functions @cindex limitations For the function handles passed as arguments to @ref{netcellfun}, @ref{netarrayfun}, and @ref{rfeval}, the following limitations currently apply: @itemize @item If a handle to a named function is passed, this function must exist on the server machine. @item A handle to a subfunction can not be passed. @item A handle to a private function can only be passed if its file path is the same at the server. @item If an anonymous function is passed, it may not have been defined using @code{varargin}. @end itemize Anonymous functions should be usable as usual, since the function specification sent to the server will include the anonymous functions context. @c ------------------------------------------------------------------ @node Example @section Example @cindex example @example # From Octave prompt, generate authentication files, set user name to # 'test'. When prompted for a password, press . parallel_generate_srp_data ('test') # From Octave prompt, get location of the generated files. authpath = fullfile (a = pkg ("prefix"), "parallel-srp-data") Copy server files to servers, authpath is assumed to be "/home/test/octave/parallel-srp-data/", the same directory is assumed to exist on the servers. From the system shell, do e.g.: scp -r /home/test/octave/parallel-srp-data/server server1:/home/test/octave/parallel-srp-data/ scp -r /home/test/octave/parallel-srp-data/server server2:/home/test/octave/parallel-srp-data/ Start server at remote machines. From the system shell, do e.g.: ssh server1 'octave --eval "pserver"' ssh server2 'octave --eval "pserver"' # From Octave prompt, connect the cluster. conns = pconnect (@{"server1", "server2"@}) # And perform some parallel execution. Single function calls take 1 # second each. results = netcellfun (conns, @ (x) @{x, pause(1)@}@{:@}, num2cell (1:30)) # Close network. sclose (conns) @end example @c ------------------------------------------------------------------ @node Further functions @chapter Functions possibly helpful in parallel execution @menu * fsave fload:: Transfer variable within the local machine over an Octave stream. * select:: Call Unix @code{select} on Octave streams. @end menu @c ------------------------------------------------------------------ @node fsave fload @section Transfer variable within the local machine over an Octave stream @mfnindex fsave @mfnindex fload @c include function helptext here @c fsave fsave.cc @anchor{XREFfsave} @deftypefn {Loadable Function} {} fsave (@var{fid}, @var{var}) Save a single variable to a binary stream, to be subsequently loaded with fload. Returns true if successful. Not suitable for data transfer between machines of different type. @end deftypefn @c include function helptext here @c fload fload.cc @anchor{XREFfload} @deftypefn {Loadable Function} {@var{var} =} fload (@var{fid}) Loads a single variable of any type from a binary stream, where it was previously saved with fsave. Not suitable for data transfer between machines of different type. @end deftypefn @c ------------------------------------------------------------------ @node select @section Call Unix @code{select} on Octave streams @mfnindex select Note that for cluster connections @ref{select_sockets} should be used instead. @c include function helptext here @c select select.cc @anchor{XREFselect} @deftypefn {Loadable Function} {[@var{n}, @var{ridx}, @var{widx}, @var{eidx}] =} select (@var{read_fids}, @var{write_fids}, @var{except_fids}, @var{timeout}[, @var{nfds}]) Calls Unix @code{select}, see the respective manual. The following interface was chosen: @var{read_fids}, @var{write_fids}, @var{except_fids}: vectors of stream-ids. @var{timeout}: seconds, negative for infinite. @var{nfds}: optional, default is Unix' FD_SETSIZE (platform specific). An error is returned if nfds or a filedescriptor belonging to a stream-id plus one exceeds FD_SETSIZE. Return values are: @var{n}: number of ready streams. @var{ridx}, @var{widx}, @var{eidx}: index vectors of ready streams in @var{read_fids}, @var{write_fids}, and @var{except_fids}, respectively. @end deftypefn @c ------------------------------------------------------------------ @node Documentation @chapter Function parallel_doc to view documentation @cindex documentation @mfnindex parallel_doc @c include function helptext here @c parallel_doc ../inst/parallel_doc.m @anchor{XREFparallel_doc} @deftypefn {Function File} {} parallel_doc () @deftypefnx {Function File} {} parallel_doc (@var{keyword}) Show parallel package documentation. Runs the info viewer Octave is configured with on the documentation in info format of the installed parallel package. Without argument, the top node of the documentation is displayed. With an argument, the respective index entry is searched for and its node displayed. @end deftypefn @c ------------------------------------------------------------------ @node Function index @unnumbered Index of functions in parallel @printindex mfn @c ------------------------------------------------------------------ @node Concept index @unnumbered Concept index @printindex cp @bye parallel-3.1.3/doc/PaxHeaders.30520/parallel.info0000644000000000000000000000013213331003671016253 xustar0030 mtime=1533282233.005053564 30 atime=1533282232.913051748 30 ctime=1533282233.633065964 parallel-3.1.3/doc/parallel.info0000644000175000017500000013674213331003671016466 0ustar00olafolaf00000000000000This is parallel.info, produced by makeinfo version 6.3 from parallel.texi. General documentation for the parallel package for Octave. Copyright (C) > You can redistribute this documentation and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this documentation; if not, see .  File: parallel.info, Node: Top, Next: Installation, Up: (dir) General documentation for the parallel package for Octave ********************************************************* This documentation applies to version 3.1.3 of the parallel package. The package contains functions for explicit local parallel execution, and functions for parallel execution over a cluster of machines, possibly combined with local parallel execution at each machine of the cluster. The cluster-related functions may be disabled in distributed binaries of the parallel package for some operating systems. An alternative to the parallel package is the mpi package. * Menu: * Installation:: Installation hints. * Local execution:: Functions for local parallel execution. * Cluster execution:: Functions for parallel execution over a cluster of machines. * Further functions:: Functions possibly helpful in parallel execution. * Documentation:: Function parallel_doc to view documentation. Indices * Function index:: Index of functions in database. * Concept index:: Concept index.  File: parallel.info, Node: Installation, Next: Local execution, Prev: Top, Up: Top 1 Installation hints ******************** _Note:_ For using a cluster of machines, identical versions of the package are required to be installed at each machine. Maybe your distribution provides the parallel package. If not, or if you want a newer version, Octaves 'pkg' command allows building the package from source and installing it. Note that you have to 'load' any Octave package before you can use it. See Octaves documentation of 'pkg'. The functions for parallel execution over a cluster of machines can be disabled by a configure option. There is currently no way, however, to specify configure options when building a package with 'pkg'. Parallel execution over a cluster by default is protected by encryption with authentication. This needs a version of the gnutls library in which TLS-SRP is not disabled. For building the parallel package from source, this library must be present during the build; some operating systems provide development files of libraries in exta '...-dev' packages, which are also needed during the build. Building or using the package for cluster execution without gnutls will work, but encryption and authentication are not available in this case.  File: parallel.info, Node: Local execution, Next: Cluster execution, Prev: Installation, Up: Top 2 Functions for local parallel execution **************************************** Explicit local parallel execution, with the intent to exploit more than one local processor(-core), is performed by calling a user-defined function in parallel with several different arguments. This is done in parallel _processes_, so any changes to (global) variables in the user-defined function will only be visible within the same function call. The interface of the functions for local parallel execution is similar to Octaves 'cellfun' and 'parcellfun' functions. Note that some operations in Octave, particularly some matrix operations, may already be performed in parallel threads. This may limit the advantage yielded by explicit local parallel execution. Also, RAM access can be a bottleneck which limits computation speed of multicore computing. * Menu: * parcellfun:: Function parcellfun. * pararrayfun:: Function pararrayfun.  File: parallel.info, Node: parcellfun, Next: pararrayfun, Up: Local execution 2.1 Function parcellfun ======================= -- Function File: [O1, O2, ...] = parcellfun (NPROC, FUN, A1, A2, ...) -- Function File: parcellfun (nproc, fun, ..., "UniformOutput", VAL) -- Function File: parcellfun (nproc, fun, ..., "ErrorHandler", ERRFUNC) -- Function File: parcellfun (nproc, fun, ..., "VerboseLevel", VAL) -- Function File: parcellfun (nproc, fun, ..., "ChunksPerProc", VAL) -- Function File: parcellfun (nproc, fun, ..., "CumFunc", CUMFUNC) Evaluates a function for multiple argument sets using multiple processes. NPROC should specify the number of processes. A maximum recommended value is equal to number of CPUs on your machine or one less. FUN is a function handle pointing to the requested evaluating function. A1, A2 etc. should be cell arrays of equal size. O1, O2 etc. will be set to corresponding output arguments. The UniformOutput and ErrorHandler options are supported with meaning identical to "cellfun". A VerboseLevel option controlling the level output is supported. A value of 0 is quiet, 1 is normal, and 2 or more enables debugging output. The ChunksPerProc option control the number of chunks which contains elementary jobs. This option particularly useful when time execution of function is small. Setting this option to 100 is a good choice in most cases. Instead of returning a result for each argument, parcellfun returns only one cumulative result if "CumFunc" is non-empty. CUMFUNC must be a function which performs an operation on two sets of outputs of FUN and returnes as many outputs as FUN. If NOUT is the number of outputs of FUN, CUMFUNC gets a previous output set of FUN or of CUMFUNC as first NOUT arguments and the current output of FUN as last NOUT arguments. The performed operation must be mathematically commutative and associative. If the operation is e.g. addition, the result will be the sum(s) of the outputs of FUN over all calls of FUN. Since floating point addition and multiplication are only approximately associative, the cumulative result will not be exactly reproducible. Notice that jobs are served from a single first-come first-served queue, so the number of jobs executed by each process is generally unpredictable. This means, for example, that when using this function to perform Monte-Carlo simulations one cannot expect results to be exactly reproducible. The pseudo random number generators of each process are initialised with a unique state. This currently works only for new style generators. NOTE: this function is implemented using "fork" and a number of pipes for IPC. Suitable for systems with an efficient "fork" implementation (such as GNU/Linux), on other systems (Windows) it should be used with caution. Also, if you use a multithreaded BLAS, it may be wise to turn off multi-threading when using this function. CAUTION: This function should be regarded as experimental. Although all subprocesses should be cleared in theory, there is always a danger of a subprocess hanging up, especially if unhandled errors occur. Under GNU and compatible systems, the following shell command may be used to display orphaned Octave processes: ps -ppid 1 | grep octave  File: parallel.info, Node: pararrayfun, Prev: parcellfun, Up: Local execution 2.2 Function pararrayfun ======================== -- Function File: [O1, O2, ...] = pararrayfun (NPROC, FUN, A1, A2, ...) -- Function File: pararrayfun (nproc, fun, ..., "UniformOutput", VAL) -- Function File: pararrayfun (nproc, fun, ..., "ErrorHandler", ERRFUNC) Evaluates a function for corresponding elements of an array. Argument and options handling is analogical to 'parcellfun', except that arguments are arrays rather than cells. If cells occur as arguments, they are treated as arrays of singleton cells. Arrayfun supports one extra option compared to parcellfun: "Vectorized". This option must be given together with "ChunksPerProc" and it indicates that FUN is able to operate on vectors rather than just scalars, and returns a vector. The same must be true for ERRFUNC, if given. In this case, the array is split into chunks which are then directly served to FUNC for evaluation, and the results are concatenated to output arrays. If "CumFunc" is also specified (see 'parcellfun'), FUN is expected to return the result of the same cumulative operation instead of vectors. See also *note parcellfun: XREFparcellfun, *note arrayfun: (octave)XREFarrayfun.  File: parallel.info, Node: Cluster execution, Next: Further functions, Prev: Local execution, Up: Top 3 Functions for parallel execution over a cluster of machines ************************************************************* There are high level functions, similar to *note parcellfun:: and *note pararrayfun::, which only require the user to provide a function to be called and a series of argument sets. Parallel function calls are then internally distributed over the cluster, and over the local processors (or processor cores) within the single machines of the cluster. Medium and low level functions are also provided. These require the user to program the scheduling of parallel execution. Data transfer is possible between the client machine and each server machine, but also directly between server machines. The latter feature is exploited e.g. by the *note install_vars:: function. * Menu: * Security:: Security considerations. * Authentication:: Generating authentication keys. * pserver:: Starting servers. Connection-related functions * pconnect:: Establishing cluster connections. * sclose:: Closing cluster connections. * network_get_info:: Get network information. * network_set:: Set network properties. High level functions * netcellfun:: Function netcellfun. * netarrayfun:: Function netarrayfun. * install_vars:: Distribute Octave variables. Medium level functions * rfeval:: Single remote function evaluation. Low level functions * psend:: Sending Octave variables. * precv:: Receiving Octave variables. * reval:: Remote command evaluation. * select_sockets:: Call Unix 'select' for data connections. * Limitations:: Limitations of high- and medium-level functions. * Example:: Example  File: parallel.info, Node: Security, Next: Authentication, Up: Cluster execution 3.1 Security considerations =========================== Over a connection to a server of the parallel package arbitrary Octave commands can be executed at the server machine. This means that any change can be done to the server system and the resident data, only limited by the rights of the system account under which the server runs. By default, the server is started with authentication and encryption enabled, to avoid unauthorized access. If the server is started with authentication disabled (maybe to avoid the encryption overhead), it must be cared for that no TCP connection by unauthorized persons is possible to the server ports, possibly by running the client and all server machines behind a firewall and assuring that only trusted persons have access to any machine behind the firewall. This scenario might be achievable in home-nets. The server currently uses port 12502 for receiving commands and port 12501 for data exchange. The client and the servers used by the client with 'pconnect' must agree on using authentication or not. Do not start the server as root.  File: parallel.info, Node: Authentication, Next: pserver, Prev: Security, Up: Cluster execution 3.2 Generating authentication keys ================================== -- Loadable Function: parallel_generate_srp_data (USERNAME) -- Loadable Function: parallel_generate_srp_data (USERNAME, OPTIONS) Prompts for a password (press enter for a random password) and writes TLS-SRP authentication files into the directory given by: 'fullfile (a = pkg ("prefix"), "parallel-srp-data")' Server files are placed in subdirectory 'server'. By default, a client authentication file is placed in subdirectory 'client'. The latter contains the given USERNAME and the cleartext password. You do not need this file if you prefer to be prompted for username and password at connection time. In this case, you can prevent the client authentication file from being written by passing as the argument OPTIONS a structure with a value of 'false' in the field 'unattended'. For authentication, subdir 'server', and possibly subdir 'client', have to be placed together with their contents at the respective machines. They can either be placed under the directory given by: 'fullfile (OCTAVE_HOME (), "share", "octave", "parallel-srp-data")' or - which might be the same directory - under: 'fullfile (a = pkg ("prefix"), "parallel-srp-data")' Files in the former directory will take precedence over those in the latter. The contents of the files 'passwd' and 'user_passwd' (if present) must be kept secret. This function zeroizes sensitive data before releasing its memory. Due to usage of external libraries, however, it still can't be excluded that sensitive data is still on the swap device after application shutdown. See also: *note pconnect: XREFpconnect, *note pserver: XREFpserver, *note reval: XREFreval, *note psend: XREFpsend, *note precv: XREFprecv, *note sclose: XREFsclose, *note select_sockets: XREFselect_sockets.  File: parallel.info, Node: pserver, Next: pconnect, Prev: Authentication, Up: Cluster execution 3.3 Starting servers ==================== -- Loadable Function: pserver () -- Loadable Function: pserver (OPTIONS) This function starts a server of the parallel cluster and should be called once at any server machine. It is important to call this function in a way assuring that Octave is quit as soon as the function returns, i.e. call it e.g. like 'octave --eval "pserver"' or 'octave --eval "pserver (struct ('fieldname', value))"'. If a directory path corresponding to the current directory of the client exists on the server machine, it will be used as the servers current directory for the respective client (multiple clients are possible). Otherwise, '/tmp' will be used. The Octave functions the server is supposed to call and the files it possibly has to access must be available at the server machine. This can e.g. be achieved by having the server machine mount a network file system (which is outside the scope of this package documentation). The parent server process can only be terminated by sending it a signal. The pid of this process, as long as it is running, will be stored in the file '/tmp/.octave-.pid'. If a connection is accepted from a client, the server collects a network identifier and the names of all server machines of the network from the client. Then, connections are automatically established between all machines of the network. Data exchange will be possible between all machines (client or server) in both directions. Commands can only be sent from the client to any server. The opaque variable holding the network connections, in the same order as in the corresponding variable returned by 'pconnect', is accessible under the variable name 'sockets' at the server side. Do not overwrite or clear this variable. The own server machine will also be contained at some index position of this variable, but will not correspond to a real connection. See 'pconnect' for further information. OPTIONS: structure of options; field 'use_tls' is 'true' by default (TLS with SRP authentication); if set to 'false', there will be no encryption or authentication. Field 'auth_file' can be set to an alternative path to the file with authentication information (see below). The client and the server must both use or both not use TLS. If TLS is switched off, different measures must be taken to protect ports 12501 and 12502 at the servers and the client against unauthorized access; e.g. by a firewall or by physical isolation of the network. For using TLS, authorization data must be present at the server machine. These data can conveniently be generated by 'parallel_generate_srp_data'; the helptext of the latter function documents the expected location of these data. The SRP password will be sent over the encrypted TLS channel from the client to each server, to avoid permanently storing passwords at the server for server-to-server data connections. Due to inevitable usage of external libraries, memory with sensitive data can, however, be on the swap device even after shutdown of the application. See also: *note pconnect: XREFpconnect, *note reval: XREFreval, *note psend: XREFpsend, *note precv: XREFprecv, *note sclose: XREFsclose, *note parallel_generate_srp_data: XREFparallel_generate_srp_data, *note select_sockets: XREFselect_sockets.  File: parallel.info, Node: pconnect, Next: sclose, Prev: pserver, Up: Cluster execution 3.4 Establishing cluster connections ==================================== -- Loadable Function: CONNECTIONS = pconnect (HOSTS) -- Loadable Function: CONNECTIONS = pconnect (HOSTS, OPTIONS) Connects to a network of parallel cluster servers. As a precondition, a server must have been started at each machine of the cluster, see 'pserver'. Connections are not guaranteed to work if client and server are from 'parallel' packages of different versions, so versions should be kept equal. HOSTS is a cell-array of strings, holding the names of all server machines. The machines must be unique, and their names must be resolvable to the correct addresses also at each server machine, not only at the client. This means e.g. that the name 'localhost' is not acceptable (exception: 'localhost' is acceptable as the first of all names). Alternatively, but deprecated, HOSTS can be given as previously, as a character array with a machine name in each row. If it is given in this way, the first row must contain the name of the client machine (for backwards compatibility), so that there is one row more than the now preferred cell-array HOSTS would have entries. 'pconnect' returns an opaque variable holding the network connections. This variable can be indexed to obtain a subset of connections or even a single connection. (For backwards compatibility, a second index of ':' is allowed, which has no effect). At the first index position is the client machine, so this position does not correspond to a real connection. At the following index positions are the server machines in the same order as specified in the cell-array HOSTS. So in the whole the variable of network connections has one position more than the number of servers given in HOSTS (except if HOSTS was given in the above mentioned deprecated way). You can display the variable of network connections to see what is in it. The variable of network connections, or subsets of it, is passed to the other functions for parallel cluster excecution ('reval', 'psend', 'precv', 'sclose', 'select_sockets' among others - see documentation of these functions). OPTIONS: structure of options; field 'use_tls' is 'true' by default (TLS with SRP authentication); if set to 'false', there will be no encryption or authentication. Field 'password_file' can be set to an alternative path to the file with authentication information (see below). Field 'user' can specify the username for authentication; if the username is so specified, no file with authentication information will be used at the client, but the password will be queried from the user. The client and the server must both use or both not use TLS. If TLS is switched off, different measures must be taken to protect ports 12501 and 12502 at the servers and the client against unauthorized access; e.g. by a firewall or by physical isolation of the network. For using TLS, authorization data must be present at the server machine. These data can conveniently be generated by 'parallel_generate_srp_data'. By default, the client authentication file is created in the same run. The helptext of 'parallel_generate_srp_data' documents the expected locations of the authentication data. The SRP password will be sent over the encrypted TLS channel from the client to each server, to avoid permanently storing passwords at the server for server-to-server data connections. Due to inevitable usage of external libraries, memory with sensitive data can, however, be on the swap device even after shutdown of the application, both at the client and at the server machines. Example (let data travel through all machines), assuming 'pserver' was called on each remote machine and authentication data is present (e.g. generated with 'parallel_generate_srp_data'): sockets = pconnect ({'remote.machine.1', 'remote.machine.2'}); reval ('psend (precv (sockets(2)), sockets(1))', sockets(3)); reval ('psend (precv (sockets(1)), sockets(3))', sockets(2)); psend ('some data', sockets(2)); precv (sockets(3)) --> ans = some data sclose (sockets); See also: *note pserver: XREFpserver, *note reval: XREFreval, *note psend: XREFpsend, *note precv: XREFprecv, *note sclose: XREFsclose, *note parallel_generate_srp_data: XREFparallel_generate_srp_data, *note select_sockets: XREFselect_sockets, *note rfeval: XREFrfeval.  File: parallel.info, Node: sclose, Next: network_get_info, Prev: pconnect, Up: Cluster execution 3.5 Closing cluster connections =============================== -- Loadable Function: sclose (CONNECTIONS) Close the parallel cluster network to which CONNECTIONS belongs. See 'pconnect' for a description of the CONNECTIONS variable. All connections of the network are closed, even if CONNECTIONS contains only a subnet or a single connection. See also: *note pconnect: XREFpconnect, *note pserver: XREFpserver, *note reval: XREFreval, *note psend: XREFpsend, *note precv: XREFprecv, *note parallel_generate_srp_data: XREFparallel_generate_srp_data, *note select_sockets: XREFselect_sockets.  File: parallel.info, Node: network_get_info, Next: network_set, Prev: sclose, Up: Cluster execution 3.6 Get network information =========================== -- Loadable Function: network_get_info (CONNECTIONS) Return an informational structure-array with one entry for each machine specified by CONNECTIONS. This function can only be successfully called at the client machine. See 'pconnect' for a description of the CONNECTIONS variable. CONNECTIONS can contain all connections of the network, a subset of them, or a single connection. For the local machine (client), if contained in CONNECTIONS, some fields of the returned structure may be empty. The fields of the returned structure are 'local_machine': true for the connection representing the local machine, 'nproc': number of usable processors of the machine, 'nlocaljobs': configured number of local processes on the machine, 'peername': name of the machine (empty for local machine), 'open': true if the connection is open, 'network_id': uuid of the network, 'real_node_id': internal id assigned to node, '0' for client, servers starting with '1'. See also: *note pconnect: XREFpconnect, *note pserver: XREFpserver, *note reval: XREFreval, *note psend: XREFpsend, *note precv: XREFprecv, *note sclose: XREFsclose, *note parallel_generate_srp_data: XREFparallel_generate_srp_data, *note select_sockets: XREFselect_sockets.  File: parallel.info, Node: network_set, Next: netcellfun, Prev: network_get_info, Up: Cluster execution 3.7 Set network properties ========================== -- Loadable Function: network_set (CONNECTIONS, KEY, VAL) Set the property named by KEY to the value VAL for each machine specified by CONNECTIONS. This function can only be successfully called at the client machine. See 'pconnect' for a description of the CONNECTIONS variable. CONNECTIONS can contain all connections of the network, a subset of them, or a single connection. Possible values of KEY: ''nlocaljobs'': configured number of local processes on the machine (usable by functions for parallel execution); needs a non-negative integer in VAL, '0' means not specified. See also: *note pconnect: XREFpconnect, *note pserver: XREFpserver, *note reval: XREFreval, *note psend: XREFpsend, *note precv: XREFprecv, *note sclose: XREFsclose, *note parallel_generate_srp_data: XREFparallel_generate_srp_data, *note select_sockets: XREFselect_sockets.  File: parallel.info, Node: netcellfun, Next: netarrayfun, Prev: network_set, Up: Cluster execution 3.8 Function netcellfun ======================= -- Function File: netcellfun (CONNECTIONS, FUN, ...) Evaluates function FUN in a parallel cluster and collects results. This function handles arguments and options equivalently to 'parcellfun' and returnes equivalent output. Differently, the first argument specifies server machines for parallel remote execution, see 'pconnect' for a description of the CONNECTIONS variable. A further difference is that the option "ChunksPerProc" is ignored and instead the chunk size can be specified directly with an option "ChunkSize". This function can only be successfully called at the client machine of the parallel cluster. CONNECTIONS can contain all connections of the network, a subset of them, or a single connection. The local machine (client), if contained in CONNECTIONS, is ignored. However, one of the servers can run at the local machine under certain conditions (see 'pconnect') and will not be ignored in this case, so that the local machine can take part in parallel execution with 'netcellfun'. As a second level of parallelism, FUN is executed at each server machine (using 'parcellfun or pararrayfun') by default in as many local processes in parallel as the server has processor cores available. The number of local parallel processes can be configured for each server with the "nlocaljobs" option (see 'network_set'), a value of '0' means that the default value will be used, a value of '1' means that execution is not parallel within the server (but still parallel over the cluster). There are certain limitations on how FUN can be defined. These are explained in the documentation of 'rfeval'. Cluster execution incurs a considerable overhead. A speedup is likely if the computation time of FUN is long. To speed up execution of a large set of arguments with short computation times of FUN, increase "ChunkSize", possibly use "Vectorize" (see 'pararrayfun'), and possibly experiment with increasing "nlocaljobs" from the default. See also: *note netarrayfun: XREFnetarrayfun, *note pconnect: XREFpconnect, *note pserver: XREFpserver, *note sclose: XREFsclose, *note rfeval: XREFrfeval, *note install_vars: XREFinstall_vars.  File: parallel.info, Node: netarrayfun, Next: install_vars, Prev: netcellfun, Up: Cluster execution 3.9 Function netarrayfun ======================== -- Function File: netarrayfun (CONNECTIONS, FUN, ...) Evaluates function FUN in a parallel cluster and collects results. This function handles arguments and options equivalently to 'pararrayfun' and returnes equivalent output. Differently, the first argument specifies server machines for parallel remote execution, see 'pconnect' for a description of the CONNECTIONS variable. A further difference is that the option "ChunksPerProc" is ignored and instead the chunk size can be specified directly with an option "ChunkSize" (option "Vectorized" can be used together with option "ChunkSize" in function 'netarrayfun'). The further details of operation are the same as for 'netcellfun', please see there. See also: *note netcellfun: XREFnetcellfun, *note pconnect: XREFpconnect, *note pserver: XREFpserver, *note sclose: XREFsclose, *note rfeval: XREFrfeval, *note install_vars: XREFinstall_vars.  File: parallel.info, Node: install_vars, Next: rfeval, Prev: netarrayfun, Up: Cluster execution 3.10 Distribute Octave variables ================================ -- Function File: install_vars (VARNAME, ..., CONNECTIONS) Install named variables at remote machines. The variables named in the arguments are distrubted to the remote machines specified by CONNECTIONS and installed there. The variables must be accessible within the calling function. If variables have been declared to have global scope, they will also have global scope at the remote machines. This function can only be successfully called at the client machine. See 'pconnect' for a description of the CONNECTIONS variable. CONNECTIONS can contain all connections of the network, a subset of them, or a single connection. The local machine (client), if contained in CONNECTIONS, is ignored. To install, e.g., all visible variables, 'install_vars (who (){:}, ...);' can be used. Internally, this function sends the variables only to one server and then issues the necessary commands to distribute them to all specified servers over server-to-server data connections. See also: *note pconnect: XREFpconnect, *note pserver: XREFpserver, *note sclose: XREFsclose, *note rfeval: XREFrfeval, *note netcellfun: XREFnetcellfun.  File: parallel.info, Node: rfeval, Next: psend, Prev: install_vars, Up: Cluster execution 3.11 Single remote function evaluation ====================================== -- Function File: rfeval (FUNC, ..., NOUT, ISOUT, CONNECTION) Evaluate a function at a remote machine. FUNC is evaluated with arguments '...' and number of output arguments set to NOUT at remote machine given by CONNECTION. If ISOUT is not empty, it must be a logical array with NOUT elements, which are true for each of the NOUT output arguments which are requested from the function; the other output arguments will be marked as not requested with '~' at remote execution. This function can only be successfully called at the client machine. See 'pconnect' for a description of the CONNECTION variable. CONNECTION must contain one single connection. If an output argument is given to 'rfeval', the function waits for completion of the remote function call, retrieves the results and returns them. They will be returned as one cell-array with an entry for each output argument. If some output arguments are marked as not requested by setting some elements of ISOUT to false, the returned cell-array will only have entries for the requested output arguments. For consistency, the returned cell-array can be empty. To assign the output arguments to single variables, you can for example use: '[a, b, c] = returned_cell_array{:};'. If no output argument is given to 'rfeval', the function does not retrieve the results of the remote function call but returns immediately. It is left to the user to retrieve the results with 'precv'. The results will be in the same format as if returned by 'rfeval'. Note that a cell-array, possibly empty, will always have to be retrieved, even if the remote function call should have been performed without output arguments. Parallel execution can be achieved by calling 'rfeval' several times with different specified server machines before starting to retrieve the results. The specified function handle can refer to a function present at the executing machine or be an anonymous function. In the latter case, the function specification sent to the server includes the anonymous functions context (generation of the sent function specification is implemented in the Octave core). Sending a handle to a subfunction, however, will currently not work. Sending a handle to a private function will only work if its file path is the same at the server. Sending an anonymous function using "varargin" in the argument list will currently not work. See also: *note pconnect: XREFpconnect, *note pserver: XREFpserver, *note sclose: XREFsclose, *note install_vars: XREFinstall_vars, *note netcellfun: XREFnetcellfun.  File: parallel.info, Node: psend, Next: precv, Prev: rfeval, Up: Cluster execution 3.12 Sending Octave variables ============================= -- Loadable Function: psend (VALUE, CONNECTIONS) Send the value in variable VALUE to all parallel cluster machines specified by CONNECTIONS. This function can be called both at the client machine and (with 'reval') at a server machine. See 'pconnect' for a description of the CONNECTIONS variable, and 'pserver' for a description of this variable (named 'sockets') at the server side. CONNECTIONS can contain all connections of the network, a subset of them, or a single connection. The machine at which 'psend' was called (client or server), if contained in the CONNECTIONS variable, is ignored. The value sent with 'psend' must be received with 'precv' at the target machine. Note that values can be sent to each machine, even from a server machine to a different server machine. If 'psend' is called at the client machine, a corresponding 'precv' should have been called before at the target machine, otherwise the client will hang if VALUE contains large data (which can not be held by the operating systems socket buffers). See also: *note pconnect: XREFpconnect, *note pserver: XREFpserver, *note reval: XREFreval, *note precv: XREFprecv, *note sclose: XREFsclose, *note parallel_generate_srp_data: XREFparallel_generate_srp_data, *note select_sockets: XREFselect_sockets.  File: parallel.info, Node: precv, Next: reval, Prev: psend, Up: Cluster execution 3.13 Receiving Octave variables =============================== -- Loadable Function: precv (SINGLE_CONNECTION) Receive a data value from the parallel cluster machine specified by SINGLE_CONNECTION. This function can be called both at the client machine and (with 'reval') at a server machine. SINGLE_CONNECTION must be a single connection obtained by indexing the CONNECTIONS variable. Please see 'pconnect' for a description of the CONNECTIONS variable, and 'pserver' for a description of this variable (named 'sockets') at the server side. If SINGLE_CONNECTION corresponds to the machine at which 'precv' was called, an error is thrown. The value received with 'precv' must be sent with 'psend' from another machine of the cluster. Note that data can be transferred this way between each pair of machines, even sent by a server and received by a different server. If 'precv' is called at the client machine, a corresponding 'psend' should have been called before at the source machine, otherwise the client will hang. See also: *note pconnect: XREFpconnect, *note pserver: XREFpserver, *note reval: XREFreval, *note psend: XREFpsend, *note sclose: XREFsclose, *note parallel_generate_srp_data: XREFparallel_generate_srp_data, *note select_sockets: XREFselect_sockets.  File: parallel.info, Node: reval, Next: select_sockets, Prev: precv, Up: Cluster execution 3.14 Remote command evaluation ============================== -- Loadable Function: reval (COMMANDS, CONNECTIONS) Evaluate COMMANDS at all remote hosts specified by CONNECTIONS. This function can only be successfully called at the client machine. COMMANDS must be a string containing Octave commands suitable for execution with Octaves 'eval()' function. See 'pconnect' for a description of the CONNECTIONS variable. CONNECTIONS can contain all connections of the network, a subset of them, or a single connection. The local machine (client), if contained in CONNECTIONS, is ignored. COMMANDS is executed in the same way at each specified machine. See also: *note pconnect: XREFpconnect, *note pserver: XREFpserver, *note psend: XREFpsend, *note precv: XREFprecv, *note sclose: XREFsclose, *note parallel_generate_srp_data: XREFparallel_generate_srp_data, *note select_sockets: XREFselect_sockets.  File: parallel.info, Node: select_sockets, Next: Limitations, Prev: reval, Up: Cluster execution 3.15 Call Unix 'select' for data connections ============================================ -- Loadable Function: select_sockets (CONNECTIONS, TIMEOUT) -- Loadable Function: select_sockets (CONNECTIONS, TIMEOUT, NFDS) Calls Unix 'select' for data connections in a parallel cluster. This function is for advanced usage (and therefore has minimal documentation), typically the programming of schedulers. It can be called at the client or at a server. CONNECTIONS: valid connections object (see 'pconnect' and 'pserver', possibly indexed). TIMEOUT: seconds, negative for infinite. NFDS: Passed to Unix 'select' as first argument, see documentation of Uix 'select'. Default: 'FD_SETSIZE' (platform specific). An error is returned if nfds or a watched filedescriptor plus one exceeds FD_SETSIZE. Returns an index vector to CONNECTIONS indicating connections with pending input, readable with 'precv'. If called at the client, the command connections are included into the UNIX 'select' call and checked for error flags, and 'select_sockets' returns an error if a flag for a remote error is received. See also: *note pconnect: XREFpconnect, *note pserver: XREFpserver, *note reval: XREFreval, *note psend: XREFpsend, *note precv: XREFprecv, *note sclose: XREFsclose, *note parallel_generate_srp_data: XREFparallel_generate_srp_data.  File: parallel.info, Node: Limitations, Next: Example, Prev: select_sockets, Up: Cluster execution 3.16 Limitations of high- and medium-level functions ==================================================== For the function handles passed as arguments to *note netcellfun::, *note netarrayfun::, and *note rfeval::, the following limitations currently apply: * If a handle to a named function is passed, this function must exist on the server machine. * A handle to a subfunction can not be passed. * A handle to a private function can only be passed if its file path is the same at the server. * If an anonymous function is passed, it may not have been defined using 'varargin'. Anonymous functions should be usable as usual, since the function specification sent to the server will include the anonymous functions context.  File: parallel.info, Node: Example, Prev: Limitations, Up: Cluster execution 3.17 Example ============ # From Octave prompt, generate authentication files, set user name to # 'test'. When prompted for a password, press . parallel_generate_srp_data ('test') # From Octave prompt, get location of the generated files. authpath = fullfile (a = pkg ("prefix"), "parallel-srp-data") Copy server files to servers, authpath is assumed to be "/home/test/octave/parallel-srp-data/", the same directory is assumed to exist on the servers. From the system shell, do e.g.: scp -r /home/test/octave/parallel-srp-data/server server1:/home/test/octave/parallel-srp-data/ scp -r /home/test/octave/parallel-srp-data/server server2:/home/test/octave/parallel-srp-data/ Start server at remote machines. From the system shell, do e.g.: ssh server1 'octave --eval "pserver"' ssh server2 'octave --eval "pserver"' # From Octave prompt, connect the cluster. conns = pconnect ({"server1", "server2"}) # And perform some parallel execution. Single function calls take 1 # second each. results = netcellfun (conns, (x) {x, pause(1)}{:}, num2cell (1:30)) # Close network. sclose (conns)  File: parallel.info, Node: Further functions, Next: Documentation, Prev: Cluster execution, Up: Top 4 Functions possibly helpful in parallel execution ************************************************** * Menu: * fsave fload:: Transfer variable within the local machine over an Octave stream. * select:: Call Unix 'select' on Octave streams.  File: parallel.info, Node: fsave fload, Next: select, Up: Further functions 4.1 Transfer variable within the local machine over an Octave stream ==================================================================== -- Loadable Function: fsave (FID, VAR) Save a single variable to a binary stream, to be subsequently loaded with fload. Returns true if successful. Not suitable for data transfer between machines of different type. -- Loadable Function: VAR = fload (FID) Loads a single variable of any type from a binary stream, where it was previously saved with fsave. Not suitable for data transfer between machines of different type.  File: parallel.info, Node: select, Prev: fsave fload, Up: Further functions 4.2 Call Unix 'select' on Octave streams ======================================== Note that for cluster connections *note select_sockets:: should be used instead. -- Loadable Function: [N, RIDX, WIDX, EIDX] = select (READ_FIDS, WRITE_FIDS, EXCEPT_FIDS, TIMEOUT[, NFDS]) Calls Unix 'select', see the respective manual. The following interface was chosen: READ_FIDS, WRITE_FIDS, EXCEPT_FIDS: vectors of stream-ids. TIMEOUT: seconds, negative for infinite. NFDS: optional, default is Unix' FD_SETSIZE (platform specific). An error is returned if nfds or a filedescriptor belonging to a stream-id plus one exceeds FD_SETSIZE. Return values are: N: number of ready streams. RIDX, WIDX, EIDX: index vectors of ready streams in READ_FIDS, WRITE_FIDS, and EXCEPT_FIDS, respectively.  File: parallel.info, Node: Documentation, Next: Function index, Prev: Further functions, Up: Top 5 Function parallel_doc to view documentation ********************************************* -- Function File: parallel_doc () -- Function File: parallel_doc (KEYWORD) Show parallel package documentation. Runs the info viewer Octave is configured with on the documentation in info format of the installed parallel package. Without argument, the top node of the documentation is displayed. With an argument, the respective index entry is searched for and its node displayed.  File: parallel.info, Node: Function index, Next: Concept index, Prev: Documentation, Up: Top Index of functions in parallel ****************************** [index] * Menu: * fload: fsave fload. (line 6) * fsave: fsave fload. (line 6) * install_vars: install_vars. (line 6) * netarrayfun: netarrayfun. (line 6) * netcellfun: netcellfun. (line 6) * network_get_info: network_get_info. (line 6) * network_set: network_set. (line 6) * parallel_doc: Documentation. (line 6) * parallel_generate_srp_data: Authentication. (line 6) * pararrayfun: pararrayfun. (line 6) * parcellfun: parcellfun. (line 6) * pconnect: pconnect. (line 6) * precv: precv. (line 6) * psend: psend. (line 6) * pserver: pserver. (line 6) * reval: reval. (line 6) * rfeval: rfeval. (line 6) * sclose: sclose. (line 6) * select: select. (line 6) * select sockets: select_sockets. (line 6)  File: parallel.info, Node: Concept index, Prev: Function index, Up: Top Concept index ************* [index] * Menu: * authentication: Authentication. (line 6) * cluster execution: Cluster execution. (line 6) * documentation: Documentation. (line 6) * example: Example. (line 6) * installation: Installation. (line 6) * limitations: Limitations. (line 6) * local execution: Local execution. (line 6) * security: Security. (line 6)  Tag Table: Node: Top805 Node: Installation2076 Node: Local execution3381 Node: parcellfun4466 Ref: XREFparcellfun4599 Node: pararrayfun7961 Ref: XREFpararrayfun8096 Node: Cluster execution9300 Node: Security11484 Node: Authentication12673 Ref: XREFparallel_generate_srp_data12847 Node: pserver14742 Ref: XREFpserver14888 Node: pconnect18443 Ref: XREFpconnect18613 Node: sclose23271 Ref: XREFsclose23440 Node: network_get_info24018 Ref: XREFnetwork_get_info24182 Node: network_set25514 Ref: XREFnetwork_set25680 Node: netcellfun26613 Ref: XREFnetcellfun26768 Node: netarrayfun29096 Ref: XREFnetarrayfun29254 Node: install_vars30227 Ref: XREFinstall_vars30397 Node: rfeval31635 Ref: XREFrfeval31811 Node: psend34580 Ref: XREFpsend34731 Node: precv36125 Ref: XREFprecv36279 Node: reval37601 Ref: XREFreval37762 Node: select_sockets38676 Ref: XREFselect_sockets38871 Node: Limitations40224 Node: Example41088 Node: Further functions42374 Node: fsave fload42830 Ref: XREFfsave43051 Ref: XREFfload43285 Node: select43510 Ref: XREFselect43757 Node: Documentation44431 Ref: XREFparallel_doc44628 Node: Function index45045 Node: Concept index46690  End Tag Table parallel-3.1.3/doc/PaxHeaders.30520/README0000644000000000000000000000013213331003466014464 xustar0030 mtime=1533282102.526477339 30 atime=1533282102.526477339 30 ctime=1533282233.633065964 parallel-3.1.3/doc/README0000644000175000017500000000117313331003466014664 0ustar00olafolaf00000000000000This package contains the following sets of functions: -- Functions for initialization of a cluster and execution of arbitrary commands on chosen remote machines. Please see e.g. the documentation of "pconnect()", "pserver()", and of the functions referenced therein. -- Higher level functions, based on the lower level parallel cluster functions ("netcellfun", "netarrayfun", "rfeval", "install_vars"). -- Functions for parallel execution on a single multiprocessor machine: "parcellfun" and "pararrayfun" (by Jaroslav Hajek, originally in package "general"). See also package mpi, maintained by Carlo de Falco. parallel-3.1.3/doc/PaxHeaders.30520/htmlxref.cnf0000644000000000000000000000013113331003466016124 xustar0030 mtime=1533282102.526477339 29 atime=1533282233.33706012 30 ctime=1533282233.633065964 parallel-3.1.3/doc/htmlxref.cnf0000644000175000017500000000010113331003466016313 0ustar00olafolaf00000000000000octave node https://www.gnu.org/software/octave/doc/interpreter/ parallel-3.1.3/doc/PaxHeaders.30520/macros.texi0000644000000000000000000000013213331003466015763 xustar0030 mtime=1533282102.526477339 30 atime=1533282232.805049615 30 ctime=1533282233.633065964 parallel-3.1.3/doc/macros.texi0000644000175000017500000000472113331003466016165 0ustar00olafolaf00000000000000@c Copyright (C) 2012-2013 John W. Eaton @c @c This file is part of Octave. @c @c Octave is free software; you can redistribute it and/or modify it @c under the terms of the GNU General Public License as published by the @c Free Software Foundation; either version 3 of the License, or (at @c your option) any later version. @c @c Octave is distributed in the hope that it will be useful, but WITHOUT @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License @c for more details. @c @c You should have received a copy of the GNU General Public License @c along with Octave; see the file COPYING. If not, see @c . @c The following macro marks words that aspell should ignore during @c spellchecking. Within Texinfo it has no effect as it merely replaces @c the macro call with the argument itself. @macro nospell {arg} \arg\ @end macro @c The following macro works around the Info/plain text expansion of @code{XXX} @c which is `XXX'. This looks particularly bad when the macro body is @c single or double-quoted text, such as a property value `"position"' @ifinfo @rmacro qcode{arg} \arg\ @end rmacro @end ifinfo @ifnotinfo @rmacro qcode{arg} @code{\arg\} @end rmacro @end ifnotinfo @c The following macro is used for the on-line help system, but we don't @c want lots of `See also: foo, bar, and baz' strings cluttering the @c printed manual (that information should be in the supporting text for @c each group of functions and variables). @c @c Implementation Note: @c For TeX, @vskip produces a nice separation. @c For Texinfo, '@sp 1' should work, but in practice produces ugly results @c for HTML. We use a simple blank line to produce the correct behavior. @macro seealso {args} @iftex @vskip 2pt @end iftex @ifnottex @end ifnottex @ifnotinfo @noindent @strong{See also:} \args\. @end ifnotinfo @ifinfo @noindent See also: \args\. @end ifinfo @end macro @c The following macro works around a situation where the Info/plain text @c expansion of the @code{XXX} macro is `XXX'. The use of the apostrophe @c can be confusing if the code segment itself ends with a transpose operator. @ifinfo @macro tcode{arg} \arg\ @end macro @end ifinfo @ifnotinfo @macro tcode{arg} @code{\arg\} @end macro @end ifnotinfo @c FIXME: someday, when Texinfo 5.X is standard, we might replace this with @c @backslashchar, which is a new addition to Texinfo. @macro xbackslashchar \\ @end macro parallel-3.1.3/doc/PaxHeaders.30520/html0000644000000000000000000000013213331003671014471 xustar0030 mtime=1533282233.597065253 30 atime=1533282233.633065964 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/0000755000175000017500000000000013331003671014744 5ustar00olafolaf00000000000000parallel-3.1.3/doc/html/PaxHeaders.30520/Local-execution.html0000644000000000000000000000013213331003671020467 xustar0030 mtime=1533282233.381060988 30 atime=1533282233.377060909 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/Local-execution.html0000644000175000017500000001065213331003671020671 0ustar00olafolaf00000000000000 parallel_doc: Local execution

Next: , Previous: , Up: Top   [Index]


2 Functions for local parallel execution

Explicit local parallel execution, with the intent to exploit more than one local processor(-core), is performed by calling a user-defined function in parallel with several different arguments. This is done in parallel processes, so any changes to (global) variables in the user-defined function will only be visible within the same function call.

The interface of the functions for local parallel execution is similar to Octaves cellfun and parcellfun functions.

Note that some operations in Octave, particularly some matrix operations, may already be performed in parallel threads. This may limit the advantage yielded by explicit local parallel execution. Also, RAM access can be a bottleneck which limits computation speed of multicore computing.

parallel-3.1.3/doc/html/PaxHeaders.30520/Installation.html0000644000000000000000000000013113331003671020074 xustar0030 mtime=1533282233.377060909 29 atime=1533282233.37306083 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/Installation.html0000644000175000017500000001050413331003671020273 0ustar00olafolaf00000000000000 parallel_doc: Installation

Next: , Previous: , Up: Top   [Index]


1 Installation hints

Note: For using a cluster of machines, identical versions of the package are required to be installed at each machine.

Maybe your distribution provides the parallel package.

If not, or if you want a newer version, Octaves pkg command allows building the package from source and installing it. Note that you have to load any Octave package before you can use it. See Octaves documentation of pkg.

The functions for parallel execution over a cluster of machines can be disabled by a configure option. There is currently no way, however, to specify configure options when building a package with pkg.

Parallel execution over a cluster by default is protected by encryption with authentication. This needs a version of the gnutls library in which TLS-SRP is not disabled. For building the parallel package from source, this library must be present during the build; some operating systems provide development files of libraries in exta ...-dev packages, which are also needed during the build.

Building or using the package for cluster execution without gnutls will work, but encryption and authentication are not available in this case.

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFrfeval.html0000644000000000000000000000013213331003671017400 xustar0030 mtime=1533282233.593065174 30 atime=1533282233.593065174 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFrfeval.html0000644000175000017500000000476013331003671017605 0ustar00olafolaf00000000000000 parallel_doc: XREFrfeval

The node you are looking for is at XREFrfeval.

parallel-3.1.3/doc/html/PaxHeaders.30520/pararrayfun.html0000644000000000000000000000013213331003671017766 xustar0030 mtime=1533282233.401061383 30 atime=1533282233.393061225 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/pararrayfun.html0000644000175000017500000001146113331003671020167 0ustar00olafolaf00000000000000 parallel_doc: pararrayfun

Previous: , Up: Local execution   [Index]


2.2 Function pararrayfun

Function File: [o1, o2, …] = pararrayfun (nproc, fun, a1, a2, …)
Function File: pararrayfun (nproc, fun, …, "UniformOutput", val)
Function File: pararrayfun (nproc, fun, …, "ErrorHandler", errfunc)

Evaluates a function for corresponding elements of an array. Argument and options handling is analogical to parcellfun, except that arguments are arrays rather than cells. If cells occur as arguments, they are treated as arrays of singleton cells. Arrayfun supports one extra option compared to parcellfun: "Vectorized". This option must be given together with "ChunksPerProc" and it indicates that fun is able to operate on vectors rather than just scalars, and returns a vector. The same must be true for errfunc, if given. In this case, the array is split into chunks which are then directly served to func for evaluation, and the results are concatenated to output arrays. If "CumFunc" is also specified (see parcellfun), fun is expected to return the result of the same cumulative operation instead of vectors.

See also parcellfun, (octave)arrayfun.

parallel-3.1.3/doc/html/PaxHeaders.30520/sclose.html0000644000000000000000000000013213331003671016724 xustar0030 mtime=1533282233.453062409 30 atime=1533282233.445062252 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/sclose.html0000644000175000017500000001016213331003671017122 0ustar00olafolaf00000000000000 parallel_doc: sclose

Next: , Previous: , Up: Cluster execution   [Index]


3.5 Closing cluster connections

Loadable Function: sclose (connections)

Close the parallel cluster network to which connections belongs.

See pconnect for a description of the connections variable. All connections of the network are closed, even if connections contains only a subnet or a single connection.

See also: pconnect, pserver, reval, psend, precv, parallel_generate_srp_data, select_sockets.

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFparallel_005fdoc.html0000644000000000000000000000013213331003671021135 xustar0030 mtime=1533282233.585065016 30 atime=1533282233.581064937 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFparallel_005fdoc.html0000644000175000017500000000505213331003671021335 0ustar00olafolaf00000000000000 parallel_doc: XREFparallel_doc

The node you are looking for is at XREFparallel_doc.

parallel-3.1.3/doc/html/PaxHeaders.30520/psend.html0000644000000000000000000000013213331003671016545 xustar0030 mtime=1533282233.513063595 30 atime=1533282233.505063437 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/psend.html0000644000175000017500000001157413331003671016753 0ustar00olafolaf00000000000000 parallel_doc: psend

Next: , Previous: , Up: Cluster execution   [Index]


3.12 Sending Octave variables

Loadable Function: psend (value, connections)

Send the value in variable value to all parallel cluster machines specified by connections.

This function can be called both at the client machine and (with reval) at a server machine. See pconnect for a description of the connections variable, and pserver for a description of this variable (named sockets) at the server side. connections can contain all connections of the network, a subset of them, or a single connection. The machine at which psend was called (client or server), if contained in the connections variable, is ignored.

The value sent with psend must be received with precv at the target machine. Note that values can be sent to each machine, even from a server machine to a different server machine.

If psend is called at the client machine, a corresponding precv should have been called before at the target machine, otherwise the client will hang if value contains large data (which can not be held by the operating systems socket buffers).

See also: pconnect, pserver, reval, precv, sclose, parallel_generate_srp_data, select_sockets.

parallel-3.1.3/doc/html/PaxHeaders.30520/Further-functions.html0000644000000000000000000000013213331003671021061 xustar0030 mtime=1533282233.549064306 30 atime=1533282233.545064227 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/Further-functions.html0000644000175000017500000000735613331003671021272 0ustar00olafolaf00000000000000 parallel_doc: Further functions

Next: , Previous: , Up: Top   [Index]


4 Functions possibly helpful in parallel execution

parallel-3.1.3/doc/html/PaxHeaders.30520/netarrayfun.html0000644000000000000000000000013213331003671017772 xustar0030 mtime=1533282233.489063121 30 atime=1533282233.481062963 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/netarrayfun.html0000644000175000017500000001101613331003671020167 0ustar00olafolaf00000000000000 parallel_doc: netarrayfun

Next: , Previous: , Up: Cluster execution   [Index]


3.9 Function netarrayfun

Function File: netarrayfun (connections, fun, …)

Evaluates function fun in a parallel cluster and collects results.

This function handles arguments and options equivalently to pararrayfun and returnes equivalent output. Differently, the first argument specifies server machines for parallel remote execution, see pconnect for a description of the connections variable. A further difference is that the option "ChunksPerProc" is ignored and instead the chunk size can be specified directly with an option "ChunkSize" (option "Vectorized" can be used together with option "ChunkSize" in function netarrayfun).

The further details of operation are the same as for netcellfun, please see there.

See also: netcellfun, pconnect, pserver, sclose, rfeval, install_vars.

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFselect.html0000644000000000000000000000013213331003671017400 xustar0030 mtime=1533282233.597065253 30 atime=1533282233.597065253 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFselect.html0000644000175000017500000000476013331003671017605 0ustar00olafolaf00000000000000 parallel_doc: XREFselect

The node you are looking for is at XREFselect.

parallel-3.1.3/doc/html/PaxHeaders.30520/Cluster-execution.html0000644000000000000000000000013213331003671021056 xustar0030 mtime=1533282233.409061541 30 atime=1533282233.401061383 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/Cluster-execution.html0000644000175000017500000002064213331003671021260 0ustar00olafolaf00000000000000 parallel_doc: Cluster execution

Next: , Previous: , Up: Top   [Index]


3 Functions for parallel execution over a cluster of machines

There are high level functions, similar to parcellfun and pararrayfun, which only require the user to provide a function to be called and a series of argument sets. Parallel function calls are then internally distributed over the cluster, and over the local processors (or processor cores) within the single machines of the cluster.

Medium and low level functions are also provided. These require the user to program the scheduling of parallel execution.

Data transfer is possible between the client machine and each server machine, but also directly between server machines. The latter feature is exploited e.g. by the install_vars function.


Next: , Previous: , Up: Top   [Index]

parallel-3.1.3/doc/html/PaxHeaders.30520/select_005fsockets.html0000644000000000000000000000013213331003671021041 xustar0030 mtime=1533282233.537064069 30 atime=1533282233.529063911 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/select_005fsockets.html0000644000175000017500000001211313331003671021235 0ustar00olafolaf00000000000000 parallel_doc: select_sockets

Next: , Previous: , Up: Cluster execution   [Index]


3.15 Call Unix select for data connections

Loadable Function: select_sockets (connections, timeout)
Loadable Function: select_sockets (connections, timeout, nfds)

Calls Unix select for data connections in a parallel cluster.

This function is for advanced usage (and therefore has minimal documentation), typically the programming of schedulers. It can be called at the client or at a server.

connections: valid connections object (see pconnect and pserver, possibly indexed).

timeout: seconds, negative for infinite.

nfds: Passed to Unix select as first argument, see documentation of Uix select. Default: FD_SETSIZE (platform specific).

An error is returned if nfds or a watched filedescriptor plus one exceeds FD_SETSIZE.

Returns an index vector to connections indicating connections with pending input, readable with precv.

If called at the client, the command connections are included into the UNIX select call and checked for error flags, and select_sockets returns an error if a flag for a remote error is received.

See also: pconnect, pserver, reval, psend, precv, sclose, parallel_generate_srp_data.

parallel-3.1.3/doc/html/PaxHeaders.30520/pconnect.html0000644000000000000000000000013213331003671017245 xustar0030 mtime=1533282233.445062252 30 atime=1533282233.433062015 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/pconnect.html0000644000175000017500000002104313331003671017443 0ustar00olafolaf00000000000000 parallel_doc: pconnect

Next: , Previous: , Up: Cluster execution   [Index]


3.4 Establishing cluster connections

Loadable Function: connections = pconnect (hosts)
Loadable Function: connections = pconnect (hosts, options)

Connects to a network of parallel cluster servers.

As a precondition, a server must have been started at each machine of the cluster, see pserver. Connections are not guaranteed to work if client and server are from parallel packages of different versions, so versions should be kept equal.

hosts is a cell-array of strings, holding the names of all server machines. The machines must be unique, and their names must be resolvable to the correct addresses also at each server machine, not only at the client. This means e.g. that the name localhost is not acceptable (exception: localhost is acceptable as the first of all names).

Alternatively, but deprecated, hosts can be given as previously, as a character array with a machine name in each row. If it is given in this way, the first row must contain the name of the client machine (for backwards compatibility), so that there is one row more than the now preferred cell-array hosts would have entries.

pconnect returns an opaque variable holding the network connections. This variable can be indexed to obtain a subset of connections or even a single connection. (For backwards compatibility, a second index of : is allowed, which has no effect). At the first index position is the client machine, so this position does not correspond to a real connection. At the following index positions are the server machines in the same order as specified in the cell-array hosts. So in the whole the variable of network connections has one position more than the number of servers given in hosts (except if hosts was given in the above mentioned deprecated way). You can display the variable of network connections to see what is in it. The variable of network connections, or subsets of it, is passed to the other functions for parallel cluster excecution (reval, psend, precv, sclose, select_sockets among others – see documentation of these functions).

options: structure of options; field use_tls is true by default (TLS with SRP authentication); if set to false, there will be no encryption or authentication. Field password_file can be set to an alternative path to the file with authentication information (see below). Field user can specify the username for authentication; if the username is so specified, no file with authentication information will be used at the client, but the password will be queried from the user.

The client and the server must both use or both not use TLS. If TLS is switched off, different measures must be taken to protect ports 12501 and 12502 at the servers and the client against unauthorized access; e.g. by a firewall or by physical isolation of the network.

For using TLS, authorization data must be present at the server machine. These data can conveniently be generated by parallel_generate_srp_data. By default, the client authentication file is created in the same run. The helptext of parallel_generate_srp_data documents the expected locations of the authentication data.

The SRP password will be sent over the encrypted TLS channel from the client to each server, to avoid permanently storing passwords at the server for server-to-server data connections. Due to inevitable usage of external libraries, memory with sensitive data can, however, be on the swap device even after shutdown of the application, both at the client and at the server machines.

Example (let data travel through all machines), assuming pserver was called on each remote machine and authentication data is present (e.g. generated with parallel_generate_srp_data):

sockets = pconnect ({'remote.machine.1', 'remote.machine.2'});
reval ('psend (precv (sockets(2)), sockets(1))', sockets(3));
reval ('psend (precv (sockets(1)), sockets(3))', sockets(2));
psend ('some data', sockets(2));
precv (sockets(3))
--> ans = some data
sclose (sockets);

See also: pserver, reval, psend, precv, sclose, parallel_generate_srp_data, select_sockets, rfeval.


Next: , Previous: , Up: Cluster execution   [Index]

parallel-3.1.3/doc/html/PaxHeaders.30520/Example.html0000644000000000000000000000013213331003671017027 xustar0030 mtime=1533282233.545064227 30 atime=1533282233.545064227 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/Example.html0000644000175000017500000001041713331003671017230 0ustar00olafolaf00000000000000 parallel_doc: Example

Previous: , Up: Cluster execution   [Index]


3.17 Example


# From Octave prompt, generate authentication files, set user name to
# 'test'. When prompted for a password, press <enter>.
parallel_generate_srp_data ('test')

# From Octave prompt, get location of the generated files.
authpath = fullfile (a = pkg ("prefix"), "parallel-srp-data")

Copy server files to servers, authpath is assumed to be
"/home/test/octave/parallel-srp-data/", the same directory is assumed to
exist on the servers. From the system shell, do e.g.:

scp -r /home/test/octave/parallel-srp-data/server server1:/home/test/octave/parallel-srp-data/
scp -r /home/test/octave/parallel-srp-data/server server2:/home/test/octave/parallel-srp-data/

Start server at remote machines. From the system shell, do e.g.:

ssh server1 'octave --eval "pserver"'
ssh server2 'octave --eval "pserver"'

# From Octave prompt, connect the cluster.
conns = pconnect ({"server1", "server2"})

# And perform some parallel execution. Single function calls take 1
# second each.
results = netcellfun (conns,  (x) {x, pause(1)}{:}, num2cell (1:30))

# Close network.
sclose (conns)

parallel-3.1.3/doc/html/PaxHeaders.30520/fsave-fload.html0000644000000000000000000000013213331003671017623 xustar0030 mtime=1533282233.553064385 30 atime=1533282233.549064306 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/fsave-fload.html0000644000175000017500000000762013331003671020026 0ustar00olafolaf00000000000000 parallel_doc: fsave fload

Next: , Up: Further functions   [Index]


4.1 Transfer variable within the local machine over an Octave stream

Loadable Function: fsave (fid, var)

Save a single variable to a binary stream, to be subsequently loaded with fload. Returns true if successful. Not suitable for data transfer between machines of different type.

Loadable Function: var = fload (fid)

Loads a single variable of any type from a binary stream, where it was previously saved with fsave. Not suitable for data transfer between machines of different type.

parallel-3.1.3/doc/html/PaxHeaders.30520/netcellfun.html0000644000000000000000000000013213331003671017573 xustar0030 mtime=1533282233.481062963 30 atime=1533282233.469062726 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/netcellfun.html0000644000175000017500000001446013331003671017776 0ustar00olafolaf00000000000000 parallel_doc: netcellfun

Next: , Previous: , Up: Cluster execution   [Index]


3.8 Function netcellfun

Function File: netcellfun (connections, fun, …)

Evaluates function fun in a parallel cluster and collects results.

This function handles arguments and options equivalently to parcellfun and returnes equivalent output. Differently, the first argument specifies server machines for parallel remote execution, see pconnect for a description of the connections variable. A further difference is that the option "ChunksPerProc" is ignored and instead the chunk size can be specified directly with an option "ChunkSize".

This function can only be successfully called at the client machine of the parallel cluster. connections can contain all connections of the network, a subset of them, or a single connection. The local machine (client), if contained in connections, is ignored. However, one of the servers can run at the local machine under certain conditions (see pconnect) and will not be ignored in this case, so that the local machine can take part in parallel execution with netcellfun.

As a second level of parallelism, fun is executed at each server machine (using parcellfun or pararrayfun) by default in as many local processes in parallel as the server has processor cores available. The number of local parallel processes can be configured for each server with the "nlocaljobs" option (see network_set), a value of 0 means that the default value will be used, a value of 1 means that execution is not parallel within the server (but still parallel over the cluster).

There are certain limitations on how fun can be defined. These are explained in the documentation of rfeval.

Cluster execution incurs a considerable overhead. A speedup is likely if the computation time of fun is long. To speed up execution of a large set of arguments with short computation times of fun, increase "ChunkSize", possibly use "Vectorize" (see pararrayfun), and possibly experiment with increasing "nlocaljobs" from the default.

See also: netarrayfun, pconnect, pserver, sclose, rfeval, install_vars.


Next: , Previous: , Up: Cluster execution   [Index]

parallel-3.1.3/doc/html/PaxHeaders.30520/index.html0000644000000000000000000000013113331003671016542 xustar0029 mtime=1533282233.37306083 30 atime=1533282233.369060751 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/index.html0000644000175000017500000001334413331003671016746 0ustar00olafolaf00000000000000 parallel_doc: Top

parallel_doc

Next: , Up: (dir)   [Index]


General documentation for the parallel package for Octave

The info version of this document is accessible, after package installation, from the Octave commandline with parallel_doc().

This documentation applies to version 3.1.3 of the parallel package.

The package contains functions for explicit local parallel execution, and functions for parallel execution over a cluster of machines, possibly combined with local parallel execution at each machine of the cluster.

The cluster-related functions may be disabled in distributed binaries of the parallel package for some operating systems.

An alternative to the parallel package is the mpi package.


Next: , Up: (dir)   [Index]

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFnetcellfun.html0000644000000000000000000000013213331003671020260 xustar0030 mtime=1533282233.581064937 30 atime=1533282233.581064937 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFnetcellfun.html0000644000175000017500000000502013331003671020453 0ustar00olafolaf00000000000000 parallel_doc: XREFnetcellfun

The node you are looking for is at XREFnetcellfun.

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFprecv.html0000644000000000000000000000013213331003671017240 xustar0030 mtime=1533282233.589065095 30 atime=1533282233.589065095 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFprecv.html0000644000175000017500000000475013331003671017444 0ustar00olafolaf00000000000000 parallel_doc: XREFprecv

The node you are looking for is at XREFprecv.

parallel-3.1.3/doc/html/PaxHeaders.30520/network_005fget_005finfo.html0000644000000000000000000000013213331003671021765 xustar0030 mtime=1533282233.461062568 30 atime=1533282233.453062409 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/network_005fget_005finfo.html0000644000175000017500000001172713331003671022173 0ustar00olafolaf00000000000000 parallel_doc: network_get_info

Next: , Previous: , Up: Cluster execution   [Index]


3.6 Get network information

Loadable Function: network_get_info (connections)

Return an informational structure-array with one entry for each machine specified by connections.

This function can only be successfully called at the client machine. See pconnect for a description of the connections variable. connections can contain all connections of the network, a subset of them, or a single connection. For the local machine (client), if contained in connections, some fields of the returned structure may be empty.

The fields of the returned structure are local_machine: true for the connection representing the local machine, nproc: number of usable processors of the machine, nlocaljobs: configured number of local processes on the machine, peername: name of the machine (empty for local machine), open: true if the connection is open, network_id: uuid of the network, real_node_id: internal id assigned to node, 0 for client, servers starting with 1.

See also: pconnect, pserver, reval, psend, precv, sclose, parallel_generate_srp_data, select_sockets.

parallel-3.1.3/doc/html/PaxHeaders.30520/network_005fset.html0000644000000000000000000000013213331003671020373 xustar0030 mtime=1533282233.469062726 30 atime=1533282233.461062568 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/network_005fset.html0000644000175000017500000001113513331003671020572 0ustar00olafolaf00000000000000 parallel_doc: network_set

Next: , Previous: , Up: Cluster execution   [Index]


3.7 Set network properties

Loadable Function: network_set (connections, key, val)

Set the property named by key to the value val for each machine specified by connections.

This function can only be successfully called at the client machine. See pconnect for a description of the connections variable. connections can contain all connections of the network, a subset of them, or a single connection.

Possible values of key: 'nlocaljobs': configured number of local processes on the machine (usable by functions for parallel execution); needs a non-negative integer in val, 0 means not specified.

See also: pconnect, pserver, reval, psend, precv, sclose, parallel_generate_srp_data, select_sockets.

parallel-3.1.3/doc/html/PaxHeaders.30520/Security.html0000644000000000000000000000013113331003671017242 xustar0029 mtime=1533282233.41306162 30 atime=1533282233.409061541 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/Security.html0000644000175000017500000001026513331003671017445 0ustar00olafolaf00000000000000 parallel_doc: Security

3.1 Security considerations

Over a connection to a server of the parallel package arbitrary Octave commands can be executed at the server machine. This means that any change can be done to the server system and the resident data, only limited by the rights of the system account under which the server runs.

By default, the server is started with authentication and encryption enabled, to avoid unauthorized access. If the server is started with authentication disabled (maybe to avoid the encryption overhead), it must be cared for that no TCP connection by unauthorized persons is possible to the server ports, possibly by running the client and all server machines behind a firewall and assuring that only trusted persons have access to any machine behind the firewall. This scenario might be achievable in home-nets.

The server currently uses port 12502 for receiving commands and port 12501 for data exchange.

The client and the servers used by the client with pconnect must agree on using authentication or not.

Do not start the server as root.

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFreval.html0000644000000000000000000000013213331003671017232 xustar0030 mtime=1533282233.593065174 30 atime=1533282233.593065174 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFreval.html0000644000175000017500000000475013331003671017436 0ustar00olafolaf00000000000000 parallel_doc: XREFreval

The node you are looking for is at XREFreval.

parallel-3.1.3/doc/html/PaxHeaders.30520/pserver.html0000644000000000000000000000013213331003671017122 xustar0030 mtime=1533282233.433062015 30 atime=1533282233.421061778 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/pserver.html0000644000175000017500000001656213331003671017332 0ustar00olafolaf00000000000000 parallel_doc: pserver

Next: , Previous: , Up: Cluster execution   [Index]


3.3 Starting servers

Loadable Function: pserver ()
Loadable Function: pserver (options)

This function starts a server of the parallel cluster and should be called once at any server machine.

It is important to call this function in a way assuring that Octave is quit as soon as the function returns, i.e. call it e.g. like octave --eval "pserver" or octave --eval "pserver (struct ('fieldname', value))".

If a directory path corresponding to the current directory of the client exists on the server machine, it will be used as the servers current directory for the respective client (multiple clients are possible). Otherwise, /tmp will be used. The Octave functions the server is supposed to call and the files it possibly has to access must be available at the server machine. This can e.g. be achieved by having the server machine mount a network file system (which is outside the scope of this package documentation).

The parent server process can only be terminated by sending it a signal. The pid of this process, as long as it is running, will be stored in the file /tmp/.octave-<hostname>.pid.

If a connection is accepted from a client, the server collects a network identifier and the names of all server machines of the network from the client. Then, connections are automatically established between all machines of the network. Data exchange will be possible between all machines (client or server) in both directions. Commands can only be sent from the client to any server.

The opaque variable holding the network connections, in the same order as in the corresponding variable returned by pconnect, is accessible under the variable name sockets at the server side. Do not overwrite or clear this variable. The own server machine will also be contained at some index position of this variable, but will not correspond to a real connection. See pconnect for further information.

options: structure of options; field use_tls is true by default (TLS with SRP authentication); if set to false, there will be no encryption or authentication. Field auth_file can be set to an alternative path to the file with authentication information (see below).

The client and the server must both use or both not use TLS. If TLS is switched off, different measures must be taken to protect ports 12501 and 12502 at the servers and the client against unauthorized access; e.g. by a firewall or by physical isolation of the network.

For using TLS, authorization data must be present at the server machine. These data can conveniently be generated by parallel_generate_srp_data; the helptext of the latter function documents the expected location of these data.

The SRP password will be sent over the encrypted TLS channel from the client to each server, to avoid permanently storing passwords at the server for server-to-server data connections. Due to inevitable usage of external libraries, memory with sensitive data can, however, be on the swap device even after shutdown of the application.

See also: pconnect, reval, psend, precv, sclose, parallel_generate_srp_data, select_sockets.


Next: , Previous: , Up: Cluster execution   [Index]

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFpserver.html0000644000000000000000000000013213331003671017607 xustar0030 mtime=1533282233.593065174 30 atime=1533282233.593065174 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFpserver.html0000644000175000017500000000477013331003671020015 0ustar00olafolaf00000000000000 parallel_doc: XREFpserver

The node you are looking for is at XREFpserver.

parallel-3.1.3/doc/html/PaxHeaders.30520/Function-index.html0000644000000000000000000000013013331003671020324 xustar0028 mtime=1533282233.5690647 30 atime=1533282233.565064621 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/Function-index.html0000644000175000017500000002207513331003671020532 0ustar00olafolaf00000000000000 parallel_doc: Function index

Next: , Previous: , Up: Top   [Index]


Index of functions in parallel

Jump to:   F   I   N   P   R   S  
Index Entry  Section

F
fload: fsave fload
fsave: fsave fload

I
install_vars: install_vars

N
netarrayfun: netarrayfun
netcellfun: netcellfun
network_get_info: network_get_info
network_set: network_set

P
parallel_doc: Documentation
parallel_generate_srp_data: Authentication
pararrayfun: pararrayfun
parcellfun: parcellfun
pconnect: pconnect
precv: precv
psend: psend
pserver: pserver

R
reval: reval
rfeval: rfeval

S
sclose: sclose
select: select
select sockets: select_sockets

Jump to:   F   I   N   P   R   S  
parallel-3.1.3/doc/html/PaxHeaders.30520/XREFsclose.html0000644000000000000000000000013213331003671017411 xustar0030 mtime=1533282233.597065253 30 atime=1533282233.597065253 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFsclose.html0000644000175000017500000000476013331003671017616 0ustar00olafolaf00000000000000 parallel_doc: XREFsclose

The node you are looking for is at XREFsclose.

parallel-3.1.3/doc/html/PaxHeaders.30520/Documentation.html0000644000000000000000000000013213331003671020245 xustar0030 mtime=1533282233.565064621 30 atime=1533282233.561064542 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/Documentation.html0000644000175000017500000000753113331003671020451 0ustar00olafolaf00000000000000 parallel_doc: Documentation

Next: , Previous: , Up: Top   [Index]


5 Function parallel_doc to view documentation

Function File: parallel_doc ()
Function File: parallel_doc (keyword)

Show parallel package documentation.

Runs the info viewer Octave is configured with on the documentation in info format of the installed parallel package. Without argument, the top node of the documentation is displayed. With an argument, the respective index entry is searched for and its node displayed.

parallel-3.1.3/doc/html/PaxHeaders.30520/select.html0000644000000000000000000000013213331003671016713 xustar0030 mtime=1533282233.561064542 30 atime=1533282233.553064385 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/select.html0000644000175000017500000001035313331003671017113 0ustar00olafolaf00000000000000 parallel_doc: select

Previous: , Up: Further functions   [Index]


4.2 Call Unix select on Octave streams

Note that for cluster connections select_sockets should be used instead.

Loadable Function: [n, ridx, widx, eidx] = select (read_fids, write_fids, except_fids, timeout[, nfds])

Calls Unix select, see the respective manual.

The following interface was chosen: read_fids, write_fids, except_fids: vectors of stream-ids. timeout: seconds, negative for infinite. nfds: optional, default is Unix’ FD_SETSIZE (platform specific). An error is returned if nfds or a filedescriptor belonging to a stream-id plus one exceeds FD_SETSIZE. Return values are: n: number of ready streams. ridx, widx, eidx: index vectors of ready streams in read_fids, write_fids, and except_fids, respectively.

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFselect_005fsockets.html0000644000000000000000000000013213331003671021526 xustar0030 mtime=1533282233.597065253 30 atime=1533282233.597065253 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFselect_005fsockets.html0000644000175000017500000000510013331003671021720 0ustar00olafolaf00000000000000 parallel_doc: XREFselect_sockets

The node you are looking for is at XREFselect_sockets.

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFnetarrayfun.html0000644000000000000000000000013213331003671020457 xustar0030 mtime=1533282233.577064858 30 atime=1533282233.577064858 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFnetarrayfun.html0000644000175000017500000000503013331003671020653 0ustar00olafolaf00000000000000 parallel_doc: XREFnetarrayfun

The node you are looking for is at XREFnetarrayfun.

parallel-3.1.3/doc/html/PaxHeaders.30520/reval.html0000644000000000000000000000013213331003671016545 xustar0030 mtime=1533282233.529063911 30 atime=1533282233.521063753 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/reval.html0000644000175000017500000001066113331003671016747 0ustar00olafolaf00000000000000 parallel_doc: reval

Next: , Previous: , Up: Cluster execution   [Index]


3.14 Remote command evaluation

Loadable Function: reval (commands, connections)

Evaluate commands at all remote hosts specified by connections.

This function can only be successfully called at the client machine. commands must be a string containing Octave commands suitable for execution with Octaves eval() function. See pconnect for a description of the connections variable. connections can contain all connections of the network, a subset of them, or a single connection. The local machine (client), if contained in connections, is ignored. commands is executed in the same way at each specified machine.

See also: pconnect, pserver, psend, precv, sclose, parallel_generate_srp_data, select_sockets.

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFinstall_005fvars.html0000644000000000000000000000013213331003671021215 xustar0030 mtime=1533282233.577064858 30 atime=1533282233.577064858 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFinstall_005fvars.html0000644000175000017500000000506013331003671021414 0ustar00olafolaf00000000000000 parallel_doc: XREFinstall_vars

The node you are looking for is at XREFinstall_vars.

parallel-3.1.3/doc/html/PaxHeaders.30520/install_005fvars.html0000644000000000000000000000013013331003671020526 xustar0028 mtime=1533282233.4930632 30 atime=1533282233.489063121 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/install_005fvars.html0000644000175000017500000001130613331003671020727 0ustar00olafolaf00000000000000 parallel_doc: install_vars

Next: , Previous: , Up: Cluster execution   [Index]


3.10 Distribute Octave variables

Function File: install_vars (varname, …, connections)

Install named variables at remote machines.

The variables named in the arguments are distrubted to the remote machines specified by connections and installed there. The variables must be accessible within the calling function. If variables have been declared to have global scope, they will also have global scope at the remote machines.

This function can only be successfully called at the client machine. See pconnect for a description of the connections variable. connections can contain all connections of the network, a subset of them, or a single connection. The local machine (client), if contained in connections, is ignored.

To install, e.g., all visible variables,

install_vars (who (){:}, …);

can be used.

Internally, this function sends the variables only to one server and then issues the necessary commands to distribute them to all specified servers over server-to-server data connections.

See also: pconnect, pserver, sclose, rfeval, netcellfun.

parallel-3.1.3/doc/html/PaxHeaders.30520/Limitations.html0000644000000000000000000000013213331003671017730 xustar0030 mtime=1533282233.545064227 30 atime=1533282233.537064069 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/Limitations.html0000644000175000017500000001003013331003671020120 0ustar00olafolaf00000000000000 parallel_doc: Limitations

Next: , Previous: , Up: Cluster execution   [Index]


3.16 Limitations of high- and medium-level functions

For the function handles passed as arguments to netcellfun, netarrayfun, and rfeval, the following limitations currently apply:

  • If a handle to a named function is passed, this function must exist on the server machine.
  • A handle to a subfunction can not be passed.
  • A handle to a private function can only be passed if its file path is the same at the server.
  • If an anonymous function is passed, it may not have been defined using varargin.

Anonymous functions should be usable as usual, since the function specification sent to the server will include the anonymous functions context.

parallel-3.1.3/doc/html/PaxHeaders.30520/precv.html0000644000000000000000000000013213331003671016553 xustar0030 mtime=1533282233.521063753 30 atime=1533282233.513063595 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/precv.html0000644000175000017500000001143413331003671016754 0ustar00olafolaf00000000000000 parallel_doc: precv

Next: , Previous: , Up: Cluster execution   [Index]


3.13 Receiving Octave variables

Loadable Function: precv (single_connection)

Receive a data value from the parallel cluster machine specified by single_connection.

This function can be called both at the client machine and (with reval) at a server machine. single_connection must be a single connection obtained by indexing the connections variable. Please see pconnect for a description of the connections variable, and pserver for a description of this variable (named sockets) at the server side. If single_connection corresponds to the machine at which precv was called, an error is thrown.

The value received with precv must be sent with psend from another machine of the cluster. Note that data can be transferred this way between each pair of machines, even sent by a server and received by a different server.

If precv is called at the client machine, a corresponding psend should have been called before at the source machine, otherwise the client will hang.

See also: pconnect, pserver, reval, psend, sclose, parallel_generate_srp_data, select_sockets.

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFnetwork_005fget_005finfo.html0000644000000000000000000000013213331003671022452 xustar0030 mtime=1533282233.581064937 30 atime=1533282233.581064937 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFnetwork_005fget_005finfo.html0000644000175000017500000000514013331003671022650 0ustar00olafolaf00000000000000 parallel_doc: XREFnetwork_get_info

The node you are looking for is at XREFnetwork_get_info.

parallel-3.1.3/doc/html/PaxHeaders.30520/Concept-index.html0000644000000000000000000000013013331003671020132 xustar0030 mtime=1533282233.573064779 28 atime=1533282233.5690647 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/Concept-index.html0000644000175000017500000001532613331003671020341 0ustar00olafolaf00000000000000 parallel_doc: Concept index

Previous: , Up: Top   [Index]


Concept index

Jump to:   A   C   D   E   I   L   S  
Index Entry  Section

A
authentication: Authentication

C
cluster execution: Cluster execution

D
documentation: Documentation

E
example: Example

I
installation: Installation

L
limitations: Limitations
local execution: Local execution

S
security: Security

Jump to:   A   C   D   E   I   L   S  
parallel-3.1.3/doc/html/PaxHeaders.30520/XREFfsave.html0000644000000000000000000000013213331003671017225 xustar0030 mtime=1533282233.577064858 30 atime=1533282233.577064858 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFfsave.html0000644000175000017500000000476413331003671017436 0ustar00olafolaf00000000000000 parallel_doc: XREFfsave

The node you are looking for is at XREFfsave.

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFpsend.html0000644000000000000000000000013213331003671017232 xustar0030 mtime=1533282233.589065095 30 atime=1533282233.589065095 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFpsend.html0000644000175000017500000000475013331003671017436 0ustar00olafolaf00000000000000 parallel_doc: XREFpsend

The node you are looking for is at XREFpsend.

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFparcellfun.html0000644000000000000000000000013213331003671020254 xustar0030 mtime=1533282233.585065016 30 atime=1533282233.585065016 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFparcellfun.html0000644000175000017500000000502013331003671020447 0ustar00olafolaf00000000000000 parallel_doc: XREFparcellfun

The node you are looking for is at XREFparcellfun.

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFnetwork_005fset.html0000644000000000000000000000013213331003671021060 xustar0030 mtime=1533282233.581064937 30 atime=1533282233.581064937 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFnetwork_005fset.html0000644000175000017500000000505013331003671021256 0ustar00olafolaf00000000000000 parallel_doc: XREFnetwork_set

The node you are looking for is at XREFnetwork_set.

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFpconnect.html0000644000000000000000000000013213331003671017732 xustar0030 mtime=1533282233.589065095 30 atime=1533282233.589065095 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFpconnect.html0000644000175000017500000000500013331003671020123 0ustar00olafolaf00000000000000 parallel_doc: XREFpconnect

The node you are looking for is at XREFpconnect.

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFparallel_005fgenerate_005fsrp_005fdata.html0000644000000000000000000000013213331003671025025 xustar0030 mtime=1533282233.585065016 30 atime=1533282233.585065016 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFparallel_005fgenerate_005fsrp_005fdata.html0000644000175000017500000000522013331003671025222 0ustar00olafolaf00000000000000 parallel_doc: XREFparallel_generate_srp_data

The node you are looking for is at XREFparallel_generate_srp_data.

parallel-3.1.3/doc/html/PaxHeaders.30520/rfeval.html0000644000000000000000000000013013331003671016711 xustar0030 mtime=1533282233.505063437 28 atime=1533282233.4930632 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/rfeval.html0000644000175000017500000001516613331003671017122 0ustar00olafolaf00000000000000 parallel_doc: rfeval

Next: , Previous: , Up: Cluster execution   [Index]


3.11 Single remote function evaluation

Function File: rfeval (func, …, nout, isout, connection)

Evaluate a function at a remote machine.

func is evaluated with arguments and number of output arguments set to nout at remote machine given by connection. If isout is not empty, it must be a logical array with nout elements, which are true for each of the nout output arguments which are requested from the function; the other output arguments will be marked as not requested with ~ at remote execution.

This function can only be successfully called at the client machine. See pconnect for a description of the connection variable. connection must contain one single connection.

If an output argument is given to rfeval, the function waits for completion of the remote function call, retrieves the results and returns them. They will be returned as one cell-array with an entry for each output argument. If some output arguments are marked as not requested by setting some elements of isout to false, the returned cell-array will only have entries for the requested output arguments. For consistency, the returned cell-array can be empty. To assign the output arguments to single variables, you can for example use: [a, b, c] = returned_cell_array{:};.

If no output argument is given to rfeval, the function does not retrieve the results of the remote function call but returns immediately. It is left to the user to retrieve the results with precv. The results will be in the same format as if returned by rfeval. Note that a cell-array, possibly empty, will always have to be retrieved, even if the remote function call should have been performed without output arguments.

Parallel execution can be achieved by calling rfeval several times with different specified server machines before starting to retrieve the results.

The specified function handle can refer to a function present at the executing machine or be an anonymous function. In the latter case, the function specification sent to the server includes the anonymous functions context (generation of the sent function specification is implemented in the Octave core). Sending a handle to a subfunction, however, will currently not work. Sending a handle to a private function will only work if its file path is the same at the server. Sending an anonymous function using "varargin" in the argument list will currently not work.

See also: pconnect, pserver, sclose, install_vars, netcellfun.


Next: , Previous: , Up: Cluster execution   [Index]

parallel-3.1.3/doc/html/PaxHeaders.30520/Authentication.html0000644000000000000000000000013113331003671020412 xustar0030 mtime=1533282233.421061778 29 atime=1533282233.41306162 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/Authentication.html0000644000175000017500000001333313331003671020614 0ustar00olafolaf00000000000000 parallel_doc: Authentication

Next: , Previous: , Up: Cluster execution   [Index]


3.2 Generating authentication keys

Loadable Function: parallel_generate_srp_data (username)
Loadable Function: parallel_generate_srp_data (username, options)

Prompts for a password (press enter for a random password) and writes TLS-SRP authentication files into the directory given by:

fullfile (a = pkg ("prefix"), "parallel-srp-data")

Server files are placed in subdirectory server. By default, a client authentication file is placed in subdirectory client. The latter contains the given username and the cleartext password. You do not need this file if you prefer to be prompted for username and password at connection time. In this case, you can prevent the client authentication file from being written by passing as the argument options a structure with a value of false in the field unattended.

For authentication, subdir server, and possibly subdir client, have to be placed together with their contents at the respective machines. They can either be placed under the directory given by:

fullfile (OCTAVE_HOME (), "share", "octave", "parallel-srp-data")

or – which might be the same directory – under:

fullfile (a = pkg ("prefix"), "parallel-srp-data")

Files in the former directory will take precedence over those in the latter. The contents of the files passwd and user_passwd (if present) must be kept secret.

This function zeroizes sensitive data before releasing its memory. Due to usage of external libraries, however, it still can’t be excluded that sensitive data is still on the swap device after application shutdown.

See also: pconnect, pserver, reval, psend, precv, sclose, select_sockets.

parallel-3.1.3/doc/html/PaxHeaders.30520/parcellfun.html0000644000000000000000000000013213331003671017567 xustar0030 mtime=1533282233.393061225 30 atime=1533282233.381060988 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/parcellfun.html0000644000175000017500000001664513331003671020001 0ustar00olafolaf00000000000000 parallel_doc: parcellfun

2.1 Function parcellfun

Function File: [o1, o2, …] = parcellfun (nproc, fun, a1, a2, …)
Function File: parcellfun (nproc, fun, …, "UniformOutput", val)
Function File: parcellfun (nproc, fun, …, "ErrorHandler", errfunc)
Function File: parcellfun (nproc, fun, …, "VerboseLevel", val)
Function File: parcellfun (nproc, fun, …, "ChunksPerProc", val)
Function File: parcellfun (nproc, fun, …, "CumFunc", cumfunc)

Evaluates a function for multiple argument sets using multiple processes. nproc should specify the number of processes. A maximum recommended value is equal to number of CPUs on your machine or one less. fun is a function handle pointing to the requested evaluating function. a1, a2 etc. should be cell arrays of equal size. o1, o2 etc. will be set to corresponding output arguments.

The UniformOutput and ErrorHandler options are supported with meaning identical to cellfun. A VerboseLevel option controlling the level output is supported. A value of 0 is quiet, 1 is normal, and 2 or more enables debugging output. The ChunksPerProc option control the number of chunks which contains elementary jobs. This option particularly useful when time execution of function is small. Setting this option to 100 is a good choice in most cases.

Instead of returning a result for each argument, parcellfun returns only one cumulative result if "CumFunc" is non-empty. cumfunc must be a function which performs an operation on two sets of outputs of fun and returnes as many outputs as fun. If nout is the number of outputs of fun, cumfunc gets a previous output set of fun or of cumfunc as first nout arguments and the current output of fun as last nout arguments. The performed operation must be mathematically commutative and associative. If the operation is e.g. addition, the result will be the sum(s) of the outputs of fun over all calls of fun. Since floating point addition and multiplication are only approximately associative, the cumulative result will not be exactly reproducible.

Notice that jobs are served from a single first-come first-served queue, so the number of jobs executed by each process is generally unpredictable. This means, for example, that when using this function to perform Monte-Carlo simulations one cannot expect results to be exactly reproducible. The pseudo random number generators of each process are initialised with a unique state. This currently works only for new style generators.

NOTE: this function is implemented using "fork" and a number of pipes for IPC. Suitable for systems with an efficient "fork" implementation (such as GNU/Linux), on other systems (Windows) it should be used with caution. Also, if you use a multithreaded BLAS, it may be wise to turn off multi-threading when using this function.

CAUTION: This function should be regarded as experimental. Although all subprocesses should be cleared in theory, there is always a danger of a subprocess hanging up, especially if unhandled errors occur. Under GNU and compatible systems, the following shell command may be used to display orphaned Octave processes: ps –ppid 1 | grep octave


parallel-3.1.3/doc/html/PaxHeaders.30520/XREFpararrayfun.html0000644000000000000000000000013213331003671020453 xustar0030 mtime=1533282233.585065016 30 atime=1533282233.585065016 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFpararrayfun.html0000644000175000017500000000503013331003671020647 0ustar00olafolaf00000000000000 parallel_doc: XREFpararrayfun

The node you are looking for is at XREFpararrayfun.

parallel-3.1.3/doc/html/PaxHeaders.30520/XREFfload.html0000644000000000000000000000013213331003671017206 xustar0030 mtime=1533282233.573064779 30 atime=1533282233.573064779 30 ctime=1533282233.633065964 parallel-3.1.3/doc/html/XREFfload.html0000644000175000017500000000476413331003671017417 0ustar00olafolaf00000000000000 parallel_doc: XREFfload

The node you are looking for is at XREFfload.