Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

enkiTS

> 编程语言
Open source

A permissively licensed C and C++ Task Scheduler for creating parallel programs. Requires C++11 support.

2.0K stars0 likes0 views
WebsiteGitHub

About

A permissively licensed C and C++ Task Scheduler for creating parallel programs. Requires C++11 support.

Support development of enkiTS through Github Sponsors or Patreon

enkiTS

Master branch Dev branch

enki Task Scheduler

A permissively licensed C and C++ Task Scheduler for creating parallel programs. Requires C++11 support.

The primary goal of enkiTS is to help developers create programs which handle both data and task level parallelism to utilize the full performance of multicore CPUs, whilst being lightweight (only a small amount of code) and easy to use.

  • C++ API via src/TaskScheduler.h
  • C API via src/TaskScheduler_c.h

enkiTS was developed for, and is used in enkisoftware's Avoyd codebase.

Platforms

  • Windows, Linux, Mac OS, Android (should work on iOS)
  • x64 & x86, ARM

enkiTS is primarily developed on x64 and x86 Intel architectures on MS Windows, with well tested support for Linux and somewhat less frequently tested support on Mac OS and ARM Android.

Examples

Several examples exist in the example folder.

For further examples, see https://github.com/dougbinks/enkiTSExamples

Building

Building enkiTS is simple, just add the files in enkiTS/src to your build system (_c.* files can be ignored if you only need C++ interface), and add enkiTS/src to your include path. Unix / Linux builds will likely require the pthreads library.

For C++

  • Use #include "TaskScheduler.h"
  • Add enkiTS/src to your include path
  • Compile / Add to project:
    • TaskScheduler.cpp
  • Unix / Linux builds will likely require the pthreads library.

For C

  • Use #include "TaskScheduler_c.h"
  • Add enkiTS/src to your include path
  • Compile / Add to project:
    • TaskScheduler.cpp
    • TaskScheduler_c.cpp
  • Unix / Linux builds will likely require the pthreads library.

For cmake, on Windows / Mac OS X / Linux with cmake installed, open a prompt in the enkiTS directory and:

  1. mkdir build
  2. cd build
  3. cmake ..
  4. either run make all or for Visual Studio open enkiTS.sln

Project Features

  1. Lightweight - enkiTS is designed to be lean so you can use it anywhere easily, and understand it.
  2. Fast, then scalable - enkiTS is designed for consumer devices first, so performance on a low number of threads is important, followed by scalability.
  3. Braided parallelism - enkiTS can issue tasks from another task as well as from the thread which created the Task System, and has a simple task interface for both data parallel and task parallelism.
  4. Up-front Allocation friendly - enkiTS is designed for zero allocations during scheduling.
  5. Can pin tasks to a given thread - enkiTS can schedule a task which will only be run on the specified thread.
  6. Can set task priorities - Up to 5 task priorities can be configured via define ENKITS_TASK_PRIORITIES_NUM (defaults to 3). Higher priority tasks are run before lower priority ones.
  7. Can register external threads to use with enkiTS - Can configure enkiTS with numExternalTaskThreads which can be registered to use with the enkiTS API.
  8. Custom allocator API - can configure enkiTS with custom allocators, see example/CustomAllocator.cpp and example/CustomAllocator_c.c.
  9. Dependencies - can set dependendencies between tasks see example/Dependencies.cpp and example/Dependencies_c.c.
  10. Completion Actions - can perform an action on task completion. This avoids the expensive action of adding the task to the scheduler, and can be used to safely delete a completed task. See example/CompletionAction.cpp and example/CompletionAction_c.c
  11. NEW Can wait for pinned tasks - Can wait for pinned tasks, useful for creating IO threads which do no other work. See example/WaitForNewPinnedTasks.cpp and example/WaitForNewPinnedTasks_c.c.

Installing

I recommend using enkiTS directly from source in each project rather than installing it for system wide use. However enkiTS' cmake script can also be used to install the library if the ENKITS_INSTALL cmake variable is set to ON (it defaults to OFF).

When installed the header files are installed in a subdirectory of the include path, include/enkiTS to ensure that they do not conflict with header files from other packages. When building applications either ensure this is part of the INCLUDE_PATH variable or ensure that enkiTS is in the header path in the source files, for example use #include "enkiTS/TaskScheduler.h" instead of #include "TaskScheduler.h".

Using enkiTS

C++ usage

  • full example in example/ParallelSum.cpp
  • C example in example/ParallelSum_c.c
…

C++ 11 lambda usage

  • full example in example/LambdaTask.cpp
#include "TaskScheduler.h"

enki::TaskScheduler g_TS;

int main(int argc, const char * argv[]) {
   g_TS.Initialize();

   enki::TaskSet task( 1, []( enki::TaskSetPartition range_, uint32_t threadnum_  ) {
         // do something here
      }  );

   g_TS.AddTaskSetToPipe( &task );
   g_TS.WaitforTask( &task );
   return 0;
}

Task priorities usage in C++

  • full example in example/Priorities.cpp
  • C example in example/Priorities_c.c
…

Pinned Tasks usage in C++

  • full example in example/PinnedTask.cpp
  • C example in example/PinnedTask_c.c
…

Dependency usage in C++

  • full example in example/Dependencies.cpp
  • C example in example/Dependencies_c.c
…

External task thread usage in C++

  • full example in example/ExternalTaskThread.cpp
  • C example in example/ExternalTaskThread_c.c
…

WaitForPinnedTasks thread usage in C++ (useful for IO threads)

  • full example in example/WaitForNewPinnedTasks.cpp
  • C example in example/WaitForNewPinnedTasks_c.c
…

Bindings

  • Odin enkiTS Odin bindings by @nadako

Deprecated

The C++98 compatible branch has been deprecated as I'm not aware of anyone needing it.

The user thread versions are no longer being maintained as they are no longer in use. Similar functionality can be obtained with the externalTaskThreads

  • User thread version on Branch UserThread for running enkiTS on other tasking / threading systems, so it can be used as in other engines as well as standalone for example.
  • C++ 11 version of user threads on Branch UserThread_C++11

Projects using enkiTS

Avoyd

Avoyd is an abstract 6 degrees of freedom voxel game. enkiTS was developed for use in our in-house engine powering Avoyd.

Imogen

GPU/CPU Texture Generator

ToyPathRacer

Aras Pranckevičius' code for his series on Daily Path Tracer experiments with various languages.

.

Mastering Graphics Programming with Vulkan

Marco Castorina and Gabriel Sassone's book on developing a modern rendering engine from first principles using the Vulkan API. enkiTS is used as the task library to distribute work across cores.

License (zlib)

Copyright (c) 2013-2020 Doug Binks

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgement in the product documentation would be appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

GitHub Issues· 0 open

View all on GitHub

No open issues yet, or sync has not completed.

Highlights

  • •C++ API via src/TaskScheduler.h
  • •C API via src/TaskScheduler_c.h
  • •Windows, Linux, Mac OS, Android (should work on iOS)
  • •x64 & x86, ARM
  • •Use #include "TaskScheduler.h"
  • •Add enkiTS/src to your include path
  • •Compile / Add to project:
  • •TaskScheduler.cpp
  • •Unix / Linux builds will likely require the pthreads library.
  • •Use #include "TaskScheduler_c.h"

> Tags

C++cc-plus-plusenkitsgamedev

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言