Skip to content

Commit

Permalink
Merge pull request #40 from issp-center-dev/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
k-yoshimi authored Jul 1, 2024
2 parents 21ab402 + a32216c commit ab32f48
Show file tree
Hide file tree
Showing 1,059 changed files with 242,558 additions and 26 deletions.
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(StdFace C)

option(UHF "Build uhf_dry.out" ON)
option(UHF "Build uhf_dry.out" OFF)
MESSAGE(STATUS "Build uhf_dry.out - ${UHF}")

option(MVMC "Build mvmc_dry.out" ON)
option(MVMC "Build mvmc_dry.out" OFF)
MESSAGE(STATUS "Build mvmc_dry.out - ${MVMC}")

option(HPHI "Build hphi_dry.out" ON)
option(HPHI "Build hphi_dry.out" OFF)
MESSAGE(STATUS "Build hphi_dry.out - ${HPHI}")

option(HWAVE "Build hwave_dry.out" ON)
option(HWAVE "Build hwave_dry.out" OFF)
MESSAGE(STATUS "Build hwave_dry.out - ${HWAVE}")

add_subdirectory(src)
install(DIRECTORY samples DESTINATION share/stdface)

enable_testing()
add_subdirectory(test)
54 changes: 40 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# StdFace

An input files generator for
An input file generator for
[HPhi](https://github.com/issp-center-dev/HPhi),
[mVMC](https://github.com/issp-center-dev/mVMC),
[UHF](https://github.com/issp-center-dev/UHF-dev), and
Expand All @@ -13,15 +13,13 @@ C compiler (intel, Fujitsu, GNU, etc. )

### With Git

```
bash
``` bash
$ git clone https://github.com/issp-center-dev/StdFace
```


### Without Git (supported from ver.1.0)

You can download StdFace from a [release note](https://github.com/issp-center-dev/StdFace/releases).
You can download StdFace from [release page](https://github.com/issp-center-dev/StdFace/releases).

## Install StdFace

Expand All @@ -31,19 +29,47 @@ $ cmake --build build
$ cmake --install install
```

If you define -DUHF=OFF as [options], uhf_dry.out will not be made.
If you define -DMVMC=OFF as [options], mvmc_dry.out will not be made.
If you define -DHPHI=OFF as [options], hphi_dry.out will not be made.
If you define -DHWAVE=OFF as [options], hawave_dry.out will not be made.
Options need to be specified which programs are to be built:

- ``-DHPHI=ON``

HPhi mode is enabled. hphi_dry.out and libStdFace_hphi.a will be generated.

- ``-DMVMC=ON``

mVMC mode is enabled. mvmc_dry.out and libStdFace_mvmc.a will be generated.

- ``-DUHF=ON``

UHF mode is enabled. uhf_dry.out and libStdFace_uhf.a will be generated.

- ``-DHWAVE=ON``

H-wave mode is enabled. hwave_dry.out and libStdFace_hwave.a will be generated.

One or more options may be set simultaneously. Defaults are OFF.


## Usage

xxx_dry.out (xxx = hphi, mvmc, uhf, hwave) can be done with the following command with input.in as input file.

``` bash
$ xxx_dry.out input.in
```

After execution, input files for executing each tool will be generated in the executed directory.
Descriptions of StdFace input files can be found in the manuals for each tool:

[HPhi](https://github.com/issp-center-dev/HPhi),
[mVMC](https://github.com/issp-center-dev/mVMC),
[UHF](https://github.com/issp-center-dev/UHF-dev), and
[H-wave](https://github.com/issp-center-dev/H-wave).

## Licence

The distribution of the program package and the source codes for StdFace follow GNU General Public License version 3 ([GPL v3](http://www.gnu.org/licenses/gpl-3.0.en.html)).


## Author
Kazuyoshi Yoshimi, Mitsuaki Kawamura.

## Manual

under construction
Kazuyoshi Yoshimi, Mitsuaki Kawamura, Kota Ido, Yuichi Motoyama, and Tatsumu Aoyama.
25 changes: 17 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,38 @@ set(SOURCES_StdFace
)

if(UHF)
add_executable(uhf_dry.out dry.c ${SOURCES_StdFace})
add_library(StdFace_uhf STATIC ${SOURCES_StdFace})
target_compile_definitions(StdFace_uhf PUBLIC _UHF)
add_executable(uhf_dry.out dry.c)
target_compile_definitions(uhf_dry.out PUBLIC _UHF)
target_link_libraries(uhf_dry.out PUBLIC m)
target_link_libraries(uhf_dry.out PUBLIC StdFace_uhf m)
install(TARGETS uhf_dry.out RUNTIME DESTINATION bin)
endif()

if(MVMC)
add_executable(mvmc_dry.out dry.c ${SOURCES_StdFace})
add_library(StdFace_mvmc STATIC ${SOURCES_StdFace})
target_compile_definitions(StdFace_mvmc PUBLIC _mVMC)
add_executable(mvmc_dry.out dry.c)
target_compile_definitions(mvmc_dry.out PUBLIC _mVMC)
target_link_libraries(mvmc_dry.out PUBLIC m)
target_link_libraries(mvmc_dry.out PUBLIC StdFace_mvmc m)
install(TARGETS mvmc_dry.out RUNTIME DESTINATION bin)
endif()

if(HPHI)
add_executable(hphi_dry.out dry.c ${SOURCES_StdFace})
add_library(StdFace_hphi STATIC ${SOURCES_StdFace})
target_compile_definitions(StdFace_hphi PUBLIC _HPhi)
add_executable(hphi_dry.out dry.c)
target_compile_definitions(hphi_dry.out PUBLIC _HPhi)
target_link_libraries(hphi_dry.out PUBLIC m)
target_link_libraries(hphi_dry.out PUBLIC StdFace_hphi m)
install(TARGETS hphi_dry.out RUNTIME DESTINATION bin)
endif()

if (HWAVE)
add_executable(hwave_dry.out dry.c ${SOURCES_StdFace})
add_library(StdFace_hwave STATIC ${SOURCES_StdFace})
target_compile_definitions(StdFace_hwave PUBLIC _HWAVE)
add_executable(hwave_dry.out dry.c)
target_compile_definitions(hwave_dry.out PUBLIC _HWAVE)
target_link_libraries(hwave_dry.out PUBLIC m)
target_link_libraries(hwave_dry.out PUBLIC StdFace_hwave m)
install(TARGETS hwave_dry.out RUNTIME DESTINATION bin)
endif()

15 changes: 15 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
if (HPHI)
add_subdirectory(hphi)
endif()

if (MVMC)
add_subdirectory(mvmc)
endif()

if (UHF)
add_subdirectory(uhf)
endif()

if (HWAVE)
add_subdirectory(hwave)
endif()
57 changes: 57 additions & 0 deletions test/almost_diff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import sys

#EPS = 0.0
EPS = 1.0e-12

if len(sys.argv) < 3:
print("usage: {} file1 file2".format(sys.argv[0]))
sys.exit(0)

file_a = sys.argv[1]
file_b = sys.argv[2]

with open(file_a, "r") as fp:
lines_a = fp.readlines()
with open(file_b, "r") as fp:
lines_b = fp.readlines()

err = 0
for idx, (ta, tb) in enumerate(zip(lines_a, lines_b)):
vas = ta.split()
vbs = tb.split()
if len(vas) != len(vbs):
print("DIFF: line {}: number of keywords differ: {} {}".format(idx, len(vas), len(vbs)))
continue
for va, vb in zip(vas, vbs):
# literally equal
if va == vb:
continue
# try compare as intergers
try:
iva = int(va)
ivb = int(vb)
if iva == ivb:
continue
except ValueError:
pass
# try compare as floating point numbers
try:
fva = float(va)
fvb = float(vb)
if abs(fva) < EPS and abs(fvb) < EPS:
r = abs(fva - fvb)
else:
r = abs(fva - fvb) / (abs(fva) + abs(fvb))
if r < EPS:
continue
except ValueError:
pass
# different anyway
err += 1
print("DIFF: line {}: \"{}\" \"{}\"".format(idx, va, vb))

if err > 0:
print("compare failed (err={})".format(err))
sys.exit(1)

sys.exit(0)
Loading

0 comments on commit ab32f48

Please sign in to comment.