HPL 源码结构分析

news2024/9/20 20:35:02

文件夹结构:

$ cd /home/hipper/ex_hpl_hpcg/

$ pwd

$ mkdir ./openmpi

$mkdir ./openblas

$mkdir ./hpl

$ tree

1. 安装openmpi

1.1.1 使用Makefile下载配置编译安装 openmpi

Makefile:

all:
        wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.6.tar.gz && \
        tar zxf openmpi-4.1.6.tar.gz && \
        cd openmpi-4.1.6/ && \
        ./configure --enable-mpi-cxx --with-cuda --prefix=${PWD}/local/ 2>&1 | tee config.out && \
        make -j all 2>&1 | tee make.out

install:
        make -C openmpi-4.1.6/ install 2>&1 | tee install.out

.PHONY: clean
clean:
        -rm -rf ./openmpi-4.1.6/ ./openmpi-4.1.6.tar.gz
$ make
$ make install

$ ls

1.1.2 注意事项

如果 是 openmpi 5.0及其以上,则./configure 时不能要选项:

--enable-mpi-cxx

mpi 以后仅支持使用相对广泛很多的 C 语言风格的 API,不再支持 C++ 风格的使用方式,虽然有在用,但很不主流,C 风格 api 足够强大,足够使用。

无论4.x还是5.x,如果没有安装cuda,则 ./configure 时不需要该项:

--with-cuda

而,指定安装目录时需要指定绝对路径,例如:

--prefix=${PWD}/local/

或者不使用 Makefile 方式,而使用命令行安装 openmpi:

$ wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.6.tar.g
$ tar zxf openmpi-4.1.6.tar.gz
$ cd openmpi-4.1.6/

其中 configure 选项 --prefix=/.../ 需要使用绝对路径,例如:
$ ./configure --enable-mpi-cxx --with-cuda --prefix=/home/hipper/ex_hpl/openmpi/local/ 2>&1 | tee config.out
$ make -j all 2>&1 | tee make.out
$ make install 2>&1 | tee install.out

1.1.3 配置环境变量

 export PATH=/home/hipper/ex_openmpi/local/bin:$PATH
 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/hipper/ex_openmpi/local/lib
 
 cd examples
 make
 mpirun -np 7 hello_c

2. 安装 openblas

 
all:
	wget https://github.com/OpenMathLib/OpenBLAS/archive/refs/tags/v0.3.27.tar.gz
	tar zxf v0.3.27.tar.gz 
	make -C OpenBLAS-0.3.27 FC=gfortran -j
 
install:
	make -C OpenBLAS-0.3.27 install PREFIX=../local/
#PREFIX=/opt/OpenBLAS
# PREFIX=../local/
 
clean:
	-rm -rf ./local/ ./OpenBLAS-0.3.27/ ./v0.3.27.tar.gz

$ make
$ make install
$ ls

3. 配置编译运行 hpl

1.3.1 下载 hpl 源代码

$ wget https://www.netlib.org/benchmark/hpl/hpl-2.3.tar.gz
$ tar zxf hpl-2.3.tar.gz
$ cd hpl-2.3/

1.3.2 配置

$ cd hpl-2.3/
$ hpl-2.3$ cp ./setup/Make.Linux_PII_CBLAS ./

vim ./Make.Linux_PII_CBLAS

# ######################################################################
#
# ----------------------------------------------------------------------
# - shell --------------------------------------------------------------
# ----------------------------------------------------------------------
#
SHELL        = /bin/sh
#
CD           = cd
CP           = cp
LN_S         = ln -s
MKDIR        = mkdir
RM           = /bin/rm -f
TOUCH        = touch
#
# ----------------------------------------------------------------------
# - Platform identifier ------------------------------------------------
# ----------------------------------------------------------------------
#
ARCH         = Linux_PII_CBLAS
#
# ----------------------------------------------------------------------
# - HPL Directory Structure / HPL library ------------------------------
# ----------------------------------------------------------------------
#
#/home/hipper/ex_hpl_hpcg/hpl/hpl-2.3
TOPdir       = $(HOME)/ex_hpl_hpcg/hpl/hpl-2.3
INCdir       = $(TOPdir)/include
BINdir       = $(TOPdir)/bin/$(ARCH)
LIBdir       = $(TOPdir)/lib/$(ARCH)
#
HPLlib       = $(LIBdir)/libhpl.a
#
# ----------------------------------------------------------------------
# - Message Passing library (MPI) --------------------------------------
# ----------------------------------------------------------------------
# MPinc tells the  C  compiler where to find the Message Passing library
# header files,  MPlib  is defined  to be the name of  the library to be
# used. The variable MPdir is only used for defining MPinc and MPlib.
#
#MPdir        = /usr/local/mpi
MPdir        = $(HOME)/ex_hpl_hpcg/openmpi/local
MPinc        = -I$(MPdir)/include
MPlib        = $(MPdir)/lib/libmpi.so
#
# ----------------------------------------------------------------------
# - Linear Algebra library (BLAS or VSIPL) -----------------------------
# ----------------------------------------------------------------------
# LAinc tells the  C  compiler where to find the Linear Algebra  library
# header files,  LAlib  is defined  to be the name of  the library to be
# used. The variable LAdir is only used for defining LAinc and LAlib.
#
#LAdir        = $(HOME)/netlib/ARCHIVES/Linux_PII
LAdir        = $(HOME)/ex_hpl_hpcg/openblas/local
LAinc        =
LAlib        = $(LAdir)/lib/libopenblas.a
#
# ----------------------------------------------------------------------
# - F77 / C interface --------------------------------------------------
# ----------------------------------------------------------------------
# You can skip this section  if and only if  you are not planning to use
# a  BLAS  library featuring a Fortran 77 interface.  Otherwise,  it  is
# necessary  to  fill out the  F2CDEFS  variable  with  the  appropriate
# options.  **One and only one**  option should be chosen in **each** of
# the 3 following categories:
#
# 1) name space (How C calls a Fortran 77 routine)
#
# -DAdd_              : all lower case and a suffixed underscore  (Suns,
#                       Intel, ...),                           [default]
# -DNoChange          : all lower case (IBM RS6000),
# -DUpCase            : all upper case (Cray),
# -DAdd__             : the FORTRAN compiler in use is f2c.
#
# 2) C and Fortran 77 integer mapping
#
# -DF77_INTEGER=int   : Fortran 77 INTEGER is a C int,         [default]
# -DF77_INTEGER=long  : Fortran 77 INTEGER is a C long,
# -DF77_INTEGER=short : Fortran 77 INTEGER is a C short.
#
# 3) Fortran 77 string handling
#
# -DStringSunStyle    : The string address is passed at the string loca-
#                       tion on the stack, and the string length is then
#                       passed as  an  F77_INTEGER  after  all  explicit
#                       stack arguments,                       [default]
# -DStringStructPtr   : The address  of  a  structure  is  passed  by  a
#                       Fortran 77  string,  and the structure is of the
#                       form: struct {char *cp; F77_INTEGER len;},
# -DStringStructVal   : A structure is passed by value for each  Fortran
#                       77 string,  and  the  structure is  of the form:
#                       struct {char *cp; F77_INTEGER len;},
# -DStringCrayStyle   : Special option for  Cray  machines,  which  uses
#                       Cray  fcd  (fortran  character  descriptor)  for
#                       interoperation.
#
F2CDEFS      =
#
# ----------------------------------------------------------------------
# - HPL includes / libraries / specifics -------------------------------
# ----------------------------------------------------------------------
#
HPL_INCLUDES = -I$(INCdir) -I$(INCdir)/$(ARCH) $(LAinc) $(MPinc) -lpthread
HPL_LIBS     = $(HPLlib) $(LAlib) $(MPlib) -lpthread
#
# - Compile time options -----------------------------------------------
#
# -DHPL_COPY_L           force the copy of the panel L before bcast;
# -DHPL_CALL_CBLAS       call the cblas interface;
# -DHPL_CALL_VSIPL       call the vsip  library;
# -DHPL_DETAILED_TIMING  enable detailed timers;
#
# By default HPL will:
#    *) not copy L before broadcast,
#    *) call the BLAS Fortran 77 interface,
#    *) not display detailed timing information.
#
HPL_OPTS     = -DHPL_CALL_CBLAS
#
# ----------------------------------------------------------------------
#
HPL_DEFS     = $(F2CDEFS) $(HPL_OPTS) $(HPL_INCLUDES)
#
# ----------------------------------------------------------------------
# - Compilers / linkers - Optimization flags ---------------------------
# ----------------------------------------------------------------------
#
CC           = $(HOME)/ex_hpl_hpcg/openmpi/local/bin/mpicc
CCNOOPT      = $(HPL_DEFS)
CCFLAGS      = $(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops
#
# On some platforms,  it is necessary  to use the Fortran linker to find
# the Fortran internals used in the BLAS library.
#
LINKER       = $(HOME)/ex_hpl_hpcg/openmpi/local/bin/mpif77
LINKFLAGS    = $(CCFLAGS)
#
ARCHIVER     = ar
ARFLAGS      = r
RANLIB       = echo
#
# ----------------------------------------------------------------------

前后区别:

$ diff Make.Linux_PII_CBLAS setup/Make.Linux_PII_CBLAS 

hipper@hipper-G21:~/ex_hpl_hpcg/hpl/hpl-2.3$ diff Make.Linux_PII_CBLAS setup/Make.Linux_PII_CBLAS
70,71c70
< #/home/hipper/ex_hpl_hpcg/hpl/hpl-2.3
< TOPdir       = $(HOME)/ex_hpl_hpcg/hpl/hpl-2.3
---
> TOPdir       = $(HOME)/hpl
85,86c84
< #MPdir        = /usr/local/mpi
< MPdir        = /home/hipper/ex_hpl_hpcg/openmpi/local
---
> MPdir        = /usr/local/mpi
88c86
< MPlib        = $(MPdir)/lib/libmpi.so
---
> MPlib        = $(MPdir)/lib/libmpich.a
97,98c95
< #LAdir        = $(HOME)/netlib/ARCHIVES/Linux_PII
< LAdir        = $(HOME)/ex_hpl_hpcg/openblas/local
---
> LAdir        = $(HOME)/netlib/ARCHIVES/Linux_PII
100c97
< LAlib        = $(LAdir)/lib/libopenblas.a
---
> LAlib        = $(LAdir)/libcblas.a $(LAdir)/libatlas.a
147,148c144,145
< HPL_INCLUDES = -I$(INCdir) -I$(INCdir)/$(ARCH) $(LAinc) $(MPinc) -lpthread
< HPL_LIBS     = $(HPLlib) $(LAlib) $(MPlib) -lpthread
---
> HPL_INCLUDES = -I$(INCdir) -I$(INCdir)/$(ARCH) $(LAinc) $(MPinc)
> HPL_LIBS     = $(HPLlib) $(LAlib) $(MPlib)
172c169
< CC           = $(HOME)/ex_hpl_hpcg/openmpi/local/bin/mpicc
---
> CC           = /usr/bin/gcc
179c176
< LINKER       = $(HOME)/ex_hpl_hpcg/openmpi/local/bin/mpif77
---
> LINKER       = /usr/bin/g77
hipper@hipper-G21:~/ex_hpl_hpcg/hpl/hpl-2.3$

1.3.3编译运行

make arch=Linux_PII_CBLAS

$ ls

单节点运行:

$ /home/hipper/ex_hpl_hpcg/openmpi/local/bin/mpirun -np 4 ./xhpl > HPL-Benchmark.txt
效果:
多节点:
mpirun -np 8 --host node1,node2 ./xhpl > HPL-Benchmark.txt

https://www.advancedclustering.com/act_kb/tune-hpl-dat-file
mpirun 的参数 np 值需要跟 HPL.dat 的 (P x Q) 相等。

2,hpl 源码框架分析

先保存备忘,待续。。。。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2123783.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

java spring定时任务-动态任务

cron表达式 在线生成https://cron.qqe2.com/ 6个时间刻度的话 * * * * * * 分别对应 秒 分 时 日 月 星期 &#xff1b; 7个时间刻度的话 * * * * * * * 分别对应 秒 分 时 日 月 星期 年&#xff1b;每隔5秒执行一次&#xff1a;*/5 * * * * ? 每隔1分钟执行一次&#xff1a…

AI如何辅助未来数学研究:陶哲轩的最新见解与应用展望

随着人工智能&#xff08;AI&#xff09;技术的飞速发展&#xff0c;AI在多个领域的应用已经渗透到了我们生活的方方面面。然而&#xff0c;在严谨且逻辑性极强的数学研究领域&#xff0c;AI能否真正发挥作用&#xff1f;2024年&#xff0c;著名数学家、菲尔兹奖得主陶哲轩在IM…

【Nacos】配置中心

Nacos除了注册中心和负载均衡之外&#xff0c;还是一个配置中心&#xff0c;具备配置管理的功能。 Nacos 配置中心是一种用于集中式管理应用程序配置的服务&#xff0c;它可以将应用程序的配置从代码和本地配置文件中分离出来&#xff0c;实现配置的集中管理和动态更新。通过 …

刘润《关键跃升》读书笔记7

沟通&#xff1a; 想明⽩&#xff0c;说清楚&#xff0c;能接受 团队沟通的正确⽅式可以⽤9个字来概括&#xff1a;想明⽩&#xff0c;说清楚&#xff0c;能接受 &#xff08;⻅图4-1&#xff09;想明⽩ 有时经理跟⼈沟通&#xff0c;讲完之后却⽆奈地对员⼯说&#xff0c;你怎…

远程访问电脑共享文件

远程访问电脑共享文件&#xff0c;可以通过多种方法实现&#xff0c;每种方法都有其特点和适用场景。以下是一些常见的方法及其步骤&#xff1a; 一、使用Microsoft远程桌面 启用远程桌面&#xff1a; 在目标电脑上&#xff0c;打开“开始”菜单&#xff0c;选择“设置”>“…

常见概念 -- WDM/OTN 时延

什么是时延&#xff1f; 在通信网络中&#xff0c;时延指原始数据经一台转发设备的编码等一系列处理过程后由发送端发送&#xff0c;通过传输链路传输&#xff0c;到达另一台&#xff08;目的地&#xff09;设备的接收端并解码还原为原始数据所花费的时间。网络时延主要由以下几…

多维时序 | Matlab基于TCN-Transformer+LSTM双输入神经网络时间序列预测

多维时序 | Matlab基于TCN-TransformerLSTM双输入神经网络时间序列预测 目录 多维时序 | Matlab基于TCN-TransformerLSTM双输入神经网络时间序列预测效果一览基本介绍程序设计参考资料 效果一览 基本介绍 1.Matlab基于TCN-TransformerLSTM双输入神经网络时间序列预测&#xff…

基于SpringBoot的校园自助洗衣服务管理系统

作者&#xff1a;计算机学姐 开发技术&#xff1a;SpringBoot、SSM、Vue、MySQL、JSP、ElementUI等&#xff0c;“文末源码”。 专栏推荐&#xff1a;前后端分离项目源码、SpringBoot项目源码、SSM项目源码 系统展示 【2025最新】基于JavaSpringBootVueMySQL的校园自助洗衣服务…

SAP Fiori-Vscode 环境搭建中npm报错

文章目录 前提&#xff1a; vscode 安装好了&#xff0c;node 配置完毕&#xff0c;npm环境搭建OK新建一个Fiori 初始化初始化性项目的报错&警告Q1: npm WARN config global --global, --local are deprecated. Use --locationglobal insteadQ2: npm打包出现警告&#xff0…

GPU池化赋能智能制造

2023年3月10日&#xff0c;“第六届智能工厂高峰论坛”在杭州隆重揭幕。本次会议由e-works数字化企业网、浙江制信科技有限公司主办&#xff0c;中国人工智能学会智能制造专业委员会、长三角新能源汽车产业链联盟、长三角(杭州)制造业数字化能力中心、浙江省智能工厂操作系统技…

基于微信小程序的宠物之家的设计与实现

作者&#xff1a;计算机学姐 开发技术&#xff1a;SpringBoot、SSM、Vue、MySQL、JSP、ElementUI等&#xff0c;“文末源码”。 专栏推荐&#xff1a;前后端分离项目源码、SpringBoot项目源码、SSM项目源码 系统展示 基于微信小程序JavaSpringBootVueMySQL的宠物之家/宠物综合…

Redis复习笔记整理(2w+)

目录 1、Redis简介 1.1 补充数据类型Stream 1.2 Redis底层数据结构 1.3 Redis为什么快 1.4 持久化机制* 1.4.1 RDB持久化 bgsave执行流程 如何保证数据一致性 快照操作期间服务崩溃 RDB优缺点 1.4.2 AOF持久化 为什么采用写后日志 如何实现AOF 什么是AOF重写 AO…

vue项目中引入组件时出现的Module is not installed问题

在Vue项目中&#xff0c;如果遇到了如图“Module is not installed”这样的错误&#xff0c;通常这 个错误并不是直接由Vue或Vue CLI本身抛出的&#xff0c;而是可能因为几个不同的原因导致的。 这个错误可能是在你尝试引入一个模块或组件时&#xff0c;该模块或组件并没有被正…

java基础 | 动态代理

动态代理 简而言之就是&#xff1a;首先创建一套动态代理的规则&#xff0c;创建好自己的接口&#xff0c;和实现类&#xff0c;在调用时直接调用&#xff08;缺少什么参数&#xff0c;补充哪个参数&#xff01;&#xff09; 实现步骤&#xff1a; 设计动态代理的规则&#x…

Windows系统下编译C++源码并调用

现在很多的C库都以源码的形式在github网站开源&#xff0c;如果要使用&#xff0c;可以直接下载到本地&#xff0c;添加到工程中调用。也可以将源码编译为动态或静态库文件&#xff0c;然后将库文件添加到工程中。 在这里我们将GoogleTest源码编译&#xff0c;然后加到工程中。…

OpenGL(三)着色器语言GLSL

着色器语言 在GPU上运行的图形渲染语言&#xff0c;类C风格。 类似于CUDA&#xff0c;但是又没有CUDA通用&#xff0c;又有点像Verilog这种硬件描述语言 GLSL是一种着色器语言&#xff0c;需要有对应的图形API环境配合&#xff0c;可以使用OpenGL&#xff0c;也可以使用OpenGL…

Proteus仿真综合实例(1)

分享一些基于Proteus的仿真实例&#xff0c;供大家学习参考。 1、51单片机230个Proteus仿真实例 包含基于51单片机的230个仿真实例&#xff0c;涉及定时器、中断、LCD显示、DS18B20温度测量、DS1621温度测量、PWM生成等充足电路模型案例。 2、51交通灯 模拟实现基于51单片机…

音视频入门基础:AAC专题(2)——使用FFmpeg命令生成AAC裸流文件

在文章《音视频入门基础&#xff1a;PCM专题&#xff08;1&#xff09;——使用FFmpeg命令生成PCM音频文件并播放》中讲述了生成PCM文件的方法。通过FFmpeg命令可以把该PCM文件转为AAC裸流文件&#xff1a; ./ffmpeg -f s16le -ar 44100 -ac 2 -i audio1.pcm audio1.aac 由于…

《论层次架构及其在软件系统中的应用》写作框架,软考高级系统架构设计师

论文真题 层次架构作为软件系统设计的一种基本模式&#xff0c;对于实现系统的模块化、可维护性和可扩展性具有至关重要的作用。在软件系统的构建过程中&#xff0c;采用层次架构不仅可以使系统结构更加清晰&#xff0c;还有助于提高开发效率和质量。因此&#xff0c;对层次架…

【笔记】2.2 黏土类原料

黏土类原料&#xff0c;用于制备陶瓷、耐火材料和水泥&#xff0c;为制品成型提供必须的可塑性&#xff0c;悬浮性。 2.2.1 黏土的成因和分类 黏土主要成分&#xff1a;含水硅铝酸盐 黏土形成&#xff1a;硅铝酸盐岩石经过长期地质时代的自然风化或热液蚀变作用而逐步形成。…