Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name list only holds 128 entries #43

Closed
joaander opened this issue Sep 12, 2019 · 0 comments · Fixed by #61
Closed

Name list only holds 128 entries #43

joaander opened this issue Sep 12, 2019 · 0 comments · Fixed by #61
Labels
bug Something isn't working
Milestone

Comments

@joaander
Copy link
Member

Description

GSD does not expand the namelist. write_chunk silently writes data with an invalid type id.

Script

# Include a minimal script that reproduces the problem
import gsd.fl
import numpy

with gsd.fl.open(name='file.gsd', mode='wb', application="test", schema="test", schema_version=[1,0]) as f:
    for i in range(256):
        f.write_chunk(name=str(i), data=numpy.array([i], dtype=numpy.int32))
    f.end_frame()

with gsd.fl.open(name='file.gsd', mode='rb', application="test", schema="test", schema_version=[1,0]) as f:
    for i in range(256):
        v = f.read_chunk(frame=0, name=str(i))
        print(v[0])

Output

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
Traceback (most recent call last):
  File "gsd-namelist-limit.py", line 11, in <module>
    v = f.read_chunk(frame=0, name=str(i))
  File "fl.pyx", line 623, in gsd.fl.GSDFile.read_chunk
KeyError: 'frame 0 / chunk 128 not found in: file.gsd'
j

Expected output

The values 0 through 255, or an error when attempting to write chunk 128.

Configuration

Platform:

  • Mac
  • Linux

Installation method:

  • Compiled from source

Versions:

  • Python version: 3.7
  • GSD version: 1.8.0

Developer

I will add an error condition to write_chunk in v1.9.0.

HOOMD files only use ~50 names. A user would need to enable a large number of custom logs before we need to fix the root cause of the bug. Users with that many chunk names may also wish to implement a hash map for the name list to improve lookup speed.

@joaander joaander added the bug Something isn't working label Sep 12, 2019
joaander added a commit that referenced this issue Sep 12, 2019
joaander added a commit that referenced this issue Sep 12, 2019
@joaander joaander added this to the v2.0 milestone Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant