4 ms·
We have moved on, from a compiler that could fit in 4kbytes of main memory to one that is a 2Gigabyte download. It was “array slicing” (array expressions) that
by theodorethomas 5y ago
We have moved on, from a compiler that could fit in 4kbytes of main memory to one that is a 2Gigabyte download.
It was “array slicing” (array expressions) that was missing in F77. That’s what sequence association was meant to help with. You pass a scalar that is an element of an array and the corresponding dummy is an array. The dummy gets associated with an array that starts at that element and then continues with all the other elements of the actual argument array in array element order. You then use the LDA argument to give a 2d view of the same array in the dummy so you can step to the next column (or every other column if you want, just double the LDA) no matter where you started from.
Programs back then had no need for dynamic memory, they were the only thing running on the machine, no kernel, no other processes or users, why not just grab the entire memory? They booted in a blink of an eye, too. Now, not even our supercomputers run like that. You never know who else is using the resources of the machine.
- BlackFly 5y agoYes, I am well aware of what it is doing and we won't really make any progress until you can believe that I know the language. We are disagreeing about the intent and rationale of its addition. Everytime someone tries to interact with DGETRF for the first time, they look up the API (at http://www.math.utah.edu/software/lapack/lapack-d/dgetrf.html http://www.math.utah.edu/software/lapack/lapack-d/dgetrf.htm... maybe) and read, "The leading dimension of the array A. LDA >= max(1,M)." Which tells them nothing, so they keep digging through the documentation. Maybe they check the user's guide, https://www.netlib.org/lapack/lug/node116.html https://www.netlib.org/lapack/lug/node116.html and they read "However an assumed-size array declaration has been used in the software, in order to overcome some limitations in the Fortran 77 standard." but sadly their journey is still not over because none of these source have characterized it as you are (as an array stride due to memory layout). Nor named it appropriately. They still have to keep digging to understand it as a stride. Its name reflects the fact that it was common to oversize the allocation of the memory for the matrix and then LDA > M of course, because in fact LDA = M_MAX. The leading dimension of the matrix in memory (the stride if you were dealing with a 1-d array). If they are lucky (as I was), they will have access to some of the older software that was doing this and they can see what the purpose of the argument and the rationale of the name is. That this also enables one to focus on a sub-block of A and give a stride value. But certainly that isn't the "leading dimension of A". It is the leading dimension of A precisely when A is a bigger matrix and you are focused only on the upper block because of static allocation of A.
- theodorethomas 5y agoIf you know the language, you will be aware that the word "memory" is not used in the Standard, except in non-normative sections (i.e. Notes), the keyword SYNC MEMORY (whose specification is not about memory but "segments" for the purpose of managing coarray programs) and the section dealing with interoperability with C (because C is a systems programming language where memory addresses are used). "Memory layout" is not specified in Fortran. Array element order and sequence association and storage association are the terms. I prefer to argue about a language using its terms of reference. To summarise: F77 has no array expressions so the only way to pass a subobject of an array is through sequence association, as described. If it had dynamic allocation and no array expressions, sequence association would still be needed. In fact, most F77 compilers supported dynamic allocation as a non-standard extension and STILL used sequence association to pass subobjects of arrays. Whether you pass a whole array or use sequence association, the meaning of LDA is clear: it determines how sequence association will work between rank-2 dummy and actual array. And, yes, you can use different LDAs (as long as you don't step over the bounds) to effectively walk the diagonal or skip columns.
- BlackFly 5y agoAs I said, it is a historical argument to argue why something was designed in a particular way. You do not seem at all interested in attempting a historical argument. You aren't going to convince me without offering something in the way of common uses of block matrices in numerical linear algebra in the early 70s or without technical notes describing the intent of the parameter to be used for general block submatrix purposes. Yes, what you are saying is correct about the technical capabilities of the parameter; I have agreed with you 3 times already, but it is irrelevant. You keep ignoring the actual point: an answer of what you can use the parameter for is not the same as an answer to why that parameter is there. You can be quite right about what the parameter allows you to do and quite wrong about why it was added in the first place. The origin of LDA as an argument traces all the way back to LINPACK. Just read chapter 1 of the LINPACK user's guide, https://doi.org/10.1137/1.9781611971811.ch1 https://doi.org/10.1137/1.9781611971811.ch1 and see them using the parameter as I describe. It is used precisely to over allocate an array in a program so that it can be dynamically sized at runtime. The allocate an array A of size 50 x 50, specify LDA to be 50, then assign N to some value and use 2d array notation to set a block of the array A to a matrix. My assertion is that is precisely the use case they designed that parameter to be used for. That usage is why algorithms with LDA are first class and there are no variants (and they offer many variants) without it: because they knew that people would compile programs with overallocated arrays and require it. LINPACK predates even fortran 77, tracing back into subroutines developed by Wilkinson this sort of use arises from fortran 66. I'm having a hard time finding technical notes describing those routines though. I'm curious if LDA shows up in the ALGOL 60 versions. In any case all this history was relayed to me by my supervisor who worked worked much closer to this history than me so I trust that quite implicitly. For you, maybe it was enough to see that the parameter was a stride and stop digging. For me, I saw that, saw it always being set equal to N (and M = N) in all actual uses in the modern code I was working with and I was curious why it wasn't abstracted away because even at Fortran 77 is was easy to hide it behind a zero cost abstraction. So I went down the historical rabbit hole. Maybe I should have just pointed out that the names of the subroutines are limited to 6 characters because of history and you would have agreed that use of LAPACK is a trigger for most people to realize that fortran is filled with historical artifacts.