From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:6214:3803:b0:534:7e0d:7d17 with SMTP id ns3-20020a056214380300b005347e0d7d17mr1069407qvb.51.1674431594207; Sun, 22 Jan 2023 15:53:14 -0800 (PST) X-Received: by 2002:a05:6808:634e:b0:35e:2193:fbd0 with SMTP id eb14-20020a056808634e00b0035e2193fbd0mr1063583oib.272.1674431593926; Sun, 22 Jan 2023 15:53:13 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 22 Jan 2023 15:53:13 -0800 (PST) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=188.150.24.77; posting-account=HFCrOQoAAABZD_f-UUbYHm3lJDIrh-UX NNTP-Posting-Host: 188.150.24.77 References: <9c7cccd9-733f-49a8-b482-087ccb14b58dn@googlegroups.com> <2039b788-bbbd-4c8e-9785-4e45d4a2027en@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9a0f1073-efb5-4ab1-89b3-37e86dc1504an@googlegroups.com> Subject: Re: Real_Arrays on heap with overloaded operators and clean syntax From: Joakim Strandberg Injection-Date: Sun, 22 Jan 2023 23:53:14 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 4302 Xref: reader01.eternal-september.org comp.lang.ada:64861 List-Id: m=C3=A5ndag 23 januari 2023 kl. 00:34:31 UTC+1 skrev roda...@gmail.com: > On 23/1/23 10:20, Jim Paloander wrote:=20 > >>> Dear ADA lovers,=20 > >>> with stack allocation of Real_Vector ( 1 .. N ) when N >=3D 100,000 I= get STACK_OVERFLOW ERROR while trying to check how fast operator overloadi= ng is working for an expression=20 > >>>=20 > >>> X :=3D A + B + C + C + A + B, where=20 > >>> A,B,C,X are all Real_Vector ( 1 .. N ).=20 > >>>=20 > >>> So my only option was to allocate on the heap using new. But then I l= ost the clean syntax=20 > >>>=20 > >>> X :=3D A + B + C + C + A + B=20 > >>>=20 > >>> and I had to write instead:=20 > >>>=20 > >>> X.all :=3D A.all + B.all + C.all + C.all + A.all + B.all.=20 > >>>=20 > >>> This is really ugly and annoying because when you are using Real_Arra= ys for implementing some linear algebra method who relies heavilly on matri= x vector products and vector updates, you do need to allocate on the heap (= sizes are determined in runtime) and you do need a clean syntax. So, is the= re any way to simplify my life without using the .all or even without decla= ring A,B,C,X as access Real_Vector?=20 > >>> Thanks for your time!=20 > >> If you are on linux, then you could set the stack size with=20 > >>=20 > >> $ ulimit -s unlimited=20 > >> $ launch_my_app=20 > >>=20 > >>=20 > >>=20 > >> Regards.=20 > > On Windows 10 with mingw64? > Not sure. I don't have a windows machine.=20 >=20 > What happens when try ?=20 >=20 > $ ulimit -a Something came up and I had to send my previous reply/e-mail as is. I wante= d to find the video where Jean Pierre Rosen talks about how memory is handl= ed in the Ada language from FOSDEM perhaps 2018-2019. Unfortunately I have = been unable to find it. Secondly, example of Ada code where Storage pool usage is demonstrated: htt= ps://github.com/joakim-strandberg/advent_of_code Example of task with rendez-vous mechanism: task T with Storage_Size =3D> 10_000_000 is entry Run (I : Integer); end T; task body T is begin loop begin select accept Run (I : Integer) do null; -- Here save the value of the integer I for la= ter processing in the task end Run; null; -- Whenever another task calls Run on this task, the= work to be done should be put here. -- Put the mathematical calcuations here. or terminate; -- To end the select-statement with "or termin= ate;" means the task will terminate when the environment task has finished = execution of the "Main" procedure of the application. No need to tell the t= ask T that now it is time to shutdown. end select; exception when Error : others =3D> -- Print error to standard out here using subprograms from Ad= a.Exceptions and Ada.Text_IO. end; end loop; end T;=20 Best regards, Joakim