write build info to object file

This commit is contained in:
ignis 2019-05-22 02:29:27 +09:00
parent 9ef25f4c65
commit 641b3e3d1f
4 changed files with 48 additions and 62 deletions

View file

@ -30,7 +30,7 @@ MODULES += \
post.o
# Objects
OBJ = test.o
OBJ = post_dns.o
Post_Cbar_FSD_Incomp : x-edge-cold-bc-uPrime-hybrid
@ -46,11 +46,27 @@ m_terms.f90 : code_gen/code_gen.py code_gen/terms.input code_gen/resources/m_tem
${compiler} -c ${flags} $<
clean:
rm -f *.o *.mod x-edge-cold-bc-uPrime-hybrid test_calculate
rm -f *.o *.mod x-edge-cold-bc-uPrime-hybrid test_calculate build_info.txt
testc : test_calculate
test_calculate : m_openmpi.o m_parameters.o Compact.o m_calculate.o test_calculate.o
${compiler} -o test_calculate ${flags} m_openmpi.o m_parameters.o Compact.o m_calculate.o test_calculate.o
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
test_calculate.o : m_openmpi.o m_parameters.o Compact.o m_calculate.o
print_build_info.o : print_build_info.c
gcc -c 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
echo "build date:" > build_info.txt
date >> build_info.txt
echo "build base revision" >> build_info.txt
git rev-parse HEAD >> build_info.txt
echo "git status" >> build_info.txt
git status >> build_info.txt
echo "terms" >> build_info.txt
cat code_gen/terms.input >> build_info.txt

View file

@ -2,7 +2,7 @@
! This code is written by Dongkyu Lee (THDHRKDG)
! Purpose of this code is to postprocess results of stagnating DNS code
PROGRAM test
PROGRAM post_dns
USE m_openmpi
USE post
USE Compact

25
code/print_build_info.c Normal file
View file

@ -0,0 +1,25 @@
#include <stdio.h>
extern const char _binary_build_info_txt_start [];
extern const char _binary_build_info_txt_end [];
void print_data_ ()
{
char* p = &_binary_build_info_txt_start;
while ( p != &_binary_build_info_txt_end ) putchar(*p++);
}
/*
*/
void cstr_( char *s, int *b )
{ /* return n copies of arg */
int count = 0;
char* p = &_binary_build_info_txt_start;
while ( p != &_binary_build_info_txt_end )
{
s[count++] = *p++;
}
}

View file

@ -18,6 +18,8 @@ real*4, dimension(2) :: startt
real*4, dimension(2) :: endt
real*4 :: result
call print_data
nxp = 512
nyp = 256
nzp = 256
@ -143,34 +145,6 @@ write(*,*) "relerr_min_max", minval(ccc), maxval(ccc)
write(*,*) "test ddz_ref"
call ETIME(startt, result)
call ddz_ref(bbb, aaa)
call ETIME(endt, result)
print *, "usert", endt(1) - startt(1)
print *, "systt", endt(2) - startt(2)
do k = 1,nzp
do j = 1,nyp
do i = nxp/4,3*nxp/4
xx = i * hxp
yy = j * hyp
zz = k * hzp
fxyz = (2.0 * sin(1.1 * xx) * sin(3.0 * yy) * cos(2.0 * zz))
ccc(i,j,k) = (bbb(i,j,k) - fxyz) / (fxyz)
if ((abs(ccc(i,j,k)) > 0.01 ) .and. (abs(bbb(i,j,k)) > 1.0e-14 )) write(*,*) bbb(i,j,k), fxyz
end do
end do
end do
write(*,*) "relerr_min_max", minval(ccc), maxval(ccc)
write(*,*) "test d2dx"
@ -260,35 +234,6 @@ end do
write(*,*) "relerr_min_max", minval(ccc), maxval(ccc)
write(*,*) "test d2dz_ref"
call ETIME(startt, result)
call d2dz_ref(bbb, aaa)
call ETIME(endt, result)
print *, "usert", endt(1) - startt(1)
print *, "systt", endt(2) - startt(2)
do k = 1,nzp
do j = 1,nyp
do i = nxp/4,3*nxp/4
xx = i * hxp
yy = j * hyp
zz = k * hzp
fxyz = -(4.0 * sin(1.1 * xx) * sin(3.0 * yy) * sin(2.0 * zz))
ccc(i,j,k) = (bbb(i,j,k) - fxyz) / (fxyz)
if ((abs(ccc(i,j,k)) > 0.01 ) .and. (abs(fxyz) > 1.0e-14 )) write(*,*) bbb(i,j,k), fxyz
end do
end do
end do
write(*,*) "relerr_min_max", minval(ccc), maxval(ccc)