mpirun with socwatch fails - c++

On trying to measure energy consumption on my system with an OpenMPI program.
For OpenMPI, we can run with
mpirun -n 4 ./hello
This program will print hello from 4 processes.
Now, If it is a C++ program, we can run SocWatch with it as
sudo socwatch -m -f sys -f wakelock -t 35 -p ./hello
With OpenMPI, I try
sudo socwatch -m -f sys -f wakelock -t 35 -p mpirun -n 4 ./hello
But the program is stropped because socwatch did not recognize to mpi-run.
How to run SoCWatch with MPI

The most likely reason would be mpirun is in your $PATH as a user, but is no more in your $PATH when sudo is used. Try using the absolute path to mpirun instead. Note you will need to pass the --allow-run-as-root option to mpirun.

Related

DL4006 warning: Set the SHELL option -o pipefail before RUN with a pipe in it

I have a Dockerfile
FROM strimzi/kafka:0.20.1-kafka-2.6.0
USER root:root
RUN mkdir -p /opt/kafka/plugins/debezium
# Download, unpack, and place the debezium-connector-postgres folder into the /opt/kafka/plugins/debezium directory
RUN curl -s https://repo1.maven.org/maven2/io/debezium/debezium-connector-postgres/1.7.0.Final/debezium-connector-postgres-1.7.0.Final-plugin.tar.gz | tar xvz --transform 's/debezium-connector-postgres/debezium/' --directory /opt/kafka/plugins/
USER 1001
When I use hadolint on it by
hadolint Dockerfile
I got warning
Dockerfile:6 DL4006 warning: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check
I know I have a pipe | in the line started with RUN.
However, I still really don't know how to fix based on this warning.
Oh, just found the solution in the wiki page at https://github.com/hadolint/hadolint/wiki/DL4006
Here is my fixed version:
FROM strimzi/kafka:0.20.1-kafka-2.6.0
USER root:root
RUN mkdir -p /opt/kafka/plugins/debezium
# Download, unpack, and place the debezium-connector-postgres folder into the /opt/kafka/plugins/debezium directory
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl -s https://repo1.maven.org/maven2/io/debezium/debezium-connector-postgres/1.7.0.Final/debezium-connector-postgres-1.7.0.Final-plugin.tar.gz | tar xvz --transform 's/debezium-connector-postgres/debezium/' --directory /opt/kafka/plugins/
USER 1001
The reason adding SHELL ["/bin/bash", "-o", "pipefail", "-c"] is at https://github.com/docker/docker.github.io/blob/master/develop/develop-images/dockerfile_best-practices.md#using-pipes
Below is a copy:
Some RUN commands depend on the ability to pipe the output of one command into another, using the pipe character (|), as in the following example:
RUN wget -O - https://some.site | wc -l > /number
Docker executes these commands using the /bin/sh -c interpreter, which only
evaluates the exit code of the last operation in the pipe to determine success.
In the example above this build step succeeds and produces a new image so long
as the wc -l command succeeds, even if the wget command fails.
If you want the command to fail due to an error at any stage in the pipe,
prepend set -o pipefail && to ensure that an unexpected error prevents the
build from inadvertently succeeding. For example:
RUN set -o pipefail && wget -O - https://some.site | wc -l > /number
Not all shells support the -o pipefail option.
In cases such as the dash shell on
Debian-based images, consider using the exec form of RUN to explicitly
choose a shell that does support the pipefail option. For example:
RUN ["/bin/bash", "-c", "set -o pipefail && wget -O - https://some.site | wc -l > /number"]

ocamlc - compiling ocaml-wasm - Error: /usr/lib/ocaml/bigarray.cma is not a bytecode object file

I'm trying to make install ocaml-wasm 1.
Unfortunately the build is failing with the error-message:
Error: /usr/lib/ocaml/bigarray.cma is not a bytecode object file
Here's a Dockerfile so you may reproduce the error:
FROM base/archlinux
RUN pacman -Sy --noconfirm ocaml ocamlbuild wget unzip make
RUN wget https://github.com/WebAssembly/spec/archive/v1.0.zip
RUN unzip v1.0.zip
CMD cd spec-1.0; make -C interpreter install; bash
You may run it:
docker build -t ocaml-wasm . && docker run --rm -it ocaml-wasm
It should find it to produce the same error as above.
Here's the entire output of the make command:
make: Entering directory '/spec-1.0/interpreter'
ls util/*.ml* syntax/*.ml* binary/*.ml* text/*.ml* valid/*.ml* runtime/*.ml* exec/*.ml* script/*.ml* host/*.ml* main/*.ml* \
| sed 's:\(.*/\)\{0,1\}\(.*\)\.[^\.]*:\2:' \
| grep -v main \
| sort | uniq \
>wasm.mlpack
echo >_tags "true: bin_annot"
echo >>_tags "<{util,syntax,binary,text,valid,runtime,exec,script,host,main}/*.cmx>: for-pack(Wasm)"
ocamlbuild -cflags '-w +a-4-27-42-44-45 -warn-error +a' -I util -I syntax -I binary -I text -I valid -I runtime -I exec -I script -I host -I main -libs bigarray -quiet wasm.cmx
+ /usr/bin/ocamlc.opt -pack bigarray.cma -bin-annot util/lib.cmo binary/utf8.cmo exec/float.cmo exec/f32.cmo exec/f64.cmo exec/numeric_error.cmo exec/int.cmo exec/i32.cmo exec/i64.cmo syntax/types.cmo syntax/values.cmo runtime/memory.cmo util/source.cmo syntax/ast.cmo util/error.cmo binary/encode.cmo exec/i64_convert.cmo syntax/operators.cmo binary/decode.cmo script/script.cmo text/parser.cmo text/lexer.cmo text/parse.cmo util/sexpr.cmo text/arrange.cmo exec/i32_convert.cmo exec/f32_convert.cmo exec/f64_convert.cmo exec/eval_numeric.cmo runtime/func.cmo runtime/global.cmo runtime/table.cmo runtime/instance.cmo exec/eval.cmo host/env.cmo main/flags.cmo script/import.cmo script/js.cmo text/print.cmo valid/valid.cmo script/run.cmo host/spectest.cmo -o wasm.cmo
File "_none_", line 1:
Error: /usr/lib/ocaml/bigarray.cma is not a bytecode object file
Command exited with code 2.
make: *** [Makefile:83: _build/wasm.cmx] Error 10
rm wasm.mlpack _tags
make: Leaving directory '/spec-1.0/interpreter'
How do I get ocaml-wasm to compile?
I've seen 2, but the answer doesn't help me. I've not installed any non-standard binaries. Could the ocaml distribution on arch linux be broken?
I suspect that your ocamlbuild version is 0.13 (see ocamlbuild --version), which is known to have this issue. You should use 0.12 to avoid the problem.
ocamlbuild 0.13 is not package on opam because of this problem (so it's not visible to most users), but I hadn't considered that distribution packagers may decide to package it nonetheless.

while installing zamfoo on server it failed and I entered this command now unable to install or uninstall or reinstall

the three command i entered are
cd /usr/bin
mv perl perl-backup
ln -s /usr/bin/perl /usr/local/bin/perl
this is causing me error bad interpreter: too many levels of symbolic links
Please tell me how to undo this command
Since you only had problems with creating a symlink at the end, you should only need to undo your move, with:
mv perl-backup perl
You should look at the output of:
ls -l /usr/bin/perl /usr/local/bin/perl
to see if either of them are symlinks already.

Set a custom install directory when making a deb package with fpm

I'm using fpm to create a deb package, but when I install that deb package, it is installed into the wrong location, my fpm command is:
fpm -f -s "dir" -t "deb" -a "all" -n "my_project" -v 1 -C "/tmp/tmpjWTuVp" /tmp/tmpjWTuVp/my_project
The folder i want to package up exists at /tmp/tmpjWTuVp/my_project, but every time i install it with:
dpkg -i my_package.deb
it installs it into /tmp/tmpjWTuVp/my_project, ideally i'd like it to install into /var/lib/my_project. I have tried --installdir and --root with my dpkg command, but it complains with cannot access archive: No such file or directory
Other information:
I'm installing onto an ubuntu box
I'm very new to deb packaging, so may have missed something obvious
I'm not bound to fpm and happy to hear other viable suggestions
inside my_project is a python virtualenv and my django project
I have randomly found the answer to this immediately after writing this question...
basically the last, unnamed argument within the fpm command can contain an equals separator which defines the directory to come from, and to install to, so the command I ended up using was:
fpm -f -s "dir" -t "deb" -a "all" -n "my_project" -v 1 -C "/tmp/tmpjWTuVp" my_project=/var/lib/my_project
Notice the my_project=/var/lib/my_project, the left side is the directory name of my project (relative, because I used -C to change directory to /tmp/tmpjWTuVp before looking for packages) and on the right side is where I want to install to on the remote machine...

Using a FilteredClassifier with a Bayesian Network in WEKA

I'm running WEKA from the command line to create a Bayesian network model for training, and then using this model to test on a separate data set. The Bayesian network uses the TAN search option with a simple estimator. My command line call for training looks like this:
java -cp weka.jar:mysql-connector-java-5.0.8-bin.jar
weka.classifiers.bayes.BayesNet -d BN_model -p 0 -distribution -t tr2.arff -D
-Q weka.classifiers.bayes.net.search.local.TAN -- -S BAYES
-E weka.classifiers.bayes.net.estimate.SimpleEstimator -- -A 1 > tr_preds
Now, I just realized I need to use a a FilteredClassifier since I want to add instance IDs to my test data. This is where I'm stuck. I run the following:
java -cp weka.jar:mysql-connector-java-5.0.8-bin.jar
weka.classifiers.meta.FilteredClassifier
-F weka.filters.unsupervised.attribute.Remove -R 1
-W weka.classifiers.bayes.BayesNet -d BN_model -p 1 -distribution -t tr2.arff -D
-Q weka.classifiers.bayes.net.search.local.TAN -- -S BAYES
-E weka.classifiers.bayes.net.estimate.SimpleEstimator -- -A 1 > tr_preds
and I get the following error:
Weka exception: Illegal options: -S BAYES
To trouble shoot, I removed all the fancy search options and estimators, and just ran the Bayesian Network classifier with default settings. This worked fine, but it's obviously not what I need. It's clear that I'm having issues constructing this command line statement properly.
Could you please advise what I'm doing wrong? Thanks so much!
Best,
Francisco
The problem is that your command line arguments are in a wrong order. Because -- -S BAYES is the first -- after -W, it thinks this option belongs to weka.classifiers.bayes.BayesNet, which is an illegal option. You forgot the -- after -W ... to specifiy the options of the classifier.
Also, general options like -t tr2.arff -d BN_model -p 1 -distribution were placed somewhere in the middle, it is better to place them after the class you're calling:
java -cp weka.jar:mysql-connector-java-5.0.8-bin.jar
weka.classifiers.meta.FilteredClassifier
-t tr2.arff -d BN_model -p 1 -distribution
-F "weka.filters.unsupervised.attribute.Remove -R 1"
-W weka.classifiers.bayes.BayesNet
-- -D -Q weka.classifiers.bayes.net.search.local.TAN
-- -S BAYES
-E weka.classifiers.bayes.net.estimate.SimpleEstimator
-- -A 1