G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsJITCompiler.h
Go to the documentation of this file.
1
17#pragma once
18
19#include <gsIO/gsXml.h>
20#include <gsIO/gsFileManager.h>
21
22#if defined(_WIN32)
23#include <windows.h>
24#else
25#include <dlfcn.h>
26#endif
27
28#include <gsCore/gsMemory.h>
29
30namespace gismo {
31
36{
37 enum {
38 C = 0,
39 CXX = 1,
40 CUDA = 2,
41 Fortran = 3
42 };
43};
44
52{
55 : cmd("missing"), flags("missing"), lang("missing"), out("-o "), temp(detectTemp())
56 {
57 char *env;
58 env = getenv ("JIT_COMPILER_CMD");
59 if(env!=NULL) cmd = env;
60
61 env = getenv ("JIT_COMPILER_FLAGS");
62 if(env!=NULL) flags = env;
63
64 env = getenv ("JIT_COMPILER_LANG");
65 if(env!=NULL) lang = env;
66
67 env = getenv ("JIT_COMPILER_TEMP");
68 if(env!=NULL) temp = env;
69 }
70
71 virtual ~gsJITCompilerConfig() { }
72
74 gsJITCompilerConfig(const std::string& cmd,
75 const std::string& flags,
76 const std::string& lang,
77 const std::string& out,
78 const std::string& temp = detectTemp())
79 : cmd(cmd), flags(flags), lang(lang), out(out), temp(temp)
80 {}
81
82 void swap(gsJITCompilerConfig & other)
83 {
84 std::swap(cmd , other.cmd );
85 std::swap(flags, other.flags);
86 std::swap(lang , other.lang );
87 std::swap(out , other.out );
88 std::swap(temp , other.temp );
89 }
90
91# if __cplusplus >= 201103L || _MSC_VER >= 1600
92
95 { operator=(other);}
96
99 {
100 cmd = other.cmd;
101 flags = other.flags;
102 lang = other.lang;
103 out = other.out;
104 temp = other.temp;
105 return *this;
106 }
107
110 : cmd(std::move(other.cmd)), flags(std::move(other.flags)),
111 lang(std::move(other.lang)), out(std::move(other.out)),
112 temp(std::move(other.temp))
113 {}
114
117 {
118 cmd = std::move(other.cmd);
119 flags = std::move(other.flags);
120 lang = std::move(other.lang);
121 out = std::move(other.out);
122 temp = std::move(other.temp);
123 return *this;
124 }
125#else
128 {
129 this->swap(other);
130 return *this;
131 }
132# endif
133
135 virtual const std::string& getCmd() const { return cmd; }
136
138 virtual const std::string& getFlags() const { return flags; }
139
141 virtual const std::string& getLang() const { return lang; }
142
144 virtual const std::string& getOut() const { return out; }
145
147 virtual const std::string& getTemp() const { return temp; }
148
150 void setCmd(const std::string& _cmd)
151 { this->cmd = _cmd; }
152
154 void setFlags(const std::string& _flags)
155 { this->flags = _flags; }
156
158 void setLang(const std::string& _lang)
159 { this->lang = _lang; }
160
162 void setOut(const std::string& _out)
163 { this->out = _out; }
164
166 void setTemp(const std::string& _temp)
167 { this->temp = _temp; }
168
170 std::ostream& print(std::ostream &os) const
171 {
172 os << "JIT Compiler.\n"
173 << " cmd: " << cmd << "\n"
174 << " flags: " << flags << "\n"
175 << " language: " << lang << "\n"
176 << " output flag: " << out << "\n"
177 << " temporal directory: " << temp << "\n";
178
179 return os;
180 }
181
183 void load(const std::string filename,
184 const int _lang = gsJITLang::CXX)
185 {
186 GISMO_ENSURE(_lang >= gsJITLang::C && _lang <= gsJITLang::Fortran,
187 "Error: Invalid compiler language.");
188
189 gsFileData<real_t> f(filename);
190 gsJITCompilerConfig * cc = f.getId<gsJITCompilerConfig>(_lang).release();
191
192 std::swap(*cc, *this);
193 if (this->temp.empty()) this->temp=detectTemp();
194 delete cc;
195 }
196
198 void load_id(const std::string filename,
199 const int id)
200 {
201 gsFileData<real_t> f(filename);
202 gsJITCompilerConfig * cc = f.getId<gsJITCompilerConfig>(id).release();
203
204 std::swap(*cc, *this);
205 if (this->temp.empty()) this->temp=detectTemp();
206 delete cc;
207 }
208
210 static gsJITCompilerConfig clang(const int lang = gsJITLang::CXX)
211 {
212 switch(lang)
213 {
214 case (gsJITLang::C) :
215 return gsJITCompilerConfig("clang",
216 "-O3 -shared",
217 "c",
218 "-o ");
219 break;
220 case (gsJITLang::CXX) :
221 return gsJITCompilerConfig("clang++",
222 "-O3 -shared",
223 "cxx",
224 "-o ");
225 break;
226 case (gsJITLang::Fortran) :
227 GISMO_ERROR("Error : Clang does not provide any Fortran compiler.");
228 break;
229 default :
230 GISMO_ERROR("Error : Invalid compiler language.");
231 }
232 }
233
235 static gsJITCompilerConfig gcc(const int lang = gsJITLang::CXX)
236 {
237 switch(lang)
238 {
239 case (gsJITLang::C) :
240 return gsJITCompilerConfig("gcc",
241 "-fPIC -O3 -shared",
242 "c",
243 "-o ");
244 break;
245 case (gsJITLang::CXX) :
246 return gsJITCompilerConfig("g++",
247 "-fPIC -O3 -shared",
248 "cxx",
249 "-o ");
250 break;
251 case (gsJITLang::Fortran) :
252 return gsJITCompilerConfig("gfortran",
253 "-fPIC -O3 -shared",
254 "F90",
255 "-o ");
256 break;
257 default :
258 GISMO_ERROR("Error : Invalid compiler language.");
259 }
260 }
261
263 static gsJITCompilerConfig intel(const int lang = gsJITLang::CXX)
264 {
265 switch(lang)
266 {
267 case (gsJITLang::C) :
268#if defined(_WIN32)
269 return gsJITCompilerConfig("icl",
270 "/O3 /dll",
271 "c",
272 "/Fo");//no space
273# else
274 return gsJITCompilerConfig("icc",
275 "-O3 -shared",
276 "c",
277 "-o ");
278# endif
279 break;
280 case (gsJITLang::CXX) :
281#if defined(_WIN32)
282 return gsJITCompilerConfig("icl",
283 "/O3 /dll",
284 "c",
285 "/Fo");//no space
286# else
287 return gsJITCompilerConfig("icpc",
288 "-O3 -shared",
289 "cxx",
290 "-o ");
291# endif
292 break;
293 case (gsJITLang::Fortran) :
294#if defined(_WIN32)
295 return gsJITCompilerConfig("ifort",
296 "/O3 /dll",
297 "F90",
298 "/Fo");//no space
299# else
300 return gsJITCompilerConfig("ifort",
301 "-O3 -shared",
302 "F90",
303 "-o ");
304# endif
305 break;
306 default :
307 GISMO_ERROR("Error : Invalid compiler language.");
308 }
309 }
310
312 static gsJITCompilerConfig msvc(const int lang = gsJITLang::CXX)
313 {
314 switch(lang)
315 {
316 case (gsJITLang::C) :
317 return gsJITCompilerConfig("cl.exe",
318 "/EHsc /Ox /LD",
319 "c",
320 "/Fe");//no space
321 break;
322 case (gsJITLang::CXX) :
323 return gsJITCompilerConfig("cl.exe",
324 "/EHsc /Ox /LD",
325 "cxx",
326 "/Fe");//no space
327 break;
328 default :
329 GISMO_ERROR("Error : Invalid compiler language.");
330 }
331 }
332
334 static gsJITCompilerConfig nvcc(const int lang = gsJITLang::CUDA)
335 {
336 switch(lang)
337 {
338 case (gsJITLang::CUDA) :
339 return gsJITCompilerConfig("nvcc",
340 "-O3 -shared",
341 "cu",
342 "-o ");
343 break;
344 default :
345 GISMO_ERROR("Error : Invalid compiler language.");
346 }
347 }
348
350 static gsJITCompilerConfig pgi(const int lang = gsJITLang::CXX)
351 {
352 switch(lang)
353 {
354 case (gsJITLang::C) :
355 return gsJITCompilerConfig("pgcc",
356 "-O3 -shared",
357 "c",
358 "-o ");
359 break;
360 case (gsJITLang::CXX) :
361 return gsJITCompilerConfig("pgc++",
362 "-O3 -shared",
363 "cxx",
364 "-o ");
365 break;
366 case (gsJITLang::Fortran) :
367 return gsJITCompilerConfig("pgf90",
368 "-O3 -shared",
369 "F90",
370 "-o ");
371 break;
372 default :
373 GISMO_ERROR("Error : Invalid compiler language.");
374 }
375 }
376
379 {
380 switch(lang)
381 {
382 case (gsJITLang::C) :
383 return gsJITCompilerConfig("sunstudio",
384 "-O3 -shared",
385 "c",
386 "-o ");
387 break;
388 case (gsJITLang::CXX) :
389 return gsJITCompilerConfig("sunstudio",
390 "-O3 -shared",
391 "cxx",
392 "-o ");
393 break;
394 case (gsJITLang::Fortran) :
395 return gsJITCompilerConfig("sunstudio",
396 "-O3 -shared",
397 "F90",
398 "-o ");
399 break;
400 default :
401 GISMO_ERROR("Error : Invalid compiler language.");
402 }
403 }
404
407 {
408# if defined(__INTEL_COMPILER)
409# if defined(__ICC)
410 return intel(gsJITLang::CXX);
411# else
413# endif
414
415# elif defined(_MSC_VER)
416 return msvc();
417
418# elif defined(__clang__)
419 return clang();
420
421# elif defined(__GNUC__)
422# if defined(__cplusplus)
423 return gcc(gsJITLang::CXX);
424# elif defined(__GFortran__)
425 return gcc(gsJITLang::Fortran);
426# else
427 return gcc(gsJITLang::C);
428# endif
429
430# elif defined(__PGIC__)
431 return pgi();
432
433# elif defined(__SUNPRO_C)
434 return sunstudio(gsJITLang::C);
435# elif defined(__SUNPRO_CC)
437# elif defined(__SUNPRO_F90) || defined(__SUNPRO_F95)
439
440# else
441 GISMO_ERROR("Compiler not known");
442# endif
443 }
444
445protected:
447 std::string cmd;
448 std::string flags;
449 std::string lang;
450 std::string out;
451 std::string temp;
452
453private:
454
456 static std::string detectTemp()
457 {
459 }
460};
461
463inline std::ostream &operator<<(std::ostream &os,
464 const gsJITCompilerConfig& c)
465{ return c.print(os); }
466
467namespace internal
468{
469
473template<>
474class gsXml< gsJITCompilerConfig >
475{
476private:
477 gsXml() { }
478
479public:
480 GSXML_COMMON_FUNCTIONS(gsJITCompilerConfig)
481 GSXML_GET_POINTER(gsJITCompilerConfig)
482 static std::string tag () { return "JITCompilerConfig"; }
483 static std::string type() { return ""; }
484
485 static void get_into(gsXmlNode * node, gsJITCompilerConfig & result)
486 {
487 gsXmlAttribute * tmp = node->first_attribute("cmd");
488 if (tmp!=NULL)
489 result.setCmd(tmp->value());
490
491 tmp = node->first_attribute("flags");
492 if (tmp!=NULL)
493 result.setFlags(tmp->value());
494
495 tmp = node->first_attribute("lang");
496 if (tmp!=NULL)
497 result.setLang(tmp->value());
498
499 tmp = node->first_attribute("out");
500 if (tmp!=NULL)
501 result.setOut(tmp->value());
502
503 tmp = node->first_attribute("temp");
504 if (tmp!=NULL)
505 result.setTemp(tmp->value());
506 }
507
508 static gsXmlNode * put (const gsJITCompilerConfig & obj, gsXmlTree & data)
509 {
510 // Make a new XML CompilerConfig node
511 gsXmlNode * tmp = internal::makeNode("JITCompilerConfig", data);
512
513 // Append the attributes
514 tmp->append_attribute( makeAttribute("cmd" , obj.getCmd() , data) );
515 tmp->append_attribute( makeAttribute("flags", obj.getFlags(), data) );
516 tmp->append_attribute( makeAttribute("lang" , obj.getLang() , data) );
517 tmp->append_attribute( makeAttribute("out" , obj.getOut() , data) );
518 tmp->append_attribute( makeAttribute("temp" , obj.getTemp() , data) );
519
520 return tmp;
521 }
522};
523
524} // namespace internal
525
533{
534public:
537
539 gsDynamicLibrary(const char* filename, int flag)
540 {
541 gsDebug << "Loading dynamic library: " << filename << "\n";
542
543#if defined(_WIN32)
544 GISMO_UNUSED(flag);
545 HMODULE dl = LoadLibrary(filename);
546 if (!dl)
547 {
548 std::ostringstream err;
549 err <<"LoadLibrary - error: " << GetLastError();
550 throw std::runtime_error( err.str() );
551 }
552 handle.reset(dl, FreeLibrary);
553#elif defined(__APPLE__) || defined(__linux__) || defined(__unix)
554 void * dl = ::dlopen(filename, flag);
555 if (!dl)
556 throw std::runtime_error( ::dlerror() );
557 handle.reset(dl, ::dlclose);
558#else
559#error("Unsupported operating system")
560#endif
561 }
562
564 template<class T>
565 T* getSymbol(const char* name) const
566 {
567 if (!handle)
568 throw std::runtime_error("An error occured while accessing the dynamic library");
569
570 T *symbol;
571#if defined(_WIN32)
572 *(void **)(&symbol) = (void*)GetProcAddress(handle.get(), name );
573#elif defined(__APPLE__) || defined(__linux__) || defined(__unix)
574 *(void **)(&symbol) = ::dlsym( handle.get(), name );
575#endif
576 if (!symbol)
577 throw std::runtime_error("An error occured while getting symbol from the dynamic library");
578
579 return symbol;
580 }
581
583 operator bool() const { return (bool)handle; }
584
585private:
586
588#if defined(_WIN32)
589 memory::shared_ptr< util::remove_pointer<HMODULE>::type > handle;
590#else //if defined(__APPLE__) || defined(__linux__) || defined(__unix)
591 memory::shared_ptr<void> handle;
592#endif
593};
594
604{
605public:
608 : kernel(), config()
609 { }
610
613 : config(other.config)
614 {
615 kernel << other.kernel.rdbuf();
616 }
617
620 : kernel(), config(config)
621 {}
622
625 {
626 kernel << other.kernel.rdbuf();
627 config = other.config;
628 return *this;
629 }
630
631# if __cplusplus >= 201103L || _MSC_VER >= 1600
634 : //kernel(std::move(other.kernel)),
635 config(std::move(other.config))
636 {
637 kernel << other.kernel.rdbuf();
638 }
639
642 {
643 kernel << other.kernel.rdbuf();
644 config = std::move(other.config);
645 return *this;
646 }
647# endif
648
650 gsJITCompiler & operator<<(const std::string & s)
651 {
652 kernel << s;
653 return *this;
654 }
655
657 gsJITCompiler & operator<<(std::istream & is)
658 {
659 kernel << is.rdbuf();
660 return *this;
661 }
662
665 gsDynamicLibrary build(bool force = false)
666 {
667# if __cplusplus >= 201103L || _MSC_VER >= 1600
668 size_t h = std::hash<std::string>()(getKernel().str() +
670 config.getLang());
671 return build(std::to_string(h), force);
672# else
673 return build("JIT", true);
674# endif
675 }
676
679 gsDynamicLibrary build(const std::string &name, bool force = false)
680 {
681 // Prepare library name
682 std::stringstream libName;
683
684# if defined(_WIN32)
685 libName << config.getTemp() << "." << name << ".dll";
686 //(void)std::system("del /f " + libName);
687 //force = true;
688# elif defined(__APPLE__)
689 libName << config.getTemp() << ".lib" << name << ".dylib";
690# elif defined(unix) || defined(__unix__) || defined(__unix)
691 libName << config.getTemp() << ".lib" << name << ".so";
692# else
693# error("Unsupported operating system")
694# endif
695
696 // Compile library (if required)
697 std::ifstream libfile(libName.str().c_str());
698 if(!libfile || force)
699 {
700 // Write kernel source code to file
701 std::stringstream srcName;
702# ifdef _WIN32
703 srcName<< config.getTemp() << "\\." << name << "." << config.getLang();
704 std::ofstream file(srcName.str().c_str());
705 file << "#ifdef __cplusplus\n";
706 file << "#define EXPORT extern \"C\" __declspec(dllexport)\n";
707 file << "#endif\n";
708# else
709 srcName<< config.getTemp() << "." << name << "." << config.getLang();
710 std::ofstream file(srcName.str().c_str());
711 file << "#ifdef __cplusplus\n";
712 file << "#define EXPORT extern \"C\"\n";
713 file << "#endif\n";
714# endif
715 file << getKernel().str() <<"\n";
716 file.close();
717
718 // Compile kernel source code into library
719 std::stringstream systemcall;
720
721# ifdef _WIN32
722 // double quotes are better than single quotes..
723 systemcall << "\"\"" << config.getCmd() << "\" "
724 << config.getFlags() << " \""
725 << srcName.str() << "\" "
726 << config.getOut() << "\"" << libName.str() << "\"\"";
727# else
728 systemcall << "\"" << config.getCmd() << "\" "
729 << config.getFlags() << " \""
730 << srcName.str() << "\" "
731 << config.getOut() << "\"" << libName.str() << "\"";
732# endif
733
734 gsDebug << "Compiling dynamic library: " << systemcall.str() << "\n";
735 if(std::system(systemcall.str().c_str()) != 0)
736 throw std::runtime_error("An error occured while compiling the kernel source code");
737 }
738
739#ifdef _WIN32
740 return gsDynamicLibrary( libName.str().c_str(), 0 );
741#else
742 return gsDynamicLibrary( libName.str().c_str(), RTLD_LAZY );
743#endif
744 }
745
747 void clear()
748 {
749 kernel.clear();
750 kernel.str(std::string());
751 }
752
754 std::ostream& print(std::ostream &os) const
755 {
756 os << kernel.str();
757 return os;
758 }
759
761 const std::ostringstream &getKernel() const
762 {
763 return kernel;
764 }
765
767 std::ostringstream &getKernel()
768 {
769 return kernel;
770 }
771
772private:
774 std::ostringstream kernel;
775
778};
779
781inline std::ostream &operator<<(std::ostream &os, const gsJITCompiler& c)
782{ return c.print(os); }
783
784namespace internal
785{
786
790template<>
791class gsXml< gsJITCompiler >
792{
793private:
794 gsXml() { }
795
796public:
797 GSXML_COMMON_FUNCTIONS(gsJITCompiler)
798 GSXML_GET_POINTER(gsJITCompiler)
799 static std::string tag () { return "JITCompiler"; }
800 static std::string type() { return ""; }
801
802 static void get_into(gsXmlNode * node, gsJITCompiler & result)
803 {
804 result.getKernel() << node->value();
805 }
806
807 static gsXmlNode * put (const gsJITCompiler & obj, gsXmlTree & data)
808 {
809 // Make a new XML KnotVector node
810 gsXmlNode * tmp = internal::makeNode("JITCompiler", obj.getKernel().str(), data);
811
812 return tmp;
813 }
814};
815
816} // namespace internal
817
818} // namespace gismo
This class represents an XML data tree which can be read from or written to a (file) stream.
Definition gsFileData.h:34
static std::string getTempPath()
Auto-detect temp directory.
Definition gsFileManager.cpp:355
Class defining a just-in-time compiler.
Definition gsJITCompiler.h:604
gsDynamicLibrary build(const std::string &name, bool force=false)
Definition gsJITCompiler.h:679
const std::ostringstream & getKernel() const
Return kernel source code (as output stringstream)
Definition gsJITCompiler.h:761
gsJITCompiler & operator<<(std::istream &is)
Input kernel source code from input stream.
Definition gsJITCompiler.h:657
gsJITCompilerConfig config
Compiler configuration.
Definition gsJITCompiler.h:777
gsJITCompiler & operator<<(const std::string &s)
Input kernel source code from string.
Definition gsJITCompiler.h:650
gsJITCompiler(const gsJITCompilerConfig &config)
Constructor (using compiler configuration)
Definition gsJITCompiler.h:619
gsJITCompiler()
Constructor (default)
Definition gsJITCompiler.h:607
gsJITCompiler & operator=(gsJITCompiler const &other)
Assignment operator (copy)
Definition gsJITCompiler.h:624
void clear()
Clear kernel source code.
Definition gsJITCompiler.h:747
std::ostringstream & getKernel()
Return pointer to kernel source code.
Definition gsJITCompiler.h:767
gsJITCompiler(gsJITCompiler const &other)
Constructor (copy)
Definition gsJITCompiler.h:612
std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition gsJITCompiler.h:754
std::ostringstream kernel
Kernel source code.
Definition gsJITCompiler.h:774
gsDynamicLibrary build(bool force=false)
Definition gsJITCompiler.h:665
#define gsDebug
Definition gsDebug.h:61
#define GISMO_ERROR(message)
Definition gsDebug.h:118
#define GISMO_UNUSED(x)
Definition gsDebug.h:112
#define GISMO_ENSURE(cond, message)
Definition gsDebug.h:102
Utility class for finding files and handling paths.
Provides utility function related to memory management.
Provides declaration of input/output XML utilities struct.
gsXmlNode * makeNode(const std::string &name, gsXmlTree &data)
Helper to allocate XML node.
Definition gsXml.cpp:54
gsXmlAttribute * makeAttribute(const std::string &name, const std::string &value, gsXmlTree &data)
Helper to allocate XML attribute.
Definition gsXml.cpp:37
The G+Smo namespace, containing all definitions for the library.
Class defining a dynamic library.
Definition gsJITCompiler.h:533
T * getSymbol(const char *name) const
Get symbol from dynamic library.
Definition gsJITCompiler.h:565
memory::shared_ptr< void > handle
Handle to dynamic library object.
Definition gsJITCompiler.h:591
gsDynamicLibrary()
Default Constructor.
Definition gsJITCompiler.h:536
gsDynamicLibrary(const char *filename, int flag)
Constructor (using file name)
Definition gsJITCompiler.h:539
Struct definig a compiler configuration.
Definition gsJITCompiler.h:52
static gsJITCompilerConfig clang(const int lang=gsJITLang::CXX)
Initialize to default Clang compiler.
Definition gsJITCompiler.h:210
gsJITCompilerConfig()
Constructor (default)
Definition gsJITCompiler.h:54
virtual const std::string & getTemp() const
Return compiler temporal directory.
Definition gsJITCompiler.h:147
static gsJITCompilerConfig msvc(const int lang=gsJITLang::CXX)
Initialize to default Microsoft Visual Studio compiler.
Definition gsJITCompiler.h:312
void setCmd(const std::string &_cmd)
Set compiler command.
Definition gsJITCompiler.h:150
gsJITCompilerConfig & operator=(gsJITCompilerConfig other)
Assignment operator.
Definition gsJITCompiler.h:127
virtual const std::string & getFlags() const
Return compiler flags.
Definition gsJITCompiler.h:138
virtual const std::string & getCmd() const
Return compiler command.
Definition gsJITCompiler.h:135
static gsJITCompilerConfig sunstudio(const int lang=gsJITLang::CXX)
Initialize to default Oracle/SunStudio compiler.
Definition gsJITCompiler.h:378
void load(const std::string filename, const int _lang=gsJITLang::CXX)
Reads compiler configuration from XML file by language.
Definition gsJITCompiler.h:183
static gsJITCompilerConfig gcc(const int lang=gsJITLang::CXX)
Initialize to default GCC compiler.
Definition gsJITCompiler.h:235
void setFlags(const std::string &_flags)
Set compiler flags.
Definition gsJITCompiler.h:154
static std::string detectTemp()
Auto-detect temp directory.
Definition gsJITCompiler.h:456
gsJITCompilerConfig(const std::string &cmd, const std::string &flags, const std::string &lang, const std::string &out, const std::string &temp=detectTemp())
Constructor (passing arguments as strings)
Definition gsJITCompiler.h:74
virtual const std::string & getLang() const
Return compiler language.
Definition gsJITCompiler.h:141
std::string cmd
Members variables.
Definition gsJITCompiler.h:447
static gsJITCompilerConfig nvcc(const int lang=gsJITLang::CUDA)
Initialize to default NVIDIA nvcc compiler.
Definition gsJITCompiler.h:334
static gsJITCompilerConfig pgi(const int lang=gsJITLang::CXX)
Initialize to default PGI compiler.
Definition gsJITCompiler.h:350
static gsJITCompilerConfig intel(const int lang=gsJITLang::CXX)
Initialize to default Intel compiler.
Definition gsJITCompiler.h:263
void setTemp(const std::string &_temp)
Set compiler temporal directory.
Definition gsJITCompiler.h:166
void load_id(const std::string filename, const int id)
Reads compiler configuration from XML file by ID.
Definition gsJITCompiler.h:198
static gsJITCompilerConfig guess()
Try to initialize compiler automatically based on the context.
Definition gsJITCompiler.h:406
std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition gsJITCompiler.h:170
void setLang(const std::string &_lang)
Set compiler language.
Definition gsJITCompiler.h:158
void setOut(const std::string &_out)
Set compiler output flag.
Definition gsJITCompiler.h:162
virtual const std::string & getOut() const
Return compiler output flag.
Definition gsJITCompiler.h:144
Supported languages.
Definition gsJITCompiler.h:36
@ CUDA
Cuda.
Definition gsJITCompiler.h:40
@ C
C.
Definition gsJITCompiler.h:38
@ Fortran
Fortran.
Definition gsJITCompiler.h:41
@ CXX
C++.
Definition gsJITCompiler.h:39