当前位置: 首页>>代码示例>>C++>>正文


C++ Globals::OutputBufferInits方法代码示例

本文整理汇总了C++中Globals::OutputBufferInits方法的典型用法代码示例。如果您正苦于以下问题:C++ Globals::OutputBufferInits方法的具体用法?C++ Globals::OutputBufferInits怎么用?C++ Globals::OutputBufferInits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Globals的用法示例。


在下文中一共展示了Globals::OutputBufferInits方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OutputEntryFunction

void CLOutputMgr::OutputEntryFunction(Globals& globals) {
  // Would ideally use the ExtensionMgr, but there is no way to set it to our
  // own custom made one (without modifying the code).
  std::ostream& out = get_main_out();
  out << "__kernel void entry(__global ulong *result";
  if (CLOptions::atomics()) {
    out << ", __global volatile uint *g_atomic_input";
    out << ", __global volatile uint *g_special_values";
  }
  if (CLOptions::atomic_reductions()) {
    out << ", __global volatile int *g_atomic_reduction";
  }
  if (CLOptions::emi())
    out << ", __global int *emi_input";
  if (CLOptions::fake_divergence())
    out << ", __global int *sequence_input";
  if (CLOptions::inter_thread_comm())
    out << ", __global long *g_comm_values";
  out << ") {" << std::endl;
  globals.OutputArrayControlVars(out);
  globals.OutputBufferInits(out);
  globals.OutputStructInit(out);

  // Block all threads before entering to ensure the local buffers have been
  // initialised.
  output_tab(out, 1);
  StatementBarrier::OutputBarrier(out);
  out << std::endl;

  output_tab(out, 1);
  out << "func_1(";
  globals.GetGlobalStructVar().Output(out);
  out << ");" << std::endl;

  // If using message passing, check and update constraints to prevent deadlock.
  if (CLOptions::message_passing())
    MessagePassing::OutputMessageEndChecks(out);

  // Block all threads after, to prevent hashing stale values.
  output_tab(out, 1);
  StatementBarrier::OutputBarrier(out);
  out << std::endl;

  // Handle hashing and outputting.
  output_tab(out, 1);
  out << "uint64_t crc64_context = 0xFFFFFFFFFFFFFFFFUL;" << std::endl;
  output_tab(out, 1);
  out << "int print_hash_value = 0;" << std::endl;
  HashGlobalVariables(out);
  if (CLOptions::atomics())
    ExpressionAtomic::OutputHashing(out);
  if (CLOptions::inter_thread_comm()) StatementComm::HashCommValues(out);
  output_tab(out, 1);
  out << "result[get_linear_global_id()] = crc64_context ^ 0xFFFFFFFFFFFFFFFFUL;"
      << std::endl;
  out << "}" << std::endl;
}
开发者ID:ChrisCummins,项目名称:CLSmith,代码行数:57,代码来源:CLOutputMgr.cpp


注:本文中的Globals::OutputBufferInits方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。