Top

Tags: Linux

Using module load command to switch environment for an application on CentOS 7

Nov 02, 2020 | 558 views

#Linux

Refer to

For HPC:


yum install lmod-ohpc-8.1.18-6.1.ohpc.1.3.9.x86_64
# shell file into modulefile
/opt/ohpc/admin/lmod/8.1.18/libexec/sh_to_modulefile example.sh

Install it:

yum install environment-modules -y; bash

Examples:

root@beta  ## > cd /usr/share/Modules/modulefiles
root@beta ## > mkdir compilers
root@beta ## > cp modules compilers/gcc-4.8.5

"Then we edit the module info (compilers/gcc-4.8.5). The modified version looks like this:"

#%Module1.0###################################
##
## modules compilers/gcc-4.8.5
##
## modulefiles/compilers/gcc-4.8.5. Sample gcc module
##
proc ModulesHelp { } {
 global version modroot

puts stderr "compilers/gcc-4.8.5 - sets the Environment for 
      GCC 4.8.5 "
}

module-whatis "Sets the environment for using 
    gcc-4.8.5 (C, Fortran)"

# for Tcl script use only
set topdir /usr/bin/gcc
set version 4.8.5
set sys linux86

setenv CC $topdir/bin/gcc
setenv GCC $topdir/bin/gcc
setenv FC $topdir/bin/gfortran
setenv F77 $topdir/bin/gfortran
setenv F90 $topdir/bin/gfortran
prepend-path PATH $topdir/include
prepend-path PATH $topdir/bin
prepend-path MANPATH $topdir/man
prepend-path LD_LIBRARY_PATH $topdir/lib

Test it:

  988  module avail
  989  module help compilers/gcc-4.8.5
  990  cat compilers/gcc-4.8.5
  991  module whatis compilers/gcc-4.8.5
  992  module load compilers/gcc-4.8.5
  993  module list
  994  env
  995  env | more
  996  /usr/bin/gcc/
  997  env
  998  module unload compilers/gcc-4.8.5
  999  env


Comments: 0

Ubuntu | Debian: Network Manager says Wifi "device not managed"

Oct 31, 2020 | 556 views

#Linux

Refer to stackoverflow ""

wired device not managed

Most probably your interface appears in /etc/network/interfaces. By default, NetworkManager does not manage interfaces that appear in /etc/network/interfaces. You can change this behaviour.

To do this - in a terminal:

sudo nano /etc/NetworkManager/NetworkManager.conf

change the line managed=false to managed=true

Save, stop and start network manager:

sudo service network-manager restart

""

Comments: 0

Install VNC Server on CentOS 7

Oct 29, 2020 | 2985 views

#Linux #InstallGuide

VNC with Default desktop [Recommended]

Refer to:  


## install vncserver
yum install tigervnc-server xorg-x11-fonts-Type1

## copy vnc systemc config file, :3 is an example, other number can be used
cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:3.service

## replace  with a user name
grep USER /lib/systemd/system/[email protected]
# 2. Replace  with the actual user name and edit vncserver
ExecStart=/usr/bin/vncserver_wrapper  %i

## change into 
# su - 
## run below command to set user's vnc password 
$ vncserver

VNC with XFCE 

Refer to 

Beware xstartup file requires to unset variables SESSION_MANAGER and DBUS_SESSION_BUS_ADDRESS as below describles.


--------- Install necessary packages in root ------
  881  yum -y install epel-release
  883  yum groupinstall "Xfce" -y
  884  yum -y install tigervnc-server tigervnc-server-minimal
  885  history
--------- login to normal user ------------
	 # su - user
	1  ls
	## set password
    2  vncserver
    3  cd ~/.vnc/
    4  vncserver -list

       cp /etc/X11/Xresources ~/.Xresources

    5  cp xstartup{,.bak}
	## EDIT xstartup as below
    7  cat xstartup
#!/bin/bash

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

xrdb $HOME/.Xresources
startxfce4 &


For Ubuntu 16.04: How to Install and Configure VNC on Ubuntu 16.04 

For Ubuntu 18.04: How to Install and Configure VNC on Ubuntu 18.04 

Comments: 0

Install CUDA 11.1 and Pytorch 1.7 on CentOS 7

Oct 28, 2020 | 2333 views

#Linux #InstallGuide



How to Install CUDA 11.1 + Pytorch 1.7


=================================================
Install CUDA 11.1
=================================================

下载:https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda-repo-rhel7-11-1-local-11.1.0_455.23.05-1.x86_64.rpm
文档:https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html



===== Step One:
 
 Pre-installation Actions [https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#pre-installation-actions] 
 
!!! Important: 
You may need to update kernel if ` yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)` fails.
How to update kernel: `yum install kernel kernel-tools kernel-tools-libs` [https://www.golinuxcloud.com/how-to-update-kernel-rhel-centos-7-yum-linux/] 



===== Step Two: 
 Package Manager Installation [https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#package-manager-installation]

===== Step Three:
 Post-installation Actions [https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions]

===== Step Four: Install proper drivers for Graphic cards
[ https://www.server-world.info/en/note?os=CentOS_7&p=nvidia]

===== Step Five: Compile samples
# cuda-install-samples-11.1.sh  [dir]
# make -k -j

检查命令
nvidia-smi
lspci | grep -i nvi
./bin/x86_64/linux/release/deviceQuery

当中可能遇到的错误情况处理:
1. centos7 yum 错误 This system is not registered with an entitlement server [https://blog.csdn.net/whatday/article/details/106106767]
2. cudaNvSci.h: fatal error: nvscibuf.h: No such file or directory [https://cloud.tencent.com/developer/article/1584631] 

其他参考:
1. https://www.server-world.info/en/note?os=CentOS_7&p=cuda&f=4 (samples的测试)
2. https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#abstract (Official installation guide)

=================================================
Install Pytorch 1.7
=================================================
https://pytorch.org/get-started/locally/

Recommend using conda to install Pytorch, refer to above link:
conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch

For pip, run this Command: pip install torch==1.7.0+cu110 torchvision==0.8.1+cu110 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html 

Test code after successful installation from [https://varhowto.com/install-pytorch-cuda-10-2/]


How to install CUDA 10.2 + Pytorch 1.6 on CentOS 7


=================================================
Install CUDA 10.2 
=================================================

Download:https://developer.nvidia.com/cuda-10.2-download-archive?target_os=Linux&target_arch=x86_64&target_distro=CentOS&target_version=7&target_type=rpmnetwork
Document:https://docs.nvidia.com/cuda/archive/10.2/cuda-installation-guide-linux/index.html



===== Step One:
 
 Pre-installation Actions [https://docs.nvidia.com/cuda/archive/10.2/cuda-installation-guide-linux/index.html#pre-installation-actions] 
 
!!! Important: 
You may need to update kernel if ` yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)` fails.
How to update kernel: `yum install kernel kernel-tools kernel-tools-libs` [https://www.golinuxcloud.com/how-to-update-kernel-rhel-centos-7-yum-linux/] 



===== Step Two: 
 Package Manager Installation [https://docs.nvidia.com/cuda/archive/10.2/cuda-installation-guide-linux/index.html#package-manager-installation]

===== Step Three:
 Post-installation Actions [https://docs.nvidia.com/cuda/archive/10.2/cuda-installation-guide-linux/index.html#post-installation-actions]

===== Step Four: Install proper drivers for Graphic cards
[ https://www.server-world.info/en/note?os=CentOS_7&p=nvidia]

===== Step Five: Compile samples
# cuda-install-samples-10.2.sh [directory]
# make -k -j

当中可能遇到的错误情况处理:
1. centos7 yum 错误 This system is not registered with an entitlement server [https://blog.csdn.net/whatday/article/details/106106767]
2. cudaNvSci.h: fatal error: nvscibuf.h: No such file or directory [https://cloud.tencent.com/developer/article/1584631] 

其他参考:
1. https://www.server-world.info/en/note?os=CentOS_7&p=cuda&f=4 (samples的测试)
2. https://docs.nvidia.com/cuda/archive/10.2/cuda-installation-guide-linux/index.html#post-installation-actions (Official installation guide)

=================================================
Install Pytorch 1.6
=================================================
-------First: Install Python-3.8.1 (Follow from source guide [https://phoenixnap.com/kb/how-to-install-python-3-centos-7] )---------

How to Install PyTorch with CUDA 10.2: https://varhowto.com/install-pytorch-cuda-10-2/

Comments: 0