January 29, 2021

[Note] add Anaconda to Win10 Terminal

From: https://dev.to/azure/easily-add-anaconda-prompt-in-windows-terminal-to-make-life-better-3p6j

Open settings from Terminal and add following:

    {
        "guid""{0caa0dad-35be-5f56-a8ff-afceee452369}",
        "name""Anaconda",
        "icon""%USERPROFILE%\\Anaconda3\\Menu\\anaconda-navigator.ico",
        "commandline""cmd.exe /K C:\\Users\\kkim\\Anaconda3\\Scripts\\activate.bat",
        "hidden"false
      }

Just change the user name (e.g "kkim") with yours.




January 24, 2021

Fira Code





Download

https://github.com/tonsky/FiraCode/releases/download/5.2/Fira_Code_v5.2.zip

Check the latest on https://github.com/tonsky/FiraCode


Install

Windows 10

Settings -> Font -> drop the font files


Ubuntu

$ sudo apt install fonts-firacode


VSC (Visual Studio Code)

Open settings.json and add/update:

"editor.fontFamily": "'Fira Code'",
"editor.fontLigatures" : true,
"editor.fontSize": 15,


(was: "editor.fontFamily": "'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'",


Preview Font

Programming Fonts Test Drive, https://www.programmingfonts.org/


References

January 12, 2021

[Note] GNOME shell gets slower

System: Ubuntu 20.04

GNOME gets slower as I leave the computer on for more than a few days and keep using it -- drop down menu gets affected especially slow.  Seems like some menus are ok though.  And overall computer performance gets slower also.

Login out-back in makes little better, but not so much.  Eventually GUI becomes unusable and have to restart.

I did some googling and seems it is a known issue but happens to others in different situations.

There is no fix for this yet.  

If that happens, the remedy is restarting gnome-shell.  

ALT-F2 and then type "r".

 

 

Reference

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/62

 

[Note] Set CPU to max for Ubuntu 20.04

Objetive: Set CPU speed to max

Issue:

Setting CPU performance is not working properly in Ubuntu 20.04 for old Xeon (max 3GHz).  Trying to set it to MAX all the time.

 

Checking current setting:

$ more /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
::::::::::::::
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
::::::::::::::
ondemand
::::::::::::::
/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
::::::::::::::
ondemand
::::::::::::::
/sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
::::::::::::::
ondemand
::::::::::::::
/sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
::::::::::::::
ondemand

 

Changing setting manually:

$ sudo -i
$ echo "performance" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

However, this setting will revert after reboot.


Step 1. Changing in BIOS

For my PC (Dell workstation), SpeedStep can be disabled in BIOS.

After reboot, the CPU speed still fluctuate.

Step 2. change boot option in grub

$ sudo vi /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="intel_idle.max_cstate=0 processor.max_cstate=1 pcie_aspm=off quiet splash"

Step 3. disable 'ondemand'

$ systemctl is-enabled ondemand
$ systemctl disable ondemand

and reboot.


References


January 11, 2021

[Note] sonatype-nexus in Docker

Docker

1. Create data folder

$ mkdir /data/docker.data/nexus && chown -R 200 /data/docker.data/nexus

2. Map the data folder and create container

$ docker run -d -p 8088:8081 --name nexus -v /data/docker.data/nexus:/nexus-data sonatype/nexus3

Wait about 3 min.  

 

Set up Nexus

1. admin password is in <data folder>/nexus/admin.password

$ more /data/docker.data/nexus/admin.password 

2. Open http://localhost:8088, ID=admin and PW=from previous step

3. Update password, create user, create repository.


Test

Set up .m2/settings.xml:

<settings>
  <servers>
    <server>
      <id>test</id>
      <username>kkim</username>
      <password>*USER PASSOWRD SET IN NEXUS*</password>
    </server>
  </servers>
</settings>


Deploy JAR.  "repositoryId=" must match with server id from above settings.xml:

$ mvn deploy:deploy-file \
    -DgroupId=com.keithkim.test \
    -DartifactId=test-module \
    -Dversion=1.0.0 \
    -DgeneratePom=true \
    -Dpackaging=jar \
    -DrepositoryId=test \
    -Durl=http://localhost:8088/repository/keithkim/jars \
    -Dfile=/opt/jars/sqlite-jdbc-3.23.1.jar

If you get build failure like this:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.163 s
[INFO] Finished at: 2021-01-11T01:53:52-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project standalone-pom: Failed to deploy metadata: Could not transfer metadata com.keithkim.test:test-module/maven-metadata.xml from/to test (http://localhost:8088/repository/keithkim/jars): Transfer failed for http://localhost:8088/repository/keithkim/jars/com/keithkim/test/test-module/maven-metadata.xml 400 Bad Request -> [Help 1]

Edit this file, <DATA DIR>/etc/nexus.properties

$ vi /data/docker.data/nexus/etc/nexus.properties

Add this line:

nexus.maven.metadata.validation.enabled=false

Restart the container and try again.


January 7, 2021

[Note] CUDA reinstall with Ubuntu 20.04 and Nvidia driver 455.45.01

After upgrading Nvidia driver to 455, tensorflow-gpu stopped working and this is a note on reinstallling all the necessary s/w.

Environment

  • Xeon CPU with AVX, no BMI2
  • Ubuntu 20.04
  • Nvidia Driver 455
  • Quadro P2000 (compute capabilities=5.2)

 

What didn't work

I thought this may be an opportunity to upgrade CUDA, tenssrflow and everything else but learned it's not that simple for my PC.

Tried CUDA 11.1 + Tensorflow 2.4 = This requires CPU supporting BMI2 instructions.  Otherwise need to compile TF2.4 myself.

Downgrading the driver to 450, 440 with CUDA 10.2 (or 10.1) + TF 2.2.0 = after reboot, driver is back to 455.  Not working.


What worked 

Driver v455 + CUDA 10.2 + TF 2.2.0

And the installation was pretty simple:

1. Install v455 driver

2. Install CUDA, $ sudo apt-get install nvidia-cuda-toolkit

$ conda create -n tf python=3.7.9
$ conda activate tf
$ conda install tensorflow-gpu=1.5.0 keras

Or,

$ conda create -n tf2 python=3.7.9
$ conda activate tf2
$ conda install tensorflow-gpu=2.2.0 keras

Step #2 will install CUDA 10.2.


Jupyter

Install Jupyter

$ conda install
$ conda install -c conda-forge jupyter_nbextensions_configurator jupyter_contrib_nbextensions

$ jupyter nbextensions_configurator enable --user


When run Jupyter, noticed a lot of error messages like this:

Config option `template_path` not recognized by `ExporterCollapsibleHeadings`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?

This can be fixed by downgrading nbconvert from 6.0.7 to 5.6.1:

$ conda install nbconvert=5.6.1

But Jupyter extension is still broken.  Nbextentions tab does not appear.  File->Edit-> nbextensions, I get this error:

404 GET /static/notebook/js/mathjaxutils.js?v=2021010720231

To fix this,

1. Go to conda envs directory.  e.g. $ cd ~/anaconda3/envs/tf

2. $ vi ./lib/python3.7/site-packages/jupyter_nbextensions_configurator/static/nbextensions_configurator/render/render.js

3. change 'notebook/js/mathjaxutils' to 'base/js/mathjaxutils'


Reference, 

https://discourse.jupyter.org/t/the-static-notebook-js-mathjaxutils-js-is-missing/7303/2



Helpful Commands

$ lscpu | grep -i bmi2

$ sudo lshw -C display

$ sudo ubuntu-drivers devices