Skip to content

Commit

Permalink
add GDIT's performance optimization for RRFS
Browse files Browse the repository at this point in the history
  • Loading branch information
ShunLiu-NOAA committed Dec 2, 2024
1 parent d0facd7 commit 1ae752d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/gsi/crc32.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module crc32
use iso_c_binding
implicit none
public :: digest

interface
integer function digest_c(message) bind(c)
use iso_c_binding, only: c_char
character(kind=c_char), intent(in) :: message(*)
end function digest_c
end interface

contains

integer function digest(m)
use iso_c_binding, only: c_null_char
implicit none
character(len=*), intent(in) :: m
!m='nid001019'
digest=abs(digest_c(trim(m)//c_null_char))
!write(6,'("Digest ",I12)') digest
end function digest
end module crc32
7 changes: 7 additions & 0 deletions src/gsi/crc32_c.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <stdio.h>
#include <string.h>
#include <zlib.h>

uLong digest_c(char * message) {
return crc32(0, (const void*)message, strlen(message));
}

0 comments on commit 1ae752d

Please sign in to comment.