Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Elliot Ronaghan
    @ronawho
    Oh, yeah I had forgotten about that, even though I'm the one who removed the last references to that in chapel-lang/chapel#13426
    Tom Westerhout
    @twesterhout:matrix.org
    [m]
    Is there a user-facing lock class? E.g. list uses ChapelLocks.chpl_LocalSpinLock, but it looks like an internal thing. I guess I can implement my own using sync variables, but are there no predefined ones?
    Elliot Ronaghan
    @ronawho
    Nothing user-facing today, but chapel-lang/chapel#9881 requests that. You could use the internal module ChapelLocks (but no guarantees about stability). Beyond that using a sync or atomic is your best bet.
    1 reply
    Tom Westerhout
    @twesterhout:matrix.org
    [m]
    Okay, thanks!
    Tiago Carneiro
    @tcarneirop
    Hello everyone. I've got a question about records. I would like to declare a variable var best_sol: Solutionjust to use it to keep the best solution afterwards. However, it calls the init() method. Is there a way to declare a var of a record type without calling the init() method? Thanks!
    Brad Chamberlain
    @bradcray
    @tcarneirop : Unfortunately not—today, records must be initialized. Classes can be declared without being initialized by virtue of the fact that a class variable is really a pointer to an object (so can be made ‘nil’ rather than creating an object), but of course that comes with a bunch of other things as well, which you may or may not want (different memory layout, memory management styles, etc.). What is it about your record’s init() that causes you not to want it to be called? (i.e., can it just be re-assigned later?)
    Tiago Carneiro
    @tcarneirop
    @bradcray hello, Brad, thank you. The problem is that the init solves a problem, which might take long time. I tried to use it as a class but I faced some problems (dont rememer now)
    so I gave up and continue to use the registers
    @bradcray in my example I have to create 4 solutions to run a metaheuristic. So I found it strange that I saw the output of the problem being solved
    Brad Chamberlain
    @bradcray
    Would it be an option to move the logic in the init into another method like .solveProblem() and have the initializer be more of a no-op or simple initializer?
    Elliot Ronaghan
    @ronawho
    Can you create a new initializer that skips the setup and do something like: var best_sol = new Solution(skipExpensiveWhatever=true)
    Tiago Carneiro
    @tcarneirop
    @bradcray @ronawho thanks! Yes, I created the default init() empty., Another question. If I do something like this var best_sol: Solution = initial_solution; -- in this case, do I call init() for best_sol?
    Brad Chamberlain
    @bradcray
    You’d want to create a copy initializer which has a signature of proc init=(rhs: Solution) { … } to handle that case. The body should be very similar to a normal initializer, but should initialize the this object’s fields using the rhs object’s (or some people call the rhs ‘other’ instead).
    Tiago Carneiro
    @tcarneirop
    Ah, the question was -- if I do var best_sol: Solution = initial_solution;do I perform a copy or does it, before performing the copy, calls init()?
    btw, can I do something like sol_A = sol_Bin Chapel? I'm doing this but maybe I'm doing something wrong
    In the result I'm expecting, sol_A members receive the values of sol_B
    Brad Chamberlain
    @bradcray
    If you do var best_sol: Solution = initial_solution; you can almost think of that as calling var best_sol = Solution.init=(initial_solution);, with the almost being that init= doesn’t return a new Solution object, it just fills in the implicit one that this refers to. So it’s really more like:
    var best_solution: Solution = DONT_INITIAILIZE_ME_CHAPEL;
    best_solution.init=(initial_solution);
    You can do sol_A = sol_B which will call operator =(ref lhs: Solution, rhs: Solution) (which you can define yourself, or if you don’t, the compiler will define one for you that will assign each field from sol_B to sol_A).
    Tiago Carneiro
    @tcarneirop
    @bradcray I got it! Thank you!
    =)
    Brad Chamberlain
    @bradcray
    :+1:
    Tom Westerhout
    @twesterhout:matrix.org
    [m]

    I've noticed the following function in the code Louis has linked:

      // Returns a reference to the array
      pragma "no copy return"
      proc toArray() {
        return arr[0..#sz];
      }

    Are pragma directives an internal thing? Or are there resources where I can learn about it?

    14 replies
    Tom Westerhout
    @twesterhout:matrix.org
    [m]

    How can one use noinit with an array of arrays? If I have

      var globalBuffer : [OnePerLocale] [0 .. numberVectors - 1, 0 .. maxCountPerLocale - 1] eltType;

    how to I tell Chapel not to fill globalBuffer with zeros?

    33 replies
    asianintel
    @asianintel:matrix.org
    [m]
    Is there a sort of example for interfacing with Fortran? I read the Fortran interoperability on the docs, but I'm clearly doing something wrong, getting an undefined function reference. (I've also never worked with Fortran 😓)
    6 replies
    Louis Jenkins
    @LouisJenkinsCS
    Question: Chapel's HDF5 module invokes the native HDF5 library, but is the native HDF5 library optimized for Lustre filesystems? I'm asking because when using Arkouda on the LANL dataset and with the I/O benchmark, I'm seeing some really long times for readAllHdf. See: https://share.streamlit.io/louisjenkinscs/streamlit-playground/create_timeline.py - It shows a timeline of how long each operation. I would like to find an explanation for the performance here. (Also, consistently, the first readAllHdf operation is significantly slower than the subsequent ones, why is that?) Swan seems to have 10 GB/s network speeds, but I'm seeing significantly less than that. Is there a way to speed this up? Also which module is faster, cray-hdf5 or cray-hdf5-parallel; I'm assuming the 'parallel' version has some additional synchronization mechanisms in place in case you want to write to the same HDF5 file from multiple threads/locales, or does it speed it up because all I/O is done in parallel behind-the-scenes?
    12 replies
    Thomas Rolinger
    @thomasrolinger
    I'm taking the BlockDist module and customizing it a bit for an optimization. I'm slowly making my way through the class hierarchy in here, but I'm having trouble with the following: I'd like to associate some flags with a block-distributed array I create (i.e., var A = newMyBlockArr(..)), such that I can do something like A.myFlag = .. within my code. Is that possible, and if so, which class should I be adding these flags to? I guess a higher level question is when I say A.something in my code, which class within BlockDist is being accessed? For reference, I can add them to the BlockArr class and access them as intended, but from what I can tell, there will be per-locale versions of the flags. Ideally, I'd have a single set that is associate with the entire array/distribution.
    Engin Kayraklioglu
    @e-kayrakli
    You need to add that to BlockArr class. A.something is resolved on record _array in ChapelArray.chpl. That record provides the unified interface to all Chapel arrays. Then, based on your distribution relevant array implementation’s methods are called. Single “set” is not viable with privatization. We create copies of array instances (implementations) on all locales eagerly at array creation time. This is governed by dsiGetPrivatizeData (?) and dsiPrivatize. You’d want to propagate your new flag through the means of these functions.
    Thomas Rolinger
    @thomasrolinger
    I recall reading about this but can't find it: what is the current status in Chapel of storing function pointers (to Chapel functions, not C)? Specifically, is there a way to have an array "of" functions? The work-around I've used in the past is wrapping the function in its own class. Just wondering if anything has changed since then
    11 replies
    shubhwal56
    @shubhwal56
    I am Shubham Walunj.I heard about chapel language and i genuinely want to work with your community and I will give my best and learn all things which are required. I would love to contribute to your organization but could you please tell me how to get started ?
    Hoping to hear from you soon.
    1 reply
    Thomas Rolinger
    @thomasrolinger
    @shubhwal56 I suspect that most of the Chapel team is off for the holidays, but they often recommend you start here: https://chapel-lang.org/contributing.html
    2 replies
    Louis Jenkins
    @LouisJenkinsCS
    I think I may have identified a compiler generated bug. For some reason, I get a segfault but I see that a loop and also some statements get compiled away because the timer.stop() provides a warning that it is called before a timer.start() despite timer.start() coming right after; the writeln statements are inside of a loop, one before a fread (extern proc) statement and one after, and only the former gets called followed by a segfault, yet the timer.stop() line number is after it in execution order. I wonder if I can make an easy reproducer
    4 replies
    asianintel
    @asianintel:matrix.org
    [m]
    Is there any way to use a reserved keyword as a variable or argument? I'm writing an extern proc and the fortran function I'm trying to interface with has var as one of its arguments. Is there any workaround to this without editing the Fortran code?
    3 replies
    Louis Jenkins
    @LouisJenkinsCS
    Reproduced bug mentioned above: chapel-lang/chapel#18906
    Elliot Ronaghan
    @ronawho
    @LouisJenkinsCS I think I accidentally deleted your comment about libasan as I was trying to reply to it.. but see https://chapel-lang.org/docs/master/developer/bestPractices/Sanitizers.html for info about using ASan. It's in the developer docs and not really a "user-facing" feature, but we've had good success with it
    1 reply
    Louis Jenkins
    @LouisJenkinsCS
    Does anyone know a decent workaround to the above bug? Because I believe I ran into it even when using Chapel's standard IO interface, not just export functions like fread/fwrite
    Brad Chamberlain
    @bradcray
    Hi @LouisJenkinsCS / all — Just as a general announcement, the past week+ was holiday time at HPE and much of the team here took the preceding week off as well, so most people are just getting back into the saddle today after some time off (e.g., I haven’t had time to read about the bug yet, personally, and suspect many others are still in the same boat). Bear with us.
    2 replies
    Bryant C. Lam
    @BryantLam
    Is there a pattern to what env vars I can provide to make to build Chapel such that I can pass through env vars or options to each appropriate or all of the third-partys, compiler, runtime, mason, etc.? For example, I need to supply options to the bundled LLVM and the Makefile was coded so that it could take LDFLAGS. Compiling with make LDFLAGS=blah appeared to work, but other third parties use RUNTIME_LFLAGS (hwloc's Makefile) or ~don't pass it through at all~ (I think gmp's Makefile passes LDFLAGS implicitly). So far, I've seen CHPL_XXX_CFG_OPTIONS, CHPL_XXX_MORE_CFG_OPTIONS, CFLAGS, CXXFLAGS, LDFLAGS, RUNTIME_LFLAGS, CHPL_XXX_CFLAGS, etc.
    1 reply
    Sayan Chaudhuri
    @SayanChaudhur13_twitter
    I am currently working on improving single channel file read in Chapel. Going over the code, I observed that there are several levels of function calls before a chapel program is able to read the contents of the file and store it in some location. So, is there any particular set of steps,that any programming language follow, for reading a file before storing it in some variable ?
    Louis Jenkins
    @LouisJenkinsCS
    I have noticed that the Chapel's IO library hits OOM where glibc does not, is there a way to constrain the amount of memory that the Chapel IO library will use, i.e. in buffering and the like?
    Sayan Chaudhuri
    @SayanChaudhur13_twitter
    @LouisJenkinsCS I do not think so. Would it be possible for you to kindly mention a use case here where the OOM is coming ?
    Louis Jenkins
    @LouisJenkinsCS
    Allocate an array that is about 75% of RAM/available memory, then write that out to a file.
    Or better yet, 50% of RAM
    var memAvail : int(64) = (here.physicalMemory(retType=int(64)) * 0.75):int(64);
    Elliot Ronaghan
    @ronawho
    Are you doing a standard write, or with extra options to mmap things? A reproducer in an issue would probably be easier to reason about
    Louis Jenkins
    @LouisJenkinsCS
    I call writeBytes to write an array of uint(8), it is a straight sequential write. I'll see about making a quick reproducer
    Louis Jenkins
    @LouisJenkinsCS
    image.png
    As a side note, it seems that GitHub Copilot is adapting a bit to Chapel syntax, although I'm not sure if Time.now() is a thing
    Louis Jenkins
    @LouisJenkinsCS

    @ronawho Okay so I tried rewriting the reproducer, I think it started to work fine this time around because I used the IOHINT_SEQUENTIAL hint

    Major difference in overall time though

    Elapsed: 246.306
    Wrote 24940502016 bytes to dummy.bin
    Elapsed: 20.4269
    Wrote 24940502016 bytes to dummy.bin

    Should I create an issue with this?

    Gonna try again with some other IOHINT flags
    Elliot Ronaghan
    @ronawho
    Sure. I don't really understand all the IO hints and in general I do not understand IO performance so I won't be of much help, but it's probably worth capturing in an issue.