How to convert configure options for use with cmake - cmake

I have a script for building a project that I need to upgrade from using configure to cmake. The original configure command is
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--with-clang \
--prefix=$PREFIX \
--libdir=$PREFIX/lib${LIBDIRSUFFIX} \
--incdir=$PREFIX/include \
--mandir=$PREFIX/man/man1 \
--etcdir=$PREFIX/etc/root \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--enable-roofit \
--enable-unuran \
--disable-builtin-freetype \
--disable-builtin-ftgl \
--disable-builtin-glew \
--disable-builtin-pcre \
--disable-builtin-zlib \
--disable-builtin-lzma \
$GSL_FLAGS \
$FFTW_FLAGS \
$QT_FLAGS \
--enable-shared \
--build=$ARCH-slackware-linux
I am not familiar enough with cmake to know how to do the equivalent. I would prefer a command line option but am open to modifying the CMakeLists.txt file as well.

Related

How to run 'run_squad.py' on google colab? It gives 'invalid syntax' error

I downloaded the file first using:
!curl -L -O https://github.com/huggingface/transformers/blob/master/examples/legacy/question-answering/run_squad.py
Then used following code:
!python run_squad.py \
--model_type bert \
--model_name_or_path bert-base-uncased \
--output_dir models/bert/ \
--data_dir data/squad \
--overwrite_output_dir \
--overwrite_cache \
--do_train \
--train_file /content/train.json \
--version_2_with_negative \
--do_lower_case \
--do_eval \
--predict_file /content/val.json \
--per_gpu_train_batch_size 2 \
--learning_rate 3e-5 \
--num_train_epochs 2.0 \
--max_seq_length 384 \
--doc_stride 128 \
--threads 10 \
--save_steps 5000
Also tried following:
!python run_squad.py \
--model_type bert \
--model_name_or_path bert-base-cased \
--do_train \
--do_eval \
--do_lower_case \
--train_file /content/train.json \
--predict_file /content/val.json \
--per_gpu_train_batch_size 12 \
--learning_rate 3e-5 \
--num_train_epochs 2.0 \
--max_seq_length 584 \
--doc_stride 128 \
--output_dir /content/
The error says in both the codes:
File "run_squad.py", line 7
^ SyntaxError: invalid syntax
What exactly is the issue? How can I run the .py file?
SOLVED: It was giving error because I was downloading the github link rather than the script in github. Once I copied and used 'Raw' link to download the script, the code ran.

Use makeindex with pandoc while creating a PDF from a Markdown file

I have got a markdown file and like to convert it to pdf. I need an index. For this I found makeindx
I am using this command for creating a pdf from a markdown file:
pandoc "test.md" \
--from markdown --to latex \
--toc \
--toc-depth=1 \
--include-in-header index.tex \
--include-in-header chapter_break.tex \
--include-in-header inline_code.tex \
--include-in-header bullet_style.tex \
--include-in-header pdf_properties.tex \
--highlight-style pygments.theme \
-V toc-title='Inhaltsverzeichnis' \
-V title='Mein Titel' \
-V author='Ich' \
-V book=true \
-V date="24. Mai 2021" \
-V classoption='oneside' \
--template ./eisvogel.latex \
--listings \
-o "test.pdf"
The template Eisvogel I found on github. I asked the question in an issue here, too.
The file index.tex has this content:
\usepackage{makeidx}
\makeindex
In my document I use
Installation\index{Installation}
and at the end
\printindex
Unfortunately, no index is printed.
Am I doing something wrong?
Edit I found a temporarily solution:
First I create a *.latex.
pandoc JoomlaEnPDF.en.md \
-o 1.en.tex \
--from markdown \
--template ./eisvogel.latex \
--listings \
--toc \
--toc-depth=1 \
-V toc-title="Content" \
--top-level-division="part" \
--number-sections \
Then I run the commands manually.
pdflatex 1.en.tex
pdflatex 1.en.tex
makeindex 1.en.idx
cat ./1.en.ind >> JoomlaEnPDF.en.md
Then I create the pdf
pandoc JoomlaEnPDF.en.md \
-o 1.en.pdf \
--from markdown \
--template ./eisvogel.latex \
--listings \
--toc \
--toc-depth=1 \
-V toc-title="Table of Contents" \
--top-level-division="part" \
--number-sections \

OCLint got compile errors in html report file, but my project build success. WHY

xcodebuild -workspace ${myworkspace} -scheme ${myscheme} \
-sdk iphonesimulator \
-derivedDataPath ./build/derivedData \
-configuration Debug \
COMPILER_INDEX_STORE_ENABLE=NO \
| xcpretty -r json-compilation-database -o compile_commands.json
I run the command line above to build my project, it build success, but when i run the command line below to generate oclint html report file, get 15 compiler errors.
oclint-json-compilation-database -e Pods -- \
-extra-arg=-Wno-error=everything \
-report-type html \
-rc LONG_LINE=200 \
-rule MultipleUnaryOperator \
-max-priority-1=0 \
-max-priority-2=10 \
-max-priority-3=20 \
-o ./oclint_report.html
try this
oclint-json-compilation-database <YOUR OPTIONS HERE> -- -extra-arg=-Wno-everything
as:
oclint-json-compilation-database -e Pods -- \
-extra-arg=-Wno-error=everything \
-report-type html \
-rc LONG_LINE=200 \
-rule MultipleUnaryOperator \
-max-priority-1=0 \
-max-priority-2=10 \
-max-priority-3=20 \
-extra-arg=-Wno-everything \
-o ./oclint_report.html

Tensorflow inception-v4 Classify Image

I use TF-slim inception-v4 training a model from scratch.
python train_image_classifier.py \
--train_dir=${TRAIN_DIR} \
--dataset_name=mydata \
--dataset_split_name=train \
--dataset_dir=${DATASET_DIR} \
--model_name=inception_v4 \
--clone_on_cpu=true \
--max_number_of_steps=1000 \
--log_every_n_steps=100
# Run evaluation.
python eval_image_classifier.py \
--checkpoint_path=${TRAIN_DIR} \
--eval_dir=${TRAIN_DIR} \
--dataset_name=mydata \
--dataset_split_name=validation \
--dataset_dir=${DATASET_DIR} \
--model_name=inception_v4 \
--batch_size=32
# # # Fine-tune all the new layers for 500 steps.
python train_image_classifier.py \
--train_dir=${TRAIN_DIR}/all \
--dataset_name=mydata \
--dataset_split_name=train \
--dataset_dir=${DATASET_DIR} \
--model_name=inception_v4 \
--clone_on_cpu=true \
--checkpoint_path=${TRAIN_DIR} \
--max_number_of_steps=1000 \
--log_every_n_steps=100 \
--batch_size=32 \
--learning_rate=0.0001 \
--learning_rate_decay_type=fixed \
--save_interval_secs=600 \
--save_summaries_secs=600 \
--optimizer=rmsprop \
--weight_decay=0.00004
then freeze the graph:
python export_inference_graph.py \
--alsologtostderr \
--model_name=inception_v4 \
--is_training=True \
--labels_offset=999 \
--output_file=${OUTPUT_DIR}/unfrozen_inception_v4_graph.pb \
--dataset_dir=${DATASET_DIR}
#NEWEST_CHECKPOINT=$(cat ${TRAIN_DIR}/all/checkpoint |head -n1|awk -F\" '{print $2}')
NEWEST_CHECKPOINT=$(ls -t1 ${TRAIN_DIR}/all|grep model.ckpt |head -n1)
echo ${NEWEST_CHECKPOINT%.*}
python ${OUTPUT_DIR}/tensorflow/tensorflow/python/tools/freeze_graph.py \
--input_graph=${OUTPUT_DIR}/unfrozen_inception_v4_graph.pb \
--input_checkpoint=${TRAIN_DIR}/all/${NEWEST_CHECKPOINT%.*} \
--input_binary=true \
--output_graph=${OUTPUT_DIR}/frozen_inception_v4.pb \
--output_node_names=InceptionV4/Logits/Predictions \
--input_meta_graph=True
After all this, I got a frozen_inception_v4.pb file.
for this example https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/label_image/label_image.py
what is the input layer for inception_v4 ?
Does anyone know how to solve this?
That depends on the particular implementation of slim you used. Look where they define the input and see what is the name of that tensor.
Try this:
bazel build tensorflow/tools/graph_transforms:summarize_graph
bazel-bin/tensorflow/tools/graph_transforms/summarize_graph \
--in_graph=/path/to/your_frozen.pb
It will show possible input and output layer

yum stopped working with error No module named transactioninfo

Removed the following files by mistake and as a result yum stopped working.
Any idea what rpms exactly we need to re-install?
./abrt_exception_handler.pyo
./abrt_exception_handler.pyc
./abrt.pth
./abrt_exception_handler.py
./yum/sqlitesack.pyo
./yum/rpmsack.pyo
./yum/packages.pyo
./yum/misc.pyo
./yum/metalink.pyo
./yum/__init__.pyo
./yum/history.pyo
./yum/depsolve.pyo
./rpmUtils/miscutils.pyo
./yum/yumRepo.pyo
./yum/yumRepo.pyc
./yum/yumRepo.py
./yum/update_md.pyo
./yum/update_md.pyc
./yum/update_md.py
./yum/transactioninfo.pyo
./yum/transactioninfo.pyc
./yum/transactioninfo.py
./yum/sqlutils.pyo
./yum/sqlutils.pyc
./yum/sqlutils.py
Ok, found the solution. Since I don't know exactly which python modules belongs to which rpm, I did a re-install of most of the dependent rpms. Here it goes.
#!/bin/bash
for file in \
elfutils-0.152-1.el6.x86_64.rpm \
elfutils-libs-0.152-1.el6.x86_64.rpm \
expat-2.0.1-11.el6_2.x86_64.rpm \
gmp-4.3.1-7.el6_2.2.x86_64.rpm \
libxml2-2.7.6-8.el6_3.4.x86_64.rpm \
libxml2-python-2.7.6-8.el6_3.4.x86_64.rpm \
m2crypto-0.20.2-9.el6.x86_64.rpm \
python-2.6.6-36.el6.x86_64.rpm \
python-iniparse-0.3.1-2.1.el6.noarch.rpm \
python-urlgrabber-3.9.1-8.el6.noarch.rpm \
readline-6.0-4.el6.x86_64.rpm \
rpm-4.8.0-32.el6.x86_64.rpm \
rpm-libs-4.8.0-32.el6.x86_64.rpm \
rpm-python-4.8.0-32.el6.x86_64.rpm \
sqlite-3.6.20-1.el6.x86_64.rpm \
yum-3.2.29-40.el6.centos.noarch.rpm \
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
do wget http://mirror.centos.org/centos-6/6/os/x86_64/Packages/$file;
done
rpm -Uvh *.rpm --force