---
title: 使用HPCRunner一键安装NCL
description: "待安装NCL应用的节点已挂载配置YUM源。YUM源挂载配置建议使用全量的ISO Everything包。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpcindapp/prtg-osc/topic_0000002465809142.html
sourcePath: /source/zh/kunpenghpcs/hpcindapp/prtg-osc/topic_0000002465809142.html
indexId: 4d17a2308b736da1e4880f8359bdb3b28984674441db091063f61cdc5d4c101469
---
# 使用HPCRunner一键安装NCL

#### 前置条件

待安装NCL应用的节点已挂载配置YUM源。YUM源挂载配置建议使用全量的ISO Everything包。


#### 安装步骤

1. 使用PuTTY工具，以root用户登录待安装NCL应用的节点。
2. 安装基础依赖包。执行如下命令：
  yum -y install git time zlib zlib-devel gcc gcc-c++ environment-modules python python3 python3-devel python3-libs python3-pip cmake make numactl numactl-devel numactl-libs rpmdevtools wget libtirpc libtirpc-devel unzip flex tar patch glibc-devel rpcbind csh perl-XML-LibXML xorg-x11-xauth curl curl-devel libcurl-devel libxml2-devel vim libXcomposite libXcursor libXi libXtst libXrandr alsa-lib mesa-libEGL libXdamage mesa-libGL libXScrnSaver

3. 克隆仓库。如已通过手动下载了贾维斯智能助手（HPCRunner），则忽略该步骤，否则执行如下命令：
  git clone https://gitcode.com/openeuler/hpcrunner.git

  回显结果包含如下示例内容，表示HPCRunner克隆成功：

```
Cloning into 'hpcrunner'...
remote: Enumerating objects: 13018, done.
remote: Counting objects: 100% (171/171), done.
remote: Compressing objects: 100% (142/142), done.
remote: Total 13018 (delta 89), reused 57 (delta 23), pack-reused 12847 (from 1)
Receiving objects: 100% (13018/13018), 72.71 MiB | 2.57 MiB/s, done.
Resolving deltas: 100% (6150/6150), done.
```


4. 初始化HPCRunner。执行如下命令：
  cd hpcrunner

  source init.sh

  hpcrunner表示HPCRunner安装目录。可根据实际情况调整。

5. 选择配置文件，执行如下命令：
  ./jarvis -use templates/ncl/6.6.2/data.ncl-gcc.hpckit25.2.0.arm.cpu.config

6. 下载NCL应用源码，执行如下命令：
  ./jarvis -d

7. 一键配置依赖环境。执行如下命令：
  ./jarvis -dp

  回显结果包含如下示例内容，表示一键配置依赖环境成功：

```
SUCCESSFULLY EXECUTED AT 2025-10-13 08:51:01, CONGRATULATIONS!!!
```


8. 一键进行编译。执行如下命令：
  ./jarvis -b

  回显结果包含如下示例内容，表示一键编译成功：

```
SUCCESSFULLY EXECUTED AT 2025-10-13 08:51:31, CONGRATULATIONS!!!
```


#### 运行和验证

1. 执行下列命令开启X11功能

```
vim /etc/ssh/sshd_config
修改
X11-Forwarding yes
安装
yum -y install xorg-x11-xauth xorg-x11-server-utils xorg-x11-server-Xnest libXtst
执行
systemctl restart sshd
```


2. 开新窗口进入hpcrunner目录执行下列命令

```
source init.sh
source env.sh
./jarvis -install package/cdo/2.5.3 gcc+mpi
./jarvis -install package/esmf/8.7.0 gcc+mpi
export CC=gcc CXX=g++ FC=gfortran
./jarvis -install package/ImageMagick/7.1.0 gcc
module load ImageMagick/7.1.0 esmf/8.7.0 cdo/2.5.3
```


3. 进入算例目录

```
cd software/utils/ncl/6.6.2/gcc/lib/ncarg/nclex/nug
```


4. 创建测试脚本

```
vim test.sh
```

```
#!/bin/bash
wget http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/Data/CNTASN_1m_200103_grid_T_curvilinear_grid.nc
wget http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/Data/rectilinear_grid_2D.nc
wget http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/Data/T2M_ERAINT_rectilinear_grid_2D.nc
wget http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/Data/r2b4_amip.nc
wget http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/Data/tas_mon_1961-1990_rectilinear_grid_2D.nc
wget http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/Data/MITgcm_rectilinear_grid_3D.nc
wget http://www.ncl.ucar.edu/Images/NCLLogoWeb.jpg
wget http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/Data/thetao_curvilinear_ocean.nc
wget http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/Data/tripolar_grid_STORM.nc[d(2]
cat > ex01.f << EOF
C NCLFORTSTART
subroutine cquad (a, b, c, nq, x, quad)
real x(nq), quad(nq)
C NCLEND
C
C  Calculate quadratic polynomial values.
C
do 10 i=1,nq
quad(i) = a*x(i)**2 + b*x(i) + c
10 continue
return
end
C NCLFORTSTART
function arcln (numpnt, pointx, pointy)
dimension pointx(numpnt),pointy(numpnt)
C NCLEND
C
C  Calculate arc lengths.
C
if (numpnt .lt. 2) then
print *, 'arcln: number of points must be at least 2'
stop
endif
arcln = 0.
do 10 i=2,numpnt
pdist = sqrt((pointx(i)-pointx(i-1))**2 +
+                        (pointy(i)-pointy(i-1))**2)
arcln = arcln + pdist
10 continue
return
end
EOF
WRAPIT ex01.f
for file in *.ncl;do
if [ -e "$file" ];then
echo "============test $file=============="
ncl $file
fi
done
```


5. 执行测试脚本

```
bash ./test.sh
```


  测试回显：

  由于http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation(http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation)网站和http://www.gadm.org/country(http://www.gadm.org/country)网站已失效，所以需要该网站数据的部分算例无法测试。如NUG_regrid_unstructured_to_rectilinear_bilinear_wgts_ESMF.ncl和NUG_regrid_unstructured_to_rectilinear_bilinear_wgts_destgrid_ESMF.ncl


6. 执行以下命令进入另一个测试目录

```
cd ../gsun
```


7. 创建测试脚本

```
vim test.sh
```

```
cp $NCARG_ROOT/share/ncarg/data/asc/u.cocos ./
for file in gsun*n.ncl
do
ncl $file
done
```


8. 执行测试脚本

```
bash ./test.sh
```


  测试显示X11弹窗，点击画面关闭
