Giter Club home page Giter Club logo

Comments (17)

ahans avatar ahans commented on May 26, 2024 2

Put me down for yacht. I will probably get around to implement something next week.

from c.

siebenschlaefer avatar siebenschlaefer commented on May 26, 2024 1

I've given the zebra-puzzle a shot (#959)

from c.

ahans avatar ahans commented on May 26, 2024 1

I also gave rotational-cipher a shot: #975

from c.

ahans avatar ahans commented on May 26, 2024 1

Alright, implementing bank-account without the parallel aspect is probably fine. That's what the Python track does. The C++ track expects proper locking and has a test that spawns multiple threads, so chances are without locking this will fail. That's at least somewhat easily testable. We could do the same in C, no matter how we implement this.

parallel-letter-frequency, on the other hand, without parallel processing would be quite boring. And also IMHO be against the spirit of the exercise. After all, it has "parallel" in the name! Some tracks (e.g., Python) explicitly don't want this exercise implemented. I implemented this exercise for the C++ track. To experiment with the performance aspect of the parallelism, it's nice to provide a benchmark students can run locally. For the test runner, we settled on having that only check the correctness of the result, but doing the actual computation sequentially. However, that led to confusion about solutions passing that would actually fail with true parallel execution. So I'd say we should make sure that the experience working locally is as similar as possible to what the online test runner does.

Does the test library support this in a a native way? (Or if we code the tests using the same practices as the implementation, do we risk "giving the game away" too much)

I don't believe the test library has any support for this. But it also doesn't need much. For bank-account, we would manually spawn a couple of threads to call functions in parallel. The student has to implement proper locking, but not create any threads themselves. So except for the library that is used for multithreading the test wouldn't give away much. For parallel-letter-frequency, you wouldn't see anything special in the tests, because all the parallel processing needs to be implemented by the student.

Will the library chosen make the tests or example implementation platform-dependent?

When we go with pthreads, we would be limited to POSIX platforms. For native Windows, one would have to use native Windows threads. However, the makefiles we currently use make things somewhat platform-dependent already, since MSVC wouldn't understand the flags used in there. The documentation suggests to use WSL2 when working under Windows. So there pthreads would work just fine.

The only option I'm aware of that works natively on Windows (with MSVC) is OpenMP. I have used OpenMP pragmas in C++ code. That's much less low level than pthreads and would be similar in spirit to what you do in C++17 with parallel algorithms. However, I think I would find manual thread management more appropriate for a C exercise. I think that's also what the Rust example does: divide the texts into a number of blocks and have a worker thread for each block.

Is there some way to ensure that the submitted implementations are using parallelism rather than just a good sequential implementations?

For bank-account, the parallelism would come from the test. Without proper locking, the test would fail. So that's fairly easy to ensure. For parallel-letter-frequency, on the other hand, I don't see any option (just like the other tracks, they all only test for correctness; so also a sequential implementation would pass).

from c.

ryanplusplus avatar ryanplusplus commented on May 26, 2024

Thanks for the heads up. I'll pick up some as I get time. If anyone would like to grab one, please leave a note here first so that no one else starts work on the same exercise.

from c.

ahans avatar ahans commented on May 26, 2024

I will try to contribute kindergarten-garden.

from c.

ryanplusplus avatar ryanplusplus commented on May 26, 2024

I'm going to grab spiral-matrix

from c.

ryanplusplus avatar ryanplusplus commented on May 26, 2024

I'm also going to grab protein-translation

from c.

siebenschlaefer avatar siebenschlaefer commented on May 26, 2024

I'm also going to grab protein-translation

Somebody on the forum wanted to help with that. Although they didn't reply in the last two days.

from c.

ryanplusplus avatar ryanplusplus commented on May 26, 2024

I'm also going to grab protein-translation

Somebodyon the forum wanted to help with that. Although they didn't reply in the last two days.

Thanks for the heads up. I'll give them another few days to respond.

from c.

ahans avatar ahans commented on May 26, 2024

Opened a PR for pop-count as well since it was so trivial.

from c.

ryanplusplus avatar ryanplusplus commented on May 26, 2024

I'm going to grab knapsack

from c.

ahans avatar ahans commented on May 26, 2024

This was quicker than expected: #972

from c.

ahans avatar ahans commented on May 26, 2024

Feel free to also put me down for dnd-character and food-chain.

from c.

ahans avatar ahans commented on May 26, 2024

About parallel-letter-frequency and bank-account, I wonder what approaches we want to support there, since both are about some form of parallelism and there's nothing in the C standard (library) to support this. pthreads would probably be the most natural, but OpenMP could also be an option? The latter would also work natively on Windows with MSVC, although the instructions about working locally sound like we don't want to support this anyways. What do you think?

from c.

wolf99 avatar wolf99 commented on May 26, 2024

About parallel-letter-frequency and bank-account, I wonder what approaches we want to support there, since both are about some form of parallelism and there's nothing in the C standard (library) to support this. pthreads would probably be the most natural, but OpenMP could also be an option? The latter would also work natively on Windows with MSVC, although the instructions about working locally sound like we don't want to support this anyways. What do you think?

Threading is not really in my wheelhouse so I have more questions than answers 😄
I will point out first that the paralllel aspect of the exercises is not mandatory (the spec for bank-account talks about this specifically), so one option is to implement them without the parallelism.
If we do add parallelism...

  • Does the test library support this in a a native way? (Or if we code the tests using the same practices as the implementation, do we risk "giving the game away" too much)
  • Will the library chosen make the tests or example implementation platform-dependent?
  • Is there some way to ensure that the submitted implementations are using parallelism rather than just a good sequential implementations?
  • etc...

from c.

wolf99 avatar wolf99 commented on May 26, 2024

Sounds good @ahans !

from c.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.