[2] 实验编程 / [3] 操作系统 · 2021年7月3日

IDL 安装 command line

  1. Linux 系统 IDL88/ENVI56安装
    1. 安装ENVI/SARSCAPE
    2. 安装 opencl
      1. INTEL
      2. AMD
    3. 激活
  2. linux 系统 IDL8.3/ENVI5.1 安装
    1. 安装程序
    2. 破解
    3. 运行程序
    4. 可能出现的错误
      1. 提示未破解
      2. Can’t make directory /usr/tmp/.flexlm, errno​:2(No such file or directory)
  3. IDL command line
    1. pros and cons of IDL command line and workbench
      1. CLI 和 GUI 的优缺点如下:
    2. IDL 批处理
      1. Batch processing with IDL
      2. mixed batch without window
    3. A list of other resource

Linux 系统 IDL88/ENVI56安装

安装ENVI/SARSCAPE

├── envi56
│   ├── envi56-linux.tar.gz
│   ├── ENVILicense_20210815.sav
│   └── install.sh
├── l_opencl_p_18.1.0.015
│   ├── install_GUI.sh
│   ├── install.sh
│   ├── license.txt
│   ├── pset
│   ├── PUBLIC_KEY.PUB
│   ├── rpm
│   └── silent.cfg
└── sar56
    ├── install.sh
    ├── SARscape
    ├── SARscape_5.6.tgz
    ├── SARscapeLicense_20210815.sav
    └── SARscape_linux_v560.tgz

安装 envi56

cd envi56
sudo ./install.sh 

# 一路 y 默认安装完毕

[option] libtinfo.so error when launching ENVI 5.6/IDL 8.8 on Linux

sudo apt install libtinfo5

$ sudo ln -s /usr/lib/x86_64-linux-gnu/libtinfo.so.6 /usr/local/harris/idl88/bin/bin.linux.x86_64/libtinfo.so.5

reference harris

安装 sarscape

sarscape 安装需要 opencl,这个比较麻烦后面单独说

sudo ./install.sh /usr/local /usr/local/harris/envi56

安装 opencl

OPENCL 分 INTEL 和 AMD 处理器,根据 sarscape 官网说明,需要分别安装,这里先说 INTEL 处理器的安装过程:

INTEL

因特尔的opencl sdk CPU和GPU是分开的,需要先安装基于CPU的SDK,再安装基于GPU的 sdk

1)安装一个clinfo的软件可以看到服务器上目前支持的OpenCL设备

sudo apt install clinfo

NVIDIA缺失的库安装,使得基于NVIDIA的cl设备能够正常使用

sudo apt install ocl-icd-libopencl1
sudo apt install opencl-headers

安装lsb-core,opencl sdk依赖于这个库

sudo apt install lsb-core

2) CPU opencl SDK安装参考官网手册:官网链接,下载链接: OpenCL SDK (已下载 ENVI56/LINUX/opencl_p_18.1.0.015.tar.gz )

进入到l_opencl_p_18.1.0.015目录下, 

sudo ./install_GUI.sh

测试

liupei@T470:~/Downloads/linuxENVI$ clinfo 
Number of platforms                               2
  Platform Name                                   Intel(R) CPU Runtime for OpenCL(TM) Applications
  Platform Vendor                                 Intel(R) Corporation
  Platform Version                                OpenCL 2.1 LINUX
  Platform Profile                                FULL_PROFILE

  Platform Name                                   NVIDIA CUDA
Number of devices                                 1
  Device Name                                     GeForce 940MX
  Device Vendor                                   NVIDIA Corporation

参考文献:Huo的藏经阁, Joey’s Note

2)GPU SDK安装

intel 的GPU opencl 是基于 Graphics Runtime,其相关安装文件在github中,Intel Graphics

目前用不是没有装,而且上一部后好像能找到 GPU platform

AMD

还没有装,好像很麻烦,因为 sarscape帮助文件所 几点几 之后就不开发了。。。

参考文献:1

激活

由于申请的试用版的,激活不是通过 license manager,而是通过 idl virtual machine

sudo /usr/local/harris/envi56/idl88/bin/bin.linux.x86_64/idl -vm

# 如果上面的打不开,经测试下面的也可以
sudo /usr/local/harris/envi56/idl88/bin/idl -vm

分别选择申请到的 ENVI license.sav 和 sarscape license.savi

linux 系统 IDL8.3/ENVI5.1 安装

安装程序

安装路径:手动输入刚刚建立的/usr/local/exelis目录

sudo mkdir /usr/local/exelis
sudo chmod 777 /usr/local/exelis/
tar zxvf idl83envi51linux.x86_64.tar.gz
sudo ./install.sh

选项都选y,除了让DICOM开机启动选择n。

破解

把两个库文件解压,如果rpm2cpio没有就先安装

sudo apt install rpm2cpio

rpm2cpio libidn11-1.34-lp152.3.6.x86_64.rpm | cpio -idmv
rpm2cpio libXp-1.0.3-2.fc29.x86_64.rpm | cpio -idmv

然后进入解压出来的目录usr/lib64,里面有4个文件libidn.so.11,libidn.so.11.6.8,libXp.so.6,libXp.so.6.2.0,全cp到程序目录中

sudo cp * /usr/local/exelis/idl83/bin/bin.linux.x86_64

运行ifconfig,查看网卡名,我的网卡是enp5s0,运行以下代码修改网卡mac

sudo ifconfig enp5s0 hw ether 08:9e:01:ba:03:4b

记得每次开机都要运行一次
运行hostname,查看自己电脑名

hostname

在上面license.dat中修改
SERVER hostname 089e01ba034b 1700
这一行中的hostname为自己电脑名,编辑完毕cp license.dat文件

sudo cp license.dat /usr/local/exelis/license/

运行程序

idl

破解等一键运行

startidl.sh

alias sidl='/usr/local/exelis/idl/startidl.sh'
liupei@T470:/usr/local/exelis/idl$ cat startidl.sh 
#!/usr/bin/bash
sudo ifconfig enp0s31f6 hw ether 08:9e:01:ba:03:4b
cd /usr/local/exelis/idl83/bin/
./lmgrd &
cd ~
idl
sudo ifconfig enp5s0 hw ether f0:2f:74:df:4f:30

可能出现的错误

提示未破解

就运行lmgrd

cd /usr/local/exelis/idl83/bin/
./lmgrd

如果提示,error: “lmgrd: not found”,安装lsb-core

sudo apt install lsb-core

Can’t make directory /usr/tmp/.flexlm, errno​:2(No such file or directory)

可以自行创建该文件夹

终端输入sudo mkdir ​/usr/tmp,创建tmp文件夹

终端输入​sudo mkdir ​/usr/tmp/.flexlm,创建.flexlm文件夹

参考文献:

  1. CSCD安装博客 here
  2. 官方帮助 here
  3. LINUX IDL 8.4安装

IDL command line

pros and cons of IDL command line and workbench

There are two primary ways of using IDL: the command line (CLI*) and the Workbench (WB). The CLI allows direct access to the IDL interpreter. The WB is a separate program that sits on top of IDL and provides a slew of organizing, editing and debugging tools for working with IDL.

两种使用 IDL 的主流方法:命令行 CLI 和 GUI。命令行可以直接访问 IDL 编译器,GUI 是架构在 IDL 之上提供一系列组织,编辑调试工具。

CLI 和 GUI 的优缺点如下:

CLI Pros:

  1. Lightweight. 轻量级
  2. Fast. The CLI provides direct access to the IDL interpreter. 速度快

CLI Cons:

  1. Limited shell-like support; e.g., no color syntaxing, command completion or keybinding definition. (However, see rIDL.)
  2. An external editor is needed to develop and debug code. (For many, this may not be a negative.)

WB Pros:

  1. Integrated editor with command completion, color syntaxing, code formatting and code templates.
  2. Projects for organizing files and controlling IDL’s path.
  3. A consistent interface across platforms supported by IDL (Windows, Mac OS X, Linux).

WB Cons:

  1. The WB is built on Eclipse, which is a big, complex Java application. As the size and complexity of an application grows, the likelihood of bugs grows, as well.
  2. the Outline view for jumping between programs in a file, and
  3. the Open Resource dialog for opening files.

参考文献

IDL 批处理

Batch processing with IDL

$ nohup nice $IDL_DIR/bin/idl < in.pro > out.txt 2> err.txt &

in.pro

print, 'Job started'
n = 100
task1, n
;task2
;task3
print, 'Job complete'

task1.pro

pro task1, n
   compile_opt idl2

   if n eq !null then n = 100

   x = findgen(n)
   p = plot(x, /buffer, title='Plot #000')
   p.save, 'plot000.png', resolution=96

   for i=1, n-1 do begin
      si = string(i, format='(i3.3)')
      p.title = 'Plot #' + si
      p.setdata, x + i
      p.save, 'plot' + si + '.png', resolution=96
   endfor

   p.close
end

参考文献论坛参考

mixed batch without window

$ idl <in.pro >out.txt 2>err.txt

in.pro

print, 'job started'
example_envi_batch_status_window
print, 'job complete'

example_envi_batch_status_window.pro

pro example_envi_batch_status_window

compile_opt IDL2

; First restore all the base save files.
envi, /restore_base_save_files

; Initialize ENVI and send all errors
; and warnings to the file batch.txt
envi_batch_init, log_file='batch.txt'

; Open the input file
envi_open_file, 'bhtmref.img', r_fid=fid

if (fid eq -1) then begin
   envi_batch_exit
   return
endif

; Get the dimensions and # bands
; for the input file.
envi_file_query, fid, dims=dims, nb=nb

; Set the pos to calculate
; statistics for all data (spectrally)
; in the file.
pos = lindgen(nb)

; Calculate the basic statistics and
; print the mean.

envi_batch_status_window, /off
envi_doit, 'envi_stats_doit', fid=fid, pos=pos, $
   dims=dims, comp_flag=1, mean=mean

print, 'Mean', mean

; Turn off the status window and do the same

envi_batch_status_window, /off

; Calculate the basic statistics and
; print the mean.
envi_doit, 'envi_stats_doit', fid=fid, pos=pos, $

   dims=dims, comp_flag=1, mean=mean

print, 'Mean', mean

;

; Exit ENVI

;

envi_batch_exit

end

参考文献Executive Commands

A list of other resource

  1. 剑桥大学 Vasily BelokurovIDL教程
  2. Developer of rIDL & IDLdocMichael Galloy
  3. Coyote’s guide to IDL