Class JitifyCache

Nested Relationships

Nested Types

Class Documentation

class JitifyCache

Load RTC kernels from in-memory or on-disk cache if an appropriate copy already exists If not, compile and add to both caches Loading an RTC kernel from cache is significantly faster than compiling.

This class should sit between FLAMEGPU and Jitify

Public Functions

std::unique_ptr<jitify::experimental::KernelInstantiation> loadKernel(const std::string &func_name, const std::vector<std::string> &template_args, const std::string &kernel_src, const std::string &dynamic_header)

Returns a unique instance of the passed kernel If this is not found in the in-memory or disk cache it will be compiled which is much slower

Parameters:
  • func_name – The name of the function (This is only used for error reporting)

  • template_args – A vector of template arguments for instantiating the kernel. In the case of FLAME GPU 2, these args are likely to be the user defined function_impl and the message i/o types.

  • kernel_src – Source code for the user defined agent function/condition

  • dynamic_header – Dynamic header source generated by curve rtc

Returns:

A jitify RTC kernel instance of the provided kernel sources

void useMemoryCache(bool yesno)

Used to configure whether the in-memory cache is used Defaults to true

bool useMemoryCache() const

Returns whether use of the in-memory cache is currently enabled

void clearMemoryCache()

Clears the in-memory cache All kernels loaded after this will need to come from the on-disk cache or be compiled

void useDiskCache(bool yesno)

Used to configure whether the on-disk cache is used Defaults to true

Note

If disk cache is disabled both importing and exporting cache files to disk will be disabled

bool useDiskCache() const

Returns whether use of the on-disk cache is currently enabled

Note

If disk cache is disabled both importing and exporting cache files to disk will be disabled

JitifyCache(JitifyCache const&) = delete
void operator=(JitifyCache const&) = delete

Public Static Functions

static void clearDiskCache()

Clears the in-memory cache All kernels loaded after this will need to come from the on-disk cache or be compiled

Note

Will only clear the cache files used by the current build (debug or release)

static JitifyCache &getInstance()

Returns the EnvironmentManager singleton instance