Skip to content

Commit

Permalink
Merge pull request #58 from issp-center-dev/fix_57
Browse files Browse the repository at this point in the history
fix #57
  • Loading branch information
yomichi authored Mar 13, 2024
2 parents d99a9b2 + 390c51c commit ace0e6f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 20 deletions.
5 changes: 3 additions & 2 deletions doc/en/source/algorithm/mapper_mpi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ Mesh definition file
^^^^^^^^^^^^^^^^^^^^^^^^^^

Define the grid space to be explored in this file.
The first column is the index of the mesh, and the second and subsequent columns are the values of variables defined in ``string_list`` in the ``[solver.param]`` section.
1 + ``dimension`` columns are required.
The first column is the index of the mesh, and the second and subsequent columns are the values of parameter.

Below, a sample file is shown.
A sample file for two dimensions is shown below.

.. code-block::
Expand Down
7 changes: 4 additions & 3 deletions doc/ja/source/algorithm/mapper_mpi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ MPI 並列を行う場合は、 `mpi4py <https://mpi4py.readthedocs.io/en/stable
^^^^^^^^^^^^^^^^^^^^^^^^^^

本ファイルで探索するグリッド空間を定義します。
1 + ``dimension`` 列のテキストファイルで、
1列目にメッシュのインデックス、
2列目以降は ``[solver.param]`` セクションにある、
``string_list`` で定義された変数に入る値が入ります
2列目以降は探索パラメータ :math:`x` に対応する値を記載します。
また、 ``#`` から始まる行はコメントとして無視されます

以下、サンプルを記載します
以下、2次元パラメータ空間探索のサンプルを記載します

.. code-block::
Expand Down
2 changes: 2 additions & 0 deletions src/py2dmat/algorithm/_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ def _meshgrid(
data = np.loadtxt(
mesh_path, comments=comments, delimiter=delimiter, skiprows=skiprows,
)
if data.ndim == 1:
data = data.reshape(1, -1)
grid = data
else:
if "min_list" not in info_param:
Expand Down
33 changes: 18 additions & 15 deletions src/py2dmat/algorithm/mapper_mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,25 @@ def _run(self) -> None:

print("mesh after:", mesh)

fx_order = np.argsort(fx_list)
minimum_point = []
print("mesh_list[fx_order[0]]:")
print(self.mesh_list[fx_order[0]])
for index in range(1, dimension + 1):
minimum_point.append(self.mesh_list[fx_order[0]][index])
if iterations > 0:
fx_order = np.argsort(fx_list)
minimum_point = []
print("mesh_list[fx_order[0]]:")
print(self.mesh_list[fx_order[0]])
for index in range(1, dimension + 1):
minimum_point.append(self.mesh_list[fx_order[0]][index])

time_sta = time.perf_counter()
file_CM.write("#Minimum point :")
for value in minimum_point:
file_CM.write(" {:8f}".format(value))
file_CM.write("\n")
file_CM.write("#R-factor : {:8f}\n".format(fx_list[fx_order[0]]))
file_CM.write("#see Log{}\n".format(round(self.mesh_list[fx_order[0]][0])))
time_end = time.perf_counter()
self.timer["run"]["file_CM"] += time_end - time_sta
time_sta = time.perf_counter()
file_CM.write("#Minimum point :")
for value in minimum_point:
file_CM.write(" {:8f}".format(value))
file_CM.write("\n")
file_CM.write("#R-factor : {:8f}\n".format(fx_list[fx_order[0]]))
file_CM.write("#see Log{}\n".format(round(self.mesh_list[fx_order[0]][0])))
time_end = time.perf_counter()
self.timer["run"]["file_CM"] += time_end - time_sta
else:
file_CM.write("# No mesh point\n")

print(
"complete main process : rank {:08d}/{:08d}".format(
Expand Down

0 comments on commit ace0e6f

Please sign in to comment.