繁体   English   中英

使用 gitlab-ci.yml 管道测试 python 程序时出现问题

[英]Problem using MPI in a python program when testing it with a gitlab-ci.yml pipeline

我有一个 python 代码托管在 gitlab 中。 最近,我添加了使用 MPI 来处理并行运行。 我有一个由 gitlab CI 系统启动的测试套件。 但是,一旦尝试安装 mpi4py package,它就会失败。

我正在使用 python 3.7 映像。 .gitlab-ci.yml 文件是:

image: python:3.7

test:
  stage: test
  script:
    - pip install -r requirements.txt
    - python setup.py build
    - python setup.py install
    - pytest --junitxml=report.xml -v tests/short.py
  artifacts:
    when: always
    paths:
      - report.xml
    reports:
      junit: report.xml

当按照 requirements.txt 文件中的要求安装 mpi4py package 时,会发生故障,构建过程失败并显示以下消息:

 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.7m -c _configtest.c -o _configtest.o
      _configtest.c:2:10: fatal error: mpi.h: No such file or directory
          2 | #include <mpi.h>
            |          ^~~~~~~
      compilation terminated.
      failure.
      removing: _configtest.c _configtest.o
      error: Cannot compile MPI programs. Check your configuration!!!
      [end of output]

我想缺少 mpi C 库? 我应该如何安装它?

也许你想看看如何安装libmpich-devhttps://mpi4py.readthedocs.io/en/latest/install.html#linux )。

gcc 应该已经存在于您的容器中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM