Giter Site home page Giter Site logo

shiyanhui / libcsp Goto Github PK

View Code? Open in Web Editor NEW
1.3K 1.3K 72.0 104 KB

A concurrency C library 10x faster than Golang.

Home Page: https://libcsp.dev

License: MIT License

Makefile 1.37% C 75.73% Go 0.53% M4 0.72% C++ 21.66%
c concurrency csp golang libcsp

libcsp's People

Contributors

hojun-cho avatar shiyanhui avatar timgates42 avatar tomstevens9 avatar wincentbalin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libcsp's Issues

Website is down

Website (implicit) is down, null, segafaulted. Also, is this project maintained?

What is the cost of coroutine? Can 8 coroutines run on 8 CPUs at the same time in multicore environment?

CPU Pinning

Will there be any support for CPU pinning? I know it may need some more scheduling extensions, but this would be a very useful need for some sort of workloads where locality inside a NUMA node matters.

Unable to install libcsp

I’m not very familiar with Linux, and not very familiar with “C”, so perhaps the problem is caused by my unfamiliarity.

I believe that I followed the installation instructions, however I was unable to install libcsp. The following are the steps that I took. (No ./configure file) :

  1. On Ubuntu 20.04 LTS.

  2. I ran “sudo apt install gcc- ….” as per the instructions, and that completed OK.

  3. I downloaded libcsp but there was no option for “.tar.gz”, so I used “.zip”, and extracted the download to libcsp-master.

  4. I was unable to run ./configure because it is not in the libcsp directory. The directory contents are as follows:

drwxrwxr-x 2 brian brian 4096 Jul  7 16:39 benchmarks
-rw-rw-r-- 1 brian brian 2083 Jul  7 16:39 configure.ac
drwxrwxr-x 5 brian brian 4096 Jul  7 16:39 docs
drwxrwxr-x 2 brian brian 4096 Jul  7 16:39 examples
-rw-rw-r-- 1 brian brian 1023 Jul  7 16:39 LICENSE
-rw-rw-r-- 1 brian brian 2551 Jul  7 16:39 Makefile.am
drwxrwxr-x 2 brian brian 4096 Jul  7 16:39 plugin
-rw-rw-r-- 1 brian brian  493 Jul  7 16:39 README.md
drwxrwxr-x 2 brian brian 4096 Jul  7 16:39 src
drwxrwxr-x 2 brian brian 4096 Jul  7 16:39 tests
-rw-rw-r-- 1 brian brian    6 Jul  7 16:39 VERSION

  1. I presume that as a consequence, I am unable to run “make” because there is no “Makefile”.

Looking forward to trying libcsp.

Problem compiling

Ubuntu 20.10 (in Virtual Box), gcc-10.

make produces

/usr/bin/ld: src/.libs/monitor.o:(.bss+0x0): multiple definition of `csp_core_pools'; src/.libs/corepool.o:(.bss+0x0): first defined here
/usr/bin/ld: src/.libs/sched.o:(.bss+0x20): multiple definition of `csp_core_pools'; src/.libs/corepool.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:530: libcsp.la] Error 1

libcsp build failure

after installing the gcc-plugin-dev and unpacking libcsp-0.0.1.tar.gz and running configure, I get the following error from Ubuntu 18.04/gcc 7.5

libcsp-0.0.1$ make
make  all-am
make[1]: Entering directory '/home/donp/projects/v/libcsp-0.0.1'
depbase=`echo plugin/plugin.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/bash ./libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.    -I `gcc -print-file-name=plugin`/include -O3 -MT plugin/plugin.lo -MD -MP -MF $depbase.Tpo -c -o plugin/plugin.lo plugin/plugin.cpp &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I /usr/lib/gcc/x86_64-linux-gnu/7/plugin/include -O3 -MT plugin/plugin.lo -MD -MP -MF plugin/.deps/plugin.Tpo -c plugin/plugin.cpp  -fPIC -DPIC -o plugin/.libs/plugin.o
In file included from plugin/plugin.cpp:22:0:
plugin/proc.hpp: In function ‘std::__cxx11::string csp::get_callee_name(tree)’:
plugin/proc.hpp:83:49: error: ‘TDF_VOPS’ was not declared in this scope
   dump_generic_node(&pp, CALL_EXPR_FN(call), 0, TDF_VOPS|TDF_MEMSYMS, false);
                                                 ^~~~~~~~

function name and macro was conflict

  • error
#define csp_without_prefix

#include <libcsp/csp.h>
#include <unistd.h>
In file included from /usr/local/include/libcsp/csp.h:28,
                 from sum.c:18:
/usr/include/unistd.h:1005:13: error: expected identifier or ‘(’ before ‘do’
 1005 | extern void sync (void) __THROW;
      |             ^~~~
/usr/include/unistd.h:1005:13: error: expected identifier or ‘(’ before ‘while’
 1005 | extern void sync (void) __THROW;
  • But if you reverse the order, it works.
#define csp_without_prefix

#include <unistd.h>
#include <libcsp/csp.h>

How can solve this problem? Am i use "csp_async" and "csp_sync" not "sync" and "async".

Thankyou for reading this issue

block call failed.

int main(void) { printf("before\n"); block({ sleep(1);} ); printf("after\n"); return 0; }
function main never return.

Future in V

I've just accidentally found this lib and I'm quite impressed. It seems to implement a sweet spot between CSP, real os-level threads, work stealing (Weave beats by a significant margin in all tests even hand optimized Intel libraries; see also nim-lang/RFCs#160 ), channel API, etc. quite similarly to what I envisined in vlang/v#1868 .

I would have one question:

  1. Would you be willing to integrate (or help with integration) libcsp (or its parts) into V?

V is a new alpha-state language striving for efficient parallelism & concurrency support. V can be viewed as transpiler to C and thus provides a way to do the "static analysis libcsp is doing during multistaged compilation" in a more straightforward way.

Currently V maps all it's "go routines" 1:1 to os-level threads, but a more efficient implementation (utilizing CSP per os-thread but with preemptive guarantee, work stealing with Leapfrogging, dynamic adjustment of number of os-level threads due to power management on mobile devices, etc.) is needed.

From my point of view the biggest investment in libcsp would be to support also Windows, MacOS, Android, etc. along with ARM, POWER, and other than x86 architectures (ideally should be platform-agnostic with specialized variants for certain architectures - mainly x86 which libcsp already does 😉).

Maybe @UweKrueger could also comment as he's more up to date than me.

Is this a bug?

libcsp/src/rbq.h

Lines 249 to 251 in ea0c5a4

csp_rbq_ptr_name(slow_ptr_t, t) slow; \
csp_rbq_ptr_name(fast_ptr_t, t) fast; \
} csp_rbq_name(rbqt, t, I); \

it looks like you meant to use T here, not t. I might be wrong on that though, using t will work too

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.