added makefile variable TERMSPEC and cmdl options -h and -v

This commit is contained in:
ignis 2019-05-24 07:06:37 +09:00
parent 2613041d53
commit 9bea0815a0
3 changed files with 43 additions and 6 deletions

3
code/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
*.o
*.pyc
*.ipynb

View file

@ -6,6 +6,8 @@
BLOCKSIZE?=32
TERMSPEC?=code_gen/terms.input
flags = -cpp -DBLOCKSIZE=$(BLOCKSIZE) -Wall -O3 -ffree-line-length-0 -fdefault-integer-8 -fdefault-double-8 -fdefault-real-8 -march=native
ifdef CHECK
@ -39,8 +41,8 @@ x-edge-cold-bc-uPrime-hybrid : ${MODULES} ${OBJ} print_build_info.o build_info.o
${OBJ} : ${MODULES}
m_terms.f90 : code_gen/code_gen.py code_gen/terms.input code_gen/resources/m_template.py
python code_gen/code_gen.py code_gen/terms.input > $@
m_terms.f90 : code_gen/code_gen.py ${TERMSPEC} code_gen/resources/m_template.py
python code_gen/code_gen.py ${TERMSPEC} > $@
%.o: %.f90
${compiler} -c ${flags} $<
@ -48,7 +50,8 @@ m_terms.f90 : code_gen/code_gen.py code_gen/terms.input code_gen/resources/m_tem
clean:
rm -f *.o *.mod x-edge-cold-bc-uPrime-hybrid test_calculate build_info.txt
testc : test_calculate
test : test_calculate
./test_calculate
test_calculate : m_openmpi.o m_parameters.o Compact.o m_calculate.o test_calculate.o print_build_info.o build_info.o
${compiler} -o test_calculate ${flags} m_openmpi.o m_parameters.o Compact.o m_calculate.o test_calculate.o print_build_info.o build_info.o
@ -61,5 +64,5 @@ print_build_info.o : print_build_info.c
build_info.o : build_info.txt
ld -r -b binary -o build_info.o build_info.txt
build_info.txt : code_gen/terms.input
python code_gen/code_gen.py -b code_gen/terms.input > build_info.txt
build_info.txt : ${TERMSPEC}
python code_gen/code_gen.py -b ${TERMSPEC} > build_info.txt

View file

@ -7,16 +7,47 @@
USE post
USE Compact
CHARACTER(100) :: num1char = ""
character (len=2000) :: input_string
call cstr(input_string)
write(*,*) input_string
!First, make sure the right number of inputs have been provided
IF(COMMAND_ARGUMENT_COUNT() > 0) THEN
CALL GET_COMMAND_ARGUMENT(1,num1char) !first, read in the two values
IF(num1char=="-h") THEN
WRITE(*,*) "usage: x-edge-cold-bc-uPrime-hybrid [-h|-v]"
WRITE(*,*) ""
WRITE(*,*) "optional arguments:"
WRITE(*,*) " -h show this help message and exit"
WRITE(*,*) " -v print version information"
ELSE IF(num1char=="-v") THEN
WRITE(*,*) input_string
ELSE
WRITE(*,*) 'ERROR, OPTION NOT SUPPORTED ', num1char
END IF
STOP
ELSE IF(COMMAND_ARGUMENT_COUNT() > 1) THEN
WRITE(*,*) 'ERROR, TOO MANY COMMAND-LINE ARGUMENTS(MORE THAN ONE). STOPPING'
STOP
ELSE
CALL m_openmpi_init
if (iammaster) write(*,*) input_string
CALL main
CALL m_openmpi_exit
ENDIF
END PROGRAM