abmclin
2018-10-8 16:20:16

Can I add another raise-argument-error function that takes an extra bad-arg-name argument so the programmer can specify which argument is being referred to when an argument error exception is raised? I’d like to be able to clearly refer to the name of an argument in a uniform format consistent with the format of the error messages raised by the other two raise-argument-error functions.

raise-arguments-error offers something similar in that you can specify which argument fields are involved but the error message format is not the same as raise-argument-error which is undesirable from my point of view.


leif
2018-10-8 17:18:58

@mflatt Why is the backing type of _enum _ufixint? When the c spec states that it’s _int?


leif
2018-10-8 17:19:17

(Section 6.4.4.3: “An identifier declared as an enumeration constant has type int”)


krismicinski
2018-10-8 18:27:04

this is perhaps a super naive question, but if i want to build a parallel app, what’s the state of this in racket? I believe the GC is not thread friendly, and I don’t think the move to chez will make that any easier


samth
2018-10-8 18:27:56

@krismicinski if what you want is to execute two separate computations that don’t share much, then places work pretty well


samth
2018-10-8 18:28:12

this is how parallel builds and background expansion work


krismicinski
2018-10-8 18:28:19

cool, thanks


samth
2018-10-8 18:28:33

if what you want is shared memory parallelism then the support is not very good


krismicinski
2018-10-8 18:28:59

Yeah, I’m thinking of moving one of our symbolic executors to racket. Threads don’t really need to communicate much at all, since they are forking off and doing various amounts of work in a pool, but coordinating them will require some thought no matter what


samth
2018-10-8 18:29:30

that sounds like something that would work fine


krismicinski
2018-10-8 18:29:44

places is, I assume, a library


krismicinski
2018-10-8 18:29:58

yup, ok, great, will look into this


krismicinski
2018-10-8 18:30:50

yes, this looks exactly like what I wanted. Basically a scheduler needs to be able to talk to some number of worker threads.


pocmatos
2018-10-8 18:31:45

@krismicinski but if you want heave parallelism, you might want to look elsewhere. places break when you issue over 16 or so in the same machine. By break here I mean that they start spending too much time dealing with memory locking in the kernel.


pocmatos
2018-10-8 18:32:13

I am just working on a library to solve this…


krismicinski
2018-10-8 18:32:24

sorry, my apologies, but what is heave parallelism?


krismicinski
2018-10-8 18:32:40

and yes, I can imagine that things scale sub-linearly because of these coordination vagaries..


krismicinski
2018-10-8 18:32:49

really for what we’re doing, even something like 5–10 tasks would be fine


krismicinski
2018-10-8 18:33:11

but we’d like something robust for the future. My guess is that the right architecture would be agnostic to the particulars of implementation.


pocmatos
2018-10-8 18:33:29

lexi.lambda
2018-10-8 18:33:30

the intent of places is that you only create at most one per core and schedule tasks over the pool, not that you spawn one per task


krismicinski
2018-10-8 18:33:56

@lexi.lambda that’s even better!


pocmatos
2018-10-8 18:34:12

@lexi.lambda true, but if your machine has 96 cores, places are not so good.


samth
2018-10-8 18:34:18

places scale ok for a big-desktop size machine, but poorly for really big machines


pocmatos
2018-10-8 18:34:20

assuming you’re trying to use them all.


lexi.lambda
2018-10-8 18:34:25

yes, I would believe that


pocmatos
2018-10-8 18:34:26

@samth +1


krismicinski
2018-10-8 18:34:40

right, we just have a 20-core machine and want our symbolic executor to be not-so-obviously-naive


krismicinski
2018-10-8 18:35:12

it’s a super parallelizable problem: fork at various points, explore source, listen to a scheduler to decide what to explore next.


samth
2018-10-8 18:36:53

@krismicinski right, a lot like a build system, which works decently well


samth
2018-10-8 18:37:12

I think there’s a job queue pkg already somewhere


pocmatos
2018-10-8 18:37:27

@krismicinski I would start architecting it with places and see how far you can go.


krismicinski
2018-10-8 18:37:48

yeah, I think you are both right


krismicinski
2018-10-8 18:38:35

okay, basically I was trying to figure out: if I rewrite this in racket, is it going to be basically impossible to scale at all. The state of our ocaml implementation is also not so promising, since ocaml does not have a good concurrency story (not terrible either, but not super friendly)


pocmatos
2018-10-8 18:38:36

Didn’t know about the pkg @samth mentioned. Take a look at it first then. :slightly_smiling_face:


pocmatos
2018-10-8 18:39:03

@krismicinski it will scale… I wouldn’t worry so much about that.


samth
2018-10-8 18:39:17

I was thinking of job-queue, but that’s just plain threads


samth
2018-10-8 18:39:27

might make the job a bit easier, though


pocmatos
2018-10-8 18:39:50

@krismicinski just running a racket application on a 96 core, 386gb ram machine. Works great!


krismicinski
2018-10-8 18:39:51

My guess is that the main issue will just be figuring out the right job queue abstraction at a high level, and after that using places should not be so bad


krismicinski
2018-10-8 18:39:59

that’s awesome!!!


samth
2018-10-8 18:40:19

samth
2018-10-8 18:40:30

which has a job queue that uses places


samth
2018-10-8 18:41:22

@pocmatos how does your new library compare to using distributed places?


pocmatos
2018-10-8 18:42:07

@samth by distributed you mean over several machines?


pocmatos
2018-10-8 18:42:27

that’s not implemented yet but it’s doable and I will surely want to do it.


samth
2018-10-8 18:42:28

i mean using the distributed-places library (perhaps connecting to the local machine)


pocmatos
2018-10-8 18:42:53

ah, you mean using distributed places but on the localhost?


samth
2018-10-8 18:42:56

yeah


krismicinski
2018-10-8 18:43:18

yeah, this looks helpful, sam


pocmatos
2018-10-8 18:43:47

Haven’t compared yet, but it’s definitely more straightforward to use since you don’t need to worry about nodes. It’s mostly the places API but using processes underneath.



krismicinski
2018-10-8 18:44:17

This looks highly relevant


mflatt
2018-10-8 18:46:13

I’m not sure what it would mean to specify the “name” of an argument, since arguments don’t really have names at run time. But it would certainly make sense to have some descriptive text about the argument’s role.


pocmatos
2018-10-8 18:47:26

@samth interestingly I found @mflatt tried something along these lines before in https://github.com/racket/racket/blob/master/pkgs/racket-benchmarks/tests/racket/benchmarks/places/place-processes.rkt


samth
2018-10-8 18:47:46

also I think there’s now a build system option for process-based places


pocmatos
2018-10-8 18:48:24

I have taken that and structured it into a package but I had about half a day to work on it, so not really stable or anything but it’s here:



samth
2018-10-8 18:48:33


samth
2018-10-8 18:49:09

yeah i saw that when i searched for the pkg that didn’t exist that I thought I remembered :slightly_smiling_face:


krismicinski
2018-10-8 18:50:22

this distributed places stuff looks really nice


krismicinski
2018-10-8 18:50:35

seems not so dissimilar to a better MPI


mflatt
2018-10-8 18:52:38

I don’t know why Eli originally make it _ufixint. Probably he wqas mostly looking at uses that count from 0.


abmclin
2018-10-8 18:53:18

What I mean by name of an argument; suppose we have (define (foo argA argB argC) ...) that does checking on argA argB and argC and uses raise-argument-error to inform users of any bad arguments. If argA is bad, I want to be able to have the name argA be mentioned in the error message. Right now the only options is to either mention the expected contract and the given value, or also specify which argument by position numbering.


abmclin
2018-10-8 18:54:03

Often in function’s documentation, names are given to arguments so I was thinking it would be nice to be able to relate error messages to the documented argument names


abmclin
2018-10-8 18:54:15

or formal arguments?


abmclin
2018-10-8 18:59:05

Borrowing the example from https://docs.racket-lang.org/reference/exns.html?q=directory#%28def._%28%28quote._~23~25kernel%29._raise-argument-error%29%29

(define (feed-machine bits) (if (not (integer? bits)) (raise-argument-error 'feed-machine "integer?" bits) "fed the machine"))

if bad argument is given for bits will produce

feed-machine: contract violation expected: integer? given: ’turkey`

I’d like the error message to instead say

feed-machine: contract violation expected: integer? given: ’turkey argument: bits


abmclin
2018-10-8 18:59:38

I realize it may seem pedantic but when dealing with functions with multiple arguments, it’s helpful to know which argument is bad :slightly_smiling_face:


pocmatos
2018-10-8 19:00:20

@samth Here’s a comparison between places and my library on a 64core machine… for places, we already know (as posted on the mailing list) but again:


pocmatos
2018-10-8 19:00:48

pocmatos
2018-10-8 19:01:00

with loci-dev:


pocmatos
2018-10-8 19:01:15

pocmatos
2018-10-8 19:01:24

So, hey I am happy. :slightly_smiling_face:


krismicinski
2018-10-8 19:01:48

wow..


pocmatos
2018-10-8 19:03:46

Also, starting the places takes quite awhile. Each new place past the first 20 takes just slightly longer than the previous one while the processes are launched instantaneously because subprocess is asynchronous and all of them come up pretty much instantaneously.


pocmatos
2018-10-8 19:04:12

I will write to the mailing list on this to give a closure to the issue but it’s looking good.


pocmatos
2018-10-8 19:06:17

I keep being amazed at how far Racket can take you with just a few hours work. Thursday during the mailing list discussion, I told my wife : hey this library will probably take me a week to write. After I found @mflatt start on places as processes I revised that to 2 days. When I told her today at lunch time that it was working, she couldn’t believe it. I told her… hey, that’s racket for you. :slightly_smiling_face:


pocmatos
2018-10-8 19:07:20

Tomorrow I will move my system to using loci-dev so I can dogfood myself.


pocmatos
2018-10-8 19:07:47

For now it’s (late) dinner time on this side of the world. See you tomorrow.


abmclin
2018-10-8 19:08:08

thanks @pocmatos for the report, it’s really cool!


soegaard2
2018-10-8 19:08:33

dreads how much a 64 core machine would cost


soegaard2
2018-10-8 19:11:23

notes that his favourite price comparison site has from 2–14 cores. Fourteen? Pathetic!


krismicinski
2018-10-8 19:19:19

I just get my friend to loan me their machine


krismicinski
2018-10-8 19:21:52

yeah, I feel pretty promising about this. I have a kind of mess of ocaml code implementing this I’d like rebuild in ocaml


mflatt
2018-10-8 19:47:59

I’m guessing that you’ve noticed that raise-argument-error supports reporting which argument is bad in terms of an argument position, as long as you also supply the other arguments (to include those other argument in the error message, too). But it’s not very convenient. I view the names of formal arguments to be the implementation’s business and not exposed to callers, much like the body of the function. I also think of argument names in documentation as being specific to the documentation, and not something with a run-time instantiation. That is, if I rename the argument in the documentation, I would not expect that to imply an implementation change. And not all arguments have sensible names outside of documentation, such as the arguments to +. So that’s why I’m pushing back on the notion of an argument “name”. But I think an optional “role description” for an argument is sensible and general.


abmclin
2018-10-8 20:09:38

That makes sense and convinces me it’s a bad idea to reply on argument names which is too implementation dependent. An optional “role description” would be nice to have, the current raise-argument-error can be extended to have the extra optional argument instead of creating an entire new variant.


isomorphisms
2018-10-9 06:06:11

@isomorphisms has joined the channel