Allocatable array construction

Hello all!

Trying to work on a project from you tube (from over a year ago so meh…) that tries to find 5 words of 5 letters that are non repeating. The original you tuber solved the question in over 1 month of run time in python, but it then devolved into a race which only c++ could best at less than 10 microsoeconds to arrive at the same list.

In the mean time, I thought it would be a fun test of openmpi/opencoarrays but in order to decrease the hammer on disk and instead make use of coarray memory moves, I would like to read the dictionary in, perform a few nudges and then co_brodcast the array of possible 5 letter words to the other images. Thing is, I can’t seem to declare the array correctly.

Type :: t_wordbitmap
Character(5) :: c_word
Integer(4) :: i_bitmap
End type

Type(t_wordbitmap), allocatable, dimension(:slight_smile: :: a_dataheap[*] / The (1) is at the end of this line.

This code fails to compile with:
Allocatable coarrays variable ‘a_dataheap’ at (1) must have deferred shape
Or
Assumed size array at (1) must be a dummy argument

I don’t know the number of words in the dictionary until I read it so I’m reading to a linked list first then trying to allocate the array after trimming to 5 letter words only and walking the resulting structure which will then have a known number of nodes. The type structure above does not have a p_next and p_prev because it will be in an array once allocated with our total number of words to parse.

Is this the right way to do this, or is there any other way to just ship the whole structure as a memory block?

Any thoughts?

Knarfnarf

    Type :: t_wordbitmap
        Character(5) :: c_word
        Integer(4) :: i_bitmap
    End type
    Type(t_wordbitmap), allocatable, dimension(:):: a_dataheap[:]
    allocate(a_dataheap(10)[*])

It must be defined like this

Hello!

Thank you! Moving forwards!

Knarfnarf