Skip to content

Instantly share code, notes, and snippets.

@lisanhu
lisanhu / cmake-test-vendor.txt
Created March 25, 2019 00:48
CMake testing C/CXX compiler vendor
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# using GCC
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# using Clang
#elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
# using Intel C++
#elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")
# using PGI
@lisanhu
lisanhu / custom_lib_setting.sh
Last active April 2, 2019 20:29
custom lib path settings
# Custom lib home
export LIB_HOME=/home/lisanhu/mine/lib;
# Normal lib config
export PATH=$LIB_HOME/bin:$PATH;
export CPATH=$LIB_HOME/include:$CPATH;
export MANPATH=$MANPATH:$LIB_HOME/share/man;
export LIBRARY_PATH=$LIB_HOME/lib:$LIBRARY_PATH; # for static libraries
export LD_LIBRARY_PATH=$LIB_HOME/lib:$LD_LIBRARY_PATH; # for dynamic libraries
@lisanhu
lisanhu / openacc_test.c
Created March 24, 2019 23:17
OpenACC test code
/**
* A test code to test whether PGI compiler is successfully installed and configured
* for openacc code.
*
* Origin: https://www.olcf.ornl.gov/tutorials/openacc-vector-addition/
*
* Minor changes to print out information when data initialization on host is done
* Compile the code with command line: `pgcc -Minfo -ta=tesla openacc_test.c -o test.out`
*/
#include <stdio.h>
@lisanhu
lisanhu / default.custom.yaml
Created March 22, 2019 21:49 — forked from lotem/default.custom.yaml
在Rime輸入方案選單中添加五筆、雙拼、粵拼、注音,保留你需要的
# default.custom.yaml
# save it to:
# ~/.config/ibus/rime (linux)
# ~/Library/Rime (macos)
# %APPDATA%\Rime (windows)
patch:
schema_list:
- schema: luna_pinyin # 朙月拼音
- schema: luna_pinyin_simp # 朙月拼音 简化字模式
@lisanhu
lisanhu / pgi_silent_env.sh
Last active May 3, 2019 01:50
Environment Variables for PGI compiler installation (silent install env and bashrc settings)
# Pre-install environment variables
export PGI_SILENT=true;
export PGI_ACCEPT_EULA=accept;
export PGI_INSTALL_DIR=~/opt/pgi;
export PGI_INSTALL_TYPE=single;
export PGI_INSTALL_NVIDIA=false; # For systems without NVIDIA or pre-installed CUDA
# Post-install environment settings
export PGI=~/opt/pgi; # Note: this is the custom installation folder instead of the default /opt/pgi
export PGI_ARCH=linux86-64;
@lisanhu
lisanhu / check-os-release.sh
Created November 6, 2018 19:04
commands for checking linux os release info (name, etc.)
# origin at https://www.cyberciti.biz/faq/how-to-check-os-version-in-linux-command-line/
cat /etc/os-release
lsb_release -a
hostnamectl
uname -a
@lisanhu
lisanhu / pip-update-all.sh
Created November 5, 2018 17:03
pip update all outdated packages
pip list --format freeze | cut -f 1 -d = | xargs pip install --upgrade