lkedward / fhash Goto Github PK
View Code? Open in Web Editor NEWfpm package implementing a hash table with support for generic keys and values.
Home Page: https://lkedward.github.io/fhash/
License: MIT License
fpm package implementing a hash table with support for generic keys and values.
Home Page: https://lkedward.github.io/fhash/
License: MIT License
Look into replacing the singly-linked lists with either dynamic arrays or recursively allocated types.
fhash_tbl.f90 contains several calls to the modulo
intrinsic function in which different integer kinds are passed, which is not allowed per the Fortran 2008 standard.
If the code is compiled using gfortran with the -std=f2008
option set the following errors are issued:
src/fhash_tbl.f90:298:28:
298 | index = modulo(key%hash(),size(tbl%buckets)) + 1
| 1
Error: GNU Extension: Different type kinds at (1)
src/fhash_tbl.f90:245:28:
245 | index = modulo(key%hash(),size(tbl%buckets)) + 1
| 1
Error: GNU Extension: Different type kinds at (1)
src/fhash_tbl.f90:165:28:
165 | index = modulo(key%hash(),size(tbl%buckets)) + 1
| 1
Error: GNU Extension: Different type kinds at (1)
src/fhash_tbl.f90:133:28:
133 | index = modulo(key%hash(),size(tbl%buckets)) + 1
| 1
Error: GNU Extension: Different type kinds at (1)
Hi @LKedward. In the following code I'd expect the output num_items : 0
program main
use fhash
implicit none
type(fhash_tbl_t) :: tbl
integer :: num_buckets, num_items, num_collisions, max_depth
call tbl%stats(num_buckets, num_items, num_collisions, max_depth)
print *, 'num_items:', num_items
end program main
The result is a big number:
This happens on Windows 10.
no problem with the gfortran versions I have, but withifort (IFORT) 2021.3.0 20210609
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.
I get the following clash
build/dependencies/fhash/src/fhash_tbl.f90(501): error #5286: Ambiguous generic interface GET: previously declared specific procedure FHASH_TBL_GET_INT32 is not distinguishable from this declaration. [FHASH_TBL_GET_RAW]
subroutine fhash_tbl_get_raw(tbl,key,value,stat)
-----------^
build/dependencies/fhash/src/fhash_tbl.f90(597): catastrophic error: Too many errors, exiting
compilation aborted for build/dependencies/fhash/src/fhash_tbl.f90 (code 1)
STOP 1
<ERROR> Compilation failed for object " build_dependencies_fhash_src_fhash_tbl.f90.o "
<ERROR>stopping due to failed compilation
When built in release mode on Windows with gfortran 8.1.0 and MacOS with gfortran 9.3.0, the hashing testsuite fails.
See github actions output.
On MacOS the tests run to completion but fail, e.g.:
# Starting int32-hashing ... (3/6)
# ...int32-hashing [FAILED]
#Message:String hash check failed for 32bit integer " 0"
expected "4B95F515" but got "FFFFFFFF"
On Windows, the tests encounter the same failure as above but segfault in the SLL testsuite before completing.
NB. All tests and demos run fine on Ubuntu with gfortran 9.3.0 when built in release mode.
Edit: Looks like the problem is with int64
overflow behaviour in optimised builds. Failing builds are not wrapping round, but ceiling at huge(int64)
. Should rewrite hash implementations in C with proper unsigned ints.
When building a program with fhash
as a dependency using fpm
specifying ifort as the compiler I received the following error:
$ fpm build --compiler ifort
+ ifort -c app/main.f90 -warn all -check:all:noarg_temp_created -error-limit 1 -O0 -g -assume byterecl -traceback -module build/ifort_BFE5DBA90E3838BC/mapred_project -I build/ifort_BFE5DBA90E3838BC/mapred_project -o build/ifort_BFE5DBA90E3838BC/mapred_project/app_main.f90.o
+ ifort -c build/dependencies/fhash/src/fhash_data_container.f90 -warn all -check:all:noarg_temp_created -error-limit 1 -O0 -g -assume byterecl -traceback -module build/ifort_BFE5DBA90E3838BC/mapred_project -I build/ifort_BFE5DBA90E3838BC/mapred_project -o build/ifort_BFE5DBA90E3838BC/mapred_project/build_dependencies_fhash_src_fhash_data_container.f90.o
build/dependencies/fhash/src/fhash_data_container.f90(96): error #8304: In an intrinsic assignment statement, variable shall not be polymorphic. [RAW]
raw = data
------^
build/dependencies/fhash/src/fhash_data_container.f90(244): catastrophic error: Too many errors, exiting
compilation aborted for build/dependencies/fhash/src/fhash_data_container.f90 (code 1)
Command failed
ERROR STOP
Error termination. Backtrace:
#0 0x55ccb6e5409c in ???
#1 0x55ccb6e622bb in ???
#2 0x55ccb6e625ac in ???
#3 0x2ba3f5588e8b in GOMP_parallel
at /home/conda/feedstock_root/build_artifacts/ctng-compilers_1610729750655/work/.build/x86_64-conda-linux-gnu/src/gcc/libgomp/parallel.c:171
#4 0x55ccb6e8a65f in ???
#5 0x55ccb6e97142 in ???
#6 0x55ccb6e2613f in ???
#7 0x2ba3f58fc554 in ???
#8 0x55ccb6e261b8 in ???
This falls under feature request instead of issue, but the current implantation of the tbl%get function has a couple 'non pure' subroutines, which block usage in 'Do Concurrent' loops. Not sure how difficult to change, but would be nice to be able to remove that restriction.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.