Skip to content

Commit 95a6e58

Browse files
committed
fix Github action
1 parent 8578767 commit 95a6e58

File tree

8 files changed

+74
-36
lines changed

8 files changed

+74
-36
lines changed

.github/workflows/CI.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: CI
33
on:
44
push:
55
branches:
6-
- master
6+
- cyfan
77
pull_request:
88
branches:
9-
- master
9+
- cyfan
1010

1111
permissions:
1212
contents: write
@@ -43,7 +43,7 @@ jobs:
4343
4444
- name: Run tests
4545
run: |
46-
export PYTHONPATH=src
46+
export PYTHONPATH=MCintegration
4747
pytest --cov --cov-report=xml
4848
4949
- name: Upload coverage to Codecov
@@ -68,8 +68,8 @@ jobs:
6868
- name: Build documentation
6969
run: |
7070
cd docs
71-
sphinx-apidoc -o source ../src ../src/*_test.py
72-
python ../clean_src_rst.py
71+
sphinx-apidoc -o source ../MCintegration ../MCintegration/*_test.py
72+
python ../clean_MCintegration_rst.py
7373
make html
7474
python ../clean_html_sidebar.py
7575

MCintegration/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def summary(self, weighted=None):
148148
Args:
149149
weighted (bool): Display weighted averages of results from different
150150
iterations if ``True``; otherwise show unweighted averages.
151-
Default behavior is determined by |vegas|.
151+
Default behavior is determined by vegas.
152152
"""
153153
if weighted is None:
154154
weighted = self.weighted

clean_MCintegration_rst.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import re
2+
3+
def remove_prefix_and_horizontal_lines(filename):
4+
with open(filename, 'r') as file:
5+
lines = file.readlines()
6+
7+
cleaned_lines = []
8+
9+
for i, line in enumerate(lines):
10+
if re.match(r"^[A-Za-z0-9._ ]+ module", line.strip()) and 'MCintegration.' in line:
11+
cleaned_lines.append(line.replace('MCintegration.', '').strip() + '\n')
12+
elif line.strip().startswith('.. automodule::'):
13+
cleaned_lines.append(line)
14+
else:
15+
cleaned_lines.append(line)
16+
17+
with open(filename, 'w') as file:
18+
file.writelines(cleaned_lines)
19+
20+
remove_prefix_and_horizontal_lines('./source/MCintegration.rst')

clean_html_sidebar.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,13 @@ def remove_class_prefix_from_sidebar(html_file):
66

77
soup = BeautifulSoup(content, 'html.parser')
88

9-
# 找 class="sphinxsidebarwrapper" 侧边栏
109
sidebar = soup.find('div', class_='sphinxsidebarwrapper')
1110

1211
if sidebar:
13-
# 找 class="pre" 的 span 标签
1412
for span in sidebar.find_all('span', class_='pre'):
1513
text = span.get_text()
16-
# 删除 '.' 之前的内容
1714
if '.' in text:
1815
method_name = text.split('.')[1]
19-
# 更新 <a> 标签,保证跳转有效
2016
for a_tag in sidebar.find_all('a', class_='reference internal'):
2117
if text in a_tag.get_text():
2218
href = a_tag['href']
@@ -36,5 +32,5 @@ def remove_class_prefix_from_sidebar(html_file):
3632
else:
3733
print("No sidebar found in the HTML.")
3834

39-
input_html = './build/html/src.html'
35+
input_html = './build/html/MCintegration.html'
4036
remove_class_prefix_from_sidebar(input_html)

clean_src_rst.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/source/conf.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import os
99
import sys
1010

11-
sys.path.insert(0, os.path.abspath('../../src'))
11+
sys.path.insert(0, os.path.abspath('../..'))
1212

1313
project = 'MCintegration'
1414
copyright = '2024, Authors'
@@ -25,11 +25,6 @@
2525
'sphinx.ext.autosummary'
2626
]
2727

28-
templates_path = ['_templates']
29-
exclude_patterns = []
30-
31-
32-
3328
# -- Options for HTML output -------------------------------------------------
3429
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
3530

@@ -56,7 +51,5 @@
5651
napoleon_use_param = True
5752
napoleon_use_rtype = True
5853

59-
html_theme = 'sphinxdoc'
60-
html_theme = 'nature'
6154
html_theme = 'pyramid'
6255
html_static_path = ['_static']

docs/source/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
contain the root `toctree` directive.
55
66
MCintegration documentation
7-
===============
8-
7+
===========================
98

109
Contents:
1110

1211
.. toctree::
1312
:maxdepth: 2
14-
:caption: Contents:
13+
14+
test_result.rst
1515

1616
Indices and tables
1717
==================

docs/source/test_result.rst

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Table of test results
2+
=======================================
3+
4+
Multigpu Test
5+
---------------------------------------
6+
7+
eval = 400000
8+
9+
+---------------------------+---------------+-----------------+-----------------+
10+
| Configuration | Integration | eval*16/ngpu | eval*64/ngpu |
11+
+===========================+===============+=================+=================+
12+
| | mc | 3.14100 (64) | 3.14156 (32) |
13+
| | | | |
14+
| | | 20.02ms | 79.87ms |
15+
| 1DCU (1node, 8cpu cores) +---------------+-----------------+-----------------+
16+
| | mcmc | 3.14152 (65) | 3.14090 (33) |
17+
| | | | |
18+
| | | 58.57ms | 234ms |
19+
+---------------------------+---------------+-----------------+-----------------+
20+
| | mc | 3.14137 (65) | 3.14123 (33) |
21+
| | | | |
22+
| | | 11.33ms | 42.22ms |
23+
| 2DCU (1node, 16cpu cores) +---------------+-----------------+-----------------+
24+
| | mcmc | 3.14129 (65) | 3.14157 (32) |
25+
| | | | |
26+
| | | 32.18ms | 123ms |
27+
+---------------------------+---------------+-----------------+-----------------+
28+
| | mc | 3.14182 (65) | 3.14173 (32) |
29+
| | | | |
30+
| | | 6.08ms | 22.32ms |
31+
| 4DCU (1node, 32cpu cores) +---------------+-----------------+-----------------+
32+
| | mcmc | 3.14260 (65) | 3.14175 (33) |
33+
| | | | |
34+
| | | 17.34ms | 64.69ms |
35+
+---------------------------+---------------+-----------------+-----------------+
36+
| | mc | 3.14049 (65) | 3.14150 (32) |
37+
| | | | |
38+
| | | 3.73ms | 11.55ms |
39+
| 8DCU (2node, 64cpu cores) +---------------+-----------------+-----------------+
40+
| | mcmc | 3.14313 (65) | 3.14149 (33) |
41+
| | | | |
42+
| | | 10.47ms | 32.39ms |
43+
+---------------------------+---------------+-----------------+-----------------+

0 commit comments

Comments
 (0)