Author Archives: yosuke

Julia build with Intel MKL

I start to use Julia. Fast & Useful linear algebra. It is a fresh alternative of Matlab. We can use Intel MKL without Intel Compiler. However, we have to bulid Julia as follows (Julia v0.6 & Ubuntu 16.04).

    1. Install Intel MKL
    2. Clone Julia repository of git
    3. Add Makefile.user in the main julia source directory with the following
      override USE_INTEL_MKL=1
      override USE_INTEL_LIBM = 0

      (Note that the final line is install directory)

    4. Add the following to deps/tools/, for ARPACK.

      ifeq  ($(USE_INTEL_MKL), 1)
      ifneq ($(USEIFC),1)
      USE_BLAS_FFLAGS += -ff2c


    5. “make -j4” after “source /opt/intel/mkl/bin/ intel64 ilp64”
    6. We can check results by make testall
    7. I saw an error about the following part of cmdlineargs.jl, but it seems no problem.
      if !is_windows() && VersionNumber(Base.libllvm_version) > v"3.3"
      testdir = mktempdir()
      cd(testdir) do
      @test success(`$exename -e "exit(0)"`)
    8. make install

BST file for Physical Review Applied

To prepare bibliography for Physical Review Applied, I modified apsrev4-1.bst of revtex.


  • In string.enquote, I commented out bbl.enquote “{” * swap$ * “}” *
  • I set #1 for control.title (just before ‘control.title :=, because of RPN)
  • I saved as apsrev4-1_custom.bst, and put \bibliographystyle{apsrev4-1_custom} in the main tex file.

qnap TS-220 openssh build

I have been using qnap TS-220. We can not login as user by the default openssh and ipkg openssh is too old. I tried to compile openssh for qnap with a ARM CPU. I used the following code:

## install Optware QPKG and required packages
#ipkg install gcc make perl sed gawk tar gzip bzip2 zlib mktemp
#export PATH=/opt/bin:/opt/sbin:$PATH

## grab the source
wget --no-check-certificate # < heartbleed free
wget --no-check-certificate

## make temporary dir for dependencies (libpam headers and openssl)
## openssl will be compiled statically so you can remove this directory afterwards
mkdir -p $DEPDIR/usr/include

## we need only the PAM headers, we use QNAP's
tar xjf Linux-PAM-1.2.0.tar.bz2
ln -s /lib/
cp -r Linux-PAM-1.2.0/libpam/include/security/ $DEPDIR/usr/include || exit

## install openssl to DEPDIR
tar xzf openssl-1.0.2a.tar.gz
pushd openssl-1.0.2a
./Configure --prefix=/usr --openssldir=/etc/ssl --libdir=lib zlib no-asm linux-armv4 "-Wa,--noexecstack" || exit
make depend || exit
make || exit
make INSTALL_PREFIX=$DEPDIR MANDIR=/usr/share/man MANSUFFIX=ssl install || exit

## build openssh
tar xzf openssh-6.8p1.tar.gz
pushd openssh-6.8p1
./configure --build=arm --prefix=/opt/openssh-6.8p1 --sysconfdir=/opt/etc/openssh\
 --with-ssl-engine --with-pam --with-md5-passwords --with-pid-dir=/opt/var/run\
 --with-ldflags=-L$DEPDIR/usr/lib --with-cflags=-I$DEPDIR/usr/include
make || exit

## optionally install whole ssh to some dir
## or just copy sshd binary
#cp openssh-6.6p1/sshd ~
make install || exit
## optionally cleanup
#rm -fr Linux-PAM-1.2.0* openssh-6.8p1* openssl-1.0.2a* $DEPDIR

 Next, I made /opt/etc/init.d/S42sshd:

if [ -f /opt/var/run/ ] ; then
  kill `cat /opt/var/run/`    
  killall /opt/openssh-6.8p1/sbin/sshd   
rm -f /opt/var/run/             
umask 077                                

Finally, I added the following to /share/MD0_DATA/.qpkg/autorun/

/opt/etc/init.d/S42sshd start

 Ref: (NON ARM version)