For review purpose I have written a very tiny code for vectors in ats. If
anyone can quickly go through it (whenever they get free time) and comment
on the points below will be great. I have tried the code to be similar to
examples given in “Effective ATS” .
The functions qstruct_objectify and qstruct_unobjectify may shed some
light on this.
On Friday, February 14, 2014 10:56:05 AM UTC-5, chotu s wrote:
Thanks a “lot” guys , I’ll read all the suggestions and links tomorrow(as
it is late here) and will ask related question after that.
Regarding stack allocation , what I had in mind was small size and
temporary arrays whose size is known at compile time , some thing like val
v = make_local_vector_n(n) , where n is known at compile time.
I think stack allocation idea came to me from the udacity parallel
programming competition where allocating main memory on gpu was costly(if I
remember correctly) , but they had different types of memory layer so one
can also use the fast shared memory whose capacity ranged from 64K to
256K(subject to correction).
Actually, most people do not realize that a real danger with alloca is
that tail-recursion,
which should be done in constant space, may easily cause stack-overflow
when it is coupled
with stack-allocation. The issue is very similar to inlining a function
that calls alloca.
On Friday, February 14, 2014 10:09:12 AM UTC-5, Brandon Barker wrote:
Thanks, also here’s some related discussion http://stackoverflow.com/
questions/1018853/why-is-alloca-not-considered-good-practice.
On Feb 14, 2014 9:43 AM, “gmhwxi” gmh...@gmail.com wrote:
You can use alloca to allocate memory on stack at run-time.
Here is an example I did:
On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a, n), then
the size (of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big point in
having dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean
allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors
in ats. If anyone can quickly go through it (whenever they get free time)
and comment on the points below will be great. I have tried the code to be
similar to examples given in “Effective ATS” .
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/57f1a0bb-f0ba-4a06-95b3-15f988245530%40go oglegroups.com.
On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a, n), then the
size (of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big point in having
dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors in ats.
If anyone can quickly go through it (whenever they get free time) and
comment on the points below will be great. I have tried the code to be
similar to examples given in “Effective ATS” .
When you say ‘allocate the vector on a stack’, do you mean allocating
the arrayptr on stack?On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors in ats. If
anyone can quickly go through it (whenever they get free time) and comment
on the points below will be great. I have tried the code to be similar to
examples given in “Effective ATS” .
On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a, n), then the
size (of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big point in
having dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors in
ats. If anyone can quickly go through it (whenever they get free time) and
comment on the points below will be great. I have tried the code to be
similar to examples given in “Effective ATS” .
I want to know how to allocate the vector on a stack instead on
a heap
I want to know is vector_add function ok ?
Is this how one would go about programming in ATS2
Any further comment is also welcome
Thanks
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/2c3bcbb2-cad6-46da-956c-b0da4c129450% 40googlegroups.com.
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/CAAZxu4zZHWYAW2AD8sU6VVdsQ7Fk%
3DGbG81JdpMV5ZYPzYurAsg%40mail.gmail.com.
The functions qstruct_objectify and qstruct_unobjectify may shed
some light on this.
On Friday, February 14, 2014 10:56:05 AM UTC-5, chotu s wrote:
Thanks a “lot” guys , I’ll read all the suggestions and links
tomorrow(as it is late here) and will ask related question after that.
Regarding stack allocation , what I had in mind was small size
and temporary arrays whose size is known at compile time , some thing like
val v = make_local_vector_n(n) , where n is known at compile time.
I think stack allocation idea came to me from the udacity
parallel programming competition where allocating main memory on gpu was
costly(if I remember correctly) , but they had different types of memory
layer so one can also use the fast shared memory whose capacity ranged from
64K to 256K(subject to correction).
Actually, most people do not realize that a real danger with
alloca is that tail-recursion,
which should be done in constant space, may easily cause
stack-overflow when it is coupled
with stack-allocation. The issue is very similar to inlining a
function that calls alloca.
On Friday, February 14, 2014 10:09:12 AM UTC-5, Brandon Barker wrote:
On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a,
n), then the size (of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big
point in having dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you
mean allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for
vectors in ats. If anyone can quickly go through it (whenever they get free
time) and comment on the points below will be great. I have tried the code
to be similar to examples given in “Effective ATS” .
I want to know how to allocate the vector on a
stack instead on a heap
I want to know is vector_add function ok ?
Is this how one would go about programming in ATS2
Any further comment is also welcome
Thanks
–
You received this message because you are subscribed to
the Google Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails
from it, send an email to ats-lang-user…@googlegroups.
com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/2c3bcbb2-
cad6-46da-956c-b0da4c129450%40googlegroups.com.
–
You received this message because you are subscribed to the
Google Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from
it, send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-lan…@googlegroups.
com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/57f1a0bb-f0
ba-4a06-95b3-15f988245530%40googlegroups.com.
Allocating a vector of size n on stack for n that is unknown until run-time
is not really
a good practice. There is really very little you can gain but you do run a
big risk of stack overflow.On Friday, February 14, 2014 2:13:02 AM UTC-5, chotu s wrote:
That is I have abstract type vector and when I create a vector the amount
of space need to store its content is taken from stack instead of heap. I
want something like this :
val vect = make_local_vector_of_size_n (n)
I assume that this will be again implementation dependent right ?
On Fri, Feb 14, 2014 at 11:09 AM, gmhwxi <gmh...@gmail.com <javascript:>>wrote:
When you say ‘allocate the vector on a stack’, do you mean allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors in ats.
If anyone can quickly go through it (whenever they get free time) and
comment on the points below will be great. I have tried the code to be
similar to examples given in “Effective ATS” .
The functions qstruct_objectify and qstruct_unobjectify may shed some light
on this.On Friday, February 14, 2014 10:56:05 AM UTC-5, chotu s wrote:
Thanks a “lot” guys , I’ll read all the suggestions and links tomorrow(as
it is late here) and will ask related question after that.
Regarding stack allocation , what I had in mind was small size and
temporary arrays whose size is known at compile time , some thing like val
v = make_local_vector_n(n) , where n is known at compile time.
I think stack allocation idea came to me from the udacity parallel
programming competition where allocating main memory on gpu was costly(if I
remember correctly) , but they had different types of memory layer so one
can also use the fast shared memory whose capacity ranged from 64K to
256K(subject to correction).
Thanks for great suggestions.
On Fri, Feb 14, 2014 at 8:50 PM, gmhwxi <gmh...@gmail.com <javascript:>>wrote:
Actually, most people do not realize that a real danger with alloca is
that tail-recursion,
which should be done in constant space, may easily cause stack-overflow
when it is coupled
with stack-allocation. The issue is very similar to inlining a function
that calls alloca.
On Friday, February 14, 2014 10:09:12 AM UTC-5, Brandon Barker wrote:
Thanks, also here’s some related discussion http://stackoverflow.com/
questions/1018853/why-is-alloca-not-considered-good-practice.
On Feb 14, 2014 9:43 AM, “gmhwxi” gmh...@gmail.com wrote:
You can use alloca to allocate memory on stack at run-time.
Here is an example I did:
On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a, n), then
the size (of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big point in
having dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean
allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors in
ats. If anyone can quickly go through it (whenever they get free time) and
comment on the points below will be great. I have tried the code to be
similar to examples given in “Effective ATS” .
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/CAAZxu4zZHWYAW2AD8sU6VVdsQ7Fk%3DGbG81JdpM
V5ZYPzYurAsg%40mail.gmail.com.
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/57f1a0bb-f0ba-4a06-95b3-15f988245530% 40googlegroups.com.
In general, if the index n occurs in the type vector(a, n), then the size
(of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big point in having
dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors in ats.
If anyone can quickly go through it (whenever they get free time) and
comment on the points below will be great. I have tried the code to be
similar to examples given in “Effective ATS” .
The functions qstruct_objectify and qstruct_unobjectify may shed some
light on this.
On Friday, February 14, 2014 10:56:05 AM UTC-5, chotu s wrote:
Thanks a “lot” guys , I’ll read all the suggestions and links
tomorrow(as it is late here) and will ask related question after that.
Regarding stack allocation , what I had in mind was small size and
temporary arrays whose size is known at compile time , some thing like val
v = make_local_vector_n(n) , where n is known at compile time.
I think stack allocation idea came to me from the udacity parallel
programming competition where allocating main memory on gpu was costly(if I
remember correctly) , but they had different types of memory layer so one
can also use the fast shared memory whose capacity ranged from 64K to
256K(subject to correction).
Actually, most people do not realize that a real danger with alloca is
that tail-recursion,
which should be done in constant space, may easily cause
stack-overflow when it is coupled
with stack-allocation. The issue is very similar to inlining a
function that calls alloca.
On Friday, February 14, 2014 10:09:12 AM UTC-5, Brandon Barker wrote:
Thanks, also here’s some related discussion http://stackoverflow.com/
questions/1018853/why-is-alloca-not-considered-good-practice.
On Feb 14, 2014 9:43 AM, “gmhwxi” gmh...@gmail.com wrote:
You can use alloca to allocate memory on stack at run-time.
Here is an example I did:
On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a, n), then
the size (of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big point
in having dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean
allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors
in ats. If anyone can quickly go through it (whenever they get free time)
and comment on the points below will be great. I have tried the code to be
similar to examples given in “Effective ATS” .
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/3b808393-f696-4513-b065-f978e68e751b% 40googlegroups.com.
The functions qstruct_objectify and qstruct_unobjectify may shed some
light on this.
On Friday, February 14, 2014 10:56:05 AM UTC-5, chotu s wrote:
Thanks a “lot” guys , I’ll read all the suggestions and links
tomorrow(as it is late here) and will ask related question after that.
Regarding stack allocation , what I had in mind was small size and
temporary arrays whose size is known at compile time , some thing like val
v = make_local_vector_n(n) , where n is known at compile time.
I think stack allocation idea came to me from the udacity parallel
programming competition where allocating main memory on gpu was costly(if I
remember correctly) , but they had different types of memory layer so one
can also use the fast shared memory whose capacity ranged from 64K to
256K(subject to correction).
Actually, most people do not realize that a real danger with alloca
is that tail-recursion,
which should be done in constant space, may easily cause
stack-overflow when it is coupled
with stack-allocation. The issue is very similar to inlining a
function that calls alloca.
On Friday, February 14, 2014 10:09:12 AM UTC-5, Brandon Barker wrote:
On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a, n),
then the size (of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big
point in having dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean
allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for
vectors in ats. If anyone can quickly go through it (whenever they get free
time) and comment on the points below will be great. I have tried the code
to be similar to examples given in “Effective ATS” .
I want to know how to allocate the vector on a stack
instead on a heap
I want to know is vector_add function ok ?
Is this how one would go about programming in ATS2
Any further comment is also welcome
Thanks
–
You received this message because you are subscribed to the
Google Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from
it, send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-lan…@googlegroups.
com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/2c3bcbb2-ca
d6-46da-956c-b0da4c129450%40googlegroups.com.
–
You received this message because you are subscribed to the
Google Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from
it, send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-lan…@googlegroups.
com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAAZxu4zZHW
YAW2AD8sU6VVdsQ7Fk%3DGbG81JdpMV5ZYPzYurAsg%40mail.gmail.com.
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/3b808393-f696-4513-b065-f978e68e751b% 40googlegroups.com.
The functions qstruct_objectify and qstruct_unobjectify may shed
some light on this.
On Friday, February 14, 2014 10:56:05 AM UTC-5, chotu s wrote:
Thanks a “lot” guys , I’ll read all the suggestions and links
tomorrow(as it is late here) and will ask related question after that.
Regarding stack allocation , what I had in mind was small size and
temporary arrays whose size is known at compile time , some thing like val
v = make_local_vector_n(n) , where n is known at compile time.
I think stack allocation idea came to me from the udacity parallel
programming competition where allocating main memory on gpu was costly(if I
remember correctly) , but they had different types of memory layer so one
can also use the fast shared memory whose capacity ranged from 64K to
256K(subject to correction).
Actually, most people do not realize that a real danger with
alloca is that tail-recursion,
which should be done in constant space, may easily cause
stack-overflow when it is coupled
with stack-allocation. The issue is very similar to inlining a
function that calls alloca.
On Friday, February 14, 2014 10:09:12 AM UTC-5, Brandon Barker wrote:
On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a, n),
then the size (of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big
point in having dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean
allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for
vectors in ats. If anyone can quickly go through it (whenever they get free
time) and comment on the points below will be great. I have tried the code
to be similar to examples given in “Effective ATS” .
I want to know how to allocate the vector on a stack
instead on a heap
I want to know is vector_add function ok ?
Is this how one would go about programming in ATS2
Any further comment is also welcome
Thanks
–
You received this message because you are subscribed to the
Google Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from
it, send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-lan…@googlegroups.
com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/2c3bcbb2-ca
d6-46da-956c-b0da4c129450%40googlegroups.com.
–
You received this message because you are subscribed to the
Google Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from
it, send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-lan…@googlegroups.
com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAAZxu4zZHW
YAW2AD8sU6VVdsQ7Fk%3DGbG81JdpMV5ZYPzYurAsg%40mail.gmail.com.
I don’t think I need a implementation of vector_make_ngc to compile the
code , I only want it to type check , but correct me if I am wrong.On Tue, Feb 18, 2014 at 7:24 PM, Brandon Barker brandon...@gmail.comwrote:
The functions qstruct_objectify and qstruct_unobjectify may shed some
light on this.
On Friday, February 14, 2014 10:56:05 AM UTC-5, chotu s wrote:
Thanks a “lot” guys , I’ll read all the suggestions and links
tomorrow(as it is late here) and will ask related question after that.
Regarding stack allocation , what I had in mind was small size and
temporary arrays whose size is known at compile time , some thing like val
v = make_local_vector_n(n) , where n is known at compile time.
I think stack allocation idea came to me from the udacity parallel
programming competition where allocating main memory on gpu was costly(if I
remember correctly) , but they had different types of memory layer so one
can also use the fast shared memory whose capacity ranged from 64K to
256K(subject to correction).
Actually, most people do not realize that a real danger with alloca
is that tail-recursion,
which should be done in constant space, may easily cause
stack-overflow when it is coupled
with stack-allocation. The issue is very similar to inlining a
function that calls alloca.
On Friday, February 14, 2014 10:09:12 AM UTC-5, Brandon Barker wrote:
On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a, n),
then the size (of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big point
in having dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean
allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for
vectors in ats. If anyone can quickly go through it (whenever they get free
time) and comment on the points below will be great. I have tried the code
to be similar to examples given in “Effective ATS” .
I want to know how to allocate the vector on a stack
instead on a heap
I want to know is vector_add function ok ?
Is this how one would go about programming in ATS2
Any further comment is also welcome
Thanks
–
You received this message because you are subscribed to the
Google Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from
it, send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-lan…@googlegroups.
com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/2c3bcbb2-ca
d6-46da-956c-b0da4c129450%40googlegroups.com.
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/3b808393-f696-4513-b065-f978e68e751b% 40googlegroups.com.
In general, if the index n occurs in the type vector(a, n), then the size
(of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big point in having
dependent types is to allow a vector
and its size information to be stored separately.On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors in ats. If
anyone can quickly go through it (whenever they get free time) and comment
on the points below will be great. I have tried the code to be similar to
examples given in “Effective ATS” .
Thanks a “lot” guys , I’ll read all the suggestions and links tomorrow(as
it is late here) and will ask related question after that.
Regarding stack allocation , what I had in mind was small size and
temporary arrays whose size is known at compile time , some thing like val
v = make_local_vector_n(n) , where n is known at compile time.
I think stack allocation idea came to me from the udacity parallel
programming competition where allocating main memory on gpu was costly(if I
remember correctly) , but they had different types of memory layer so one
can also use the fast shared memory whose capacity ranged from 64K to
256K(subject to correction).
Thanks for great suggestions.On Fri, Feb 14, 2014 at 8:50 PM, gmhwxi gmh...@gmail.com wrote:
Actually, most people do not realize that a real danger with alloca is
that tail-recursion,
which should be done in constant space, may easily cause stack-overflow
when it is coupled
with stack-allocation. The issue is very similar to inlining a function
that calls alloca.
On Friday, February 14, 2014 10:09:12 AM UTC-5, Brandon Barker wrote:
Thanks, also here’s some related discussion http://stackoverflow.com/
questions/1018853/why-is-alloca-not-considered-good-practice.
On Feb 14, 2014 9:43 AM, “gmhwxi” gmh...@gmail.com wrote:
You can use alloca to allocate memory on stack at run-time.
Here is an example I did:
On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a, n), then the
size (of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big point in
having dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean
allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors in
ats. If anyone can quickly go through it (whenever they get free time) and
comment on the points below will be great. I have tried the code to be
similar to examples given in “Effective ATS” .
I want to know how to allocate the vector on a stack instead
on a heap
I want to know is vector_add function ok ?
Is this how one would go about programming in ATS2
Any further comment is also welcome
Thanks
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/2c3bcbb2-cad6-46da-956c-b0da4c129450%40go oglegroups.com.
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/CAAZxu4zZHWYAW2AD8sU6VVdsQ7Fk%3DGbG81JdpM
V5ZYPzYurAsg%40mail.gmail.com.
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/57f1a0bb-f0ba-4a06-95b3-15f988245530% 40googlegroups.com.
The functions qstruct_objectify and qstruct_unobjectify may shed
some light on this.
On Friday, February 14, 2014 10:56:05 AM UTC-5, chotu s wrote:
Thanks a “lot” guys , I’ll read all the suggestions and links
tomorrow(as it is late here) and will ask related question after that.
Regarding stack allocation , what I had in mind was small size
and temporary arrays whose size is known at compile time , some thing like
val v = make_local_vector_n(n) , where n is known at compile time.
I think stack allocation idea came to me from the udacity
parallel programming competition where allocating main memory on gpu was
costly(if I remember correctly) , but they had different types of memory
layer so one can also use the fast shared memory whose capacity ranged from
64K to 256K(subject to correction).
Actually, most people do not realize that a real danger with
alloca is that tail-recursion,
which should be done in constant space, may easily cause
stack-overflow when it is coupled
with stack-allocation. The issue is very similar to inlining a
function that calls alloca.
On Friday, February 14, 2014 10:09:12 AM UTC-5, Brandon Barker wrote:
On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a,
n), then the size (of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big
point in having dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you
mean allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for
vectors in ats. If anyone can quickly go through it (whenever they get free
time) and comment on the points below will be great. I have tried the code
to be similar to examples given in “Effective ATS” .
–
You received this message because you are subscribed to the
Google Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from
it, send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-lan…@googlegroups.
com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/57f1a0bb-f0
ba-4a06-95b3-15f988245530%40googlegroups.com.
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/CAAZxu4xy1fbQVOEusuYegR4_
oirETTL6k-9JRxGCrYKpUvF9VA%40mail.gmail.com.
Actually, most people do not realize that a real danger with alloca is that
tail-recursion,
which should be done in constant space, may easily cause stack-overflow
when it is coupled
with stack-allocation. The issue is very similar to inlining a function
that calls alloca.On Friday, February 14, 2014 10:09:12 AM UTC-5, Brandon Barker wrote:
On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a, n), then the
size (of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big point in
having dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors in
ats. If anyone can quickly go through it (whenever they get free time) and
comment on the points below will be great. I have tried the code to be
similar to examples given in “Effective ATS” .
I want to know how to allocate the vector on a stack instead on
a heap
I want to know is vector_add function ok ?
Is this how one would go about programming in ATS2
Any further comment is also welcome
Thanks
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/2c3bcbb2-cad6-46da-956c-b0da4c129450% 40googlegroups.com.
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/CAAZxu4zZHWYAW2AD8sU6VVdsQ7Fk%
3DGbG81JdpMV5ZYPzYurAsg%40mail.gmail.com.
The functions qstruct_objectify and qstruct_unobjectify may shed
some light on this.
On Friday, February 14, 2014 10:56:05 AM UTC-5, chotu s wrote:
Thanks a “lot” guys , I’ll read all the suggestions and links
tomorrow(as it is late here) and will ask related question after that.
Regarding stack allocation , what I had in mind was small size and
temporary arrays whose size is known at compile time , some thing like val
v = make_local_vector_n(n) , where n is known at compile time.
I think stack allocation idea came to me from the udacity parallel
programming competition where allocating main memory on gpu was costly(if I
remember correctly) , but they had different types of memory layer so one
can also use the fast shared memory whose capacity ranged from 64K to
256K(subject to correction).
Actually, most people do not realize that a real danger with
alloca is that tail-recursion,
which should be done in constant space, may easily cause
stack-overflow when it is coupled
with stack-allocation. The issue is very similar to inlining a
function that calls alloca.
On Friday, February 14, 2014 10:09:12 AM UTC-5, Brandon Barker wrote:
On Friday, February 14, 2014 12:52:16 AM UTC-5, gmhwxi wrote:
In general, if the index n occurs in the type vector(a, n),
then the size (of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big
point in having dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean
allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for
vectors in ats. If anyone can quickly go through it (whenever they get free
time) and comment on the points below will be great. I have tried the code
to be similar to examples given in “Effective ATS” .
–
You received this message because you are subscribed to the
Google Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from
it, send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-lan…@googlegroups.
com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAAZxu4zZHW
YAW2AD8sU6VVdsQ7Fk%3DGbG81JdpMV5ZYPzYurAsg%40mail.gmail.com.
–
You received this message because you are subscribed to the
Google Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from
it, send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-lan…@googlegroups.
com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/57f1a0bb-f0
ba-4a06-95b3-15f988245530%40googlegroups.com.
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/58c3c8d5-3127-4979-bd72-728e60714c4d% 40googlegroups.com.
–
You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/ats-lang-users/CAAZxu4xy1fbQVOEusuYegR4_
oirETTL6k-9JRxGCrYKpUvF9VA%40mail.gmail.com.
So how do I determine the number of elements in arrayptr array.
One way I think I could determine the total size in bytes of an array and
then divide size of individual type , but how do I do this ?
Or you are asking to pass “n” the size of vector to functions that need it.
ThanksOn Fri, Feb 14, 2014 at 11:22 AM, gmhwxi gmh...@gmail.com wrote:
In general, if the index n occurs in the type vector(a, n), then the size
(of the type int(n)) should not be
stored inside a vector (of the type vector(a, n)). A big point in having
dependent types is to allow a vector
and its size information to be stored separately.
On Friday, February 14, 2014 12:39:37 AM UTC-5, gmhwxi wrote:
When you say ‘allocate the vector on a stack’, do you mean allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors in ats.
If anyone can quickly go through it (whenever they get free time) and
comment on the points below will be great. I have tried the code to be
similar to examples given in “Effective ATS” .
That is I have abstract type vector and when I create a vector the amount
of space need to store its content is taken from stack instead of heap. I
want something like this :
val vect = make_local_vector_of_size_n (n)
I assume that this will be again implementation dependent right ?On Fri, Feb 14, 2014 at 11:09 AM, gmhwxi gmh...@gmail.com wrote:
When you say ‘allocate the vector on a stack’, do you mean allocating
the arrayptr on stack?
On Thursday, February 13, 2014 11:20:33 PM UTC-5, chotu s wrote:
For review purpose I have written a very tiny code for vectors in ats. If
anyone can quickly go through it (whenever they get free time) and comment
on the points below will be great. I have tried the code to be similar to
examples given in “Effective ATS” .