forked from OSchip/llvm-project
Clang-format and whitespace cleanup of source code
This patch contains the clang-format and cleanup of the entire code base. Some of clang-formats changes made the code look worse in places. A best effort was made to resolve the bulk of these problems, but many remain. Most of the problems were mangling line-breaks and tabbing of comments. Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D32659 llvm-svn: 302929
This commit is contained in:
parent
fab6b1af6e
commit
3041982dd1
|
|
@ -13,13 +13,13 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <iostream>
|
|
||||||
#include <strstream>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <iostream>
|
||||||
#include <set>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <set>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string>
|
||||||
|
#include <strstream>
|
||||||
|
|
||||||
/* Given a set of n object files h ('external' object files) and a set of m
|
/* Given a set of n object files h ('external' object files) and a set of m
|
||||||
object files o ('internal' object files),
|
object files o ('internal' object files),
|
||||||
|
|
@ -30,13 +30,13 @@
|
||||||
Usage:
|
Usage:
|
||||||
hide.exe <n> <filenames for h> <filenames for o>
|
hide.exe <n> <filenames for h> <filenames for o>
|
||||||
|
|
||||||
Thus, the prefixed symbols become hidden in the sense that they now have a special
|
Thus, the prefixed symbols become hidden in the sense that they now have a
|
||||||
prefix.
|
special prefix.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
void stop(char* errorMsg) {
|
void stop(char *errorMsg) {
|
||||||
printf("%s\n", errorMsg);
|
printf("%s\n", errorMsg);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
@ -53,58 +53,49 @@ public:
|
||||||
class _rstream : public istrstream {
|
class _rstream : public istrstream {
|
||||||
private:
|
private:
|
||||||
const char *buf;
|
const char *buf;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
_rstream(pair<const char*, streamsize> p):istrstream(p.first,p.second),buf(p.first){}
|
_rstream(pair<const char *, streamsize> p)
|
||||||
~_rstream() {
|
: istrstream(p.first, p.second), buf(p.first) {}
|
||||||
delete[]buf;
|
~_rstream() { delete[] buf; }
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A stream encapuslating the content of a file or the content of a string, overriding the
|
// A stream encapuslating the content of a file or the content of a string,
|
||||||
>> operator to read various integer types in binary form, as well as a symbol table
|
// overriding the >> operator to read various integer types in binary form,
|
||||||
entry.
|
// as well as a symbol table entry.
|
||||||
*/
|
|
||||||
class rstream : public _rstream {
|
class rstream : public _rstream {
|
||||||
private:
|
private:
|
||||||
template<class T>
|
template <class T> inline rstream &doRead(T &x) {
|
||||||
inline rstream& doRead(T &x) {
|
read((char *)&x, sizeof(T));
|
||||||
read((char*)&x, sizeof(T));
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
static pair<const char*, streamsize> getBuf(const char *fileName) {
|
static pair<const char *, streamsize> getBuf(const char *fileName) {
|
||||||
ifstream raw(fileName,ios::binary | ios::in);
|
ifstream raw(fileName, ios::binary | ios::in);
|
||||||
if(!raw.is_open())
|
if (!raw.is_open())
|
||||||
stop("rstream.getBuf: Error opening file");
|
stop("rstream.getBuf: Error opening file");
|
||||||
raw.seekg(0,ios::end);
|
raw.seekg(0, ios::end);
|
||||||
streampos fileSize = raw.tellg();
|
streampos fileSize = raw.tellg();
|
||||||
if(fileSize < 0)
|
if (fileSize < 0)
|
||||||
stop("rstream.getBuf: Error reading file");
|
stop("rstream.getBuf: Error reading file");
|
||||||
char *buf = new char[fileSize];
|
char *buf = new char[fileSize];
|
||||||
raw.seekg(0,ios::beg);
|
raw.seekg(0, ios::beg);
|
||||||
raw.read(buf, fileSize);
|
raw.read(buf, fileSize);
|
||||||
return pair<const char*, streamsize>(buf,fileSize);
|
return pair<const char *, streamsize>(buf, fileSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// construct from a string
|
// construct from a string
|
||||||
rstream(const char *buf,streamsize size):_rstream(pair<const char*,streamsize>(buf, size)){}
|
rstream(const char *buf, streamsize size)
|
||||||
/* construct from a file whole content is fully read once to initialize the content of
|
: _rstream(pair<const char *, streamsize>(buf, size)) {}
|
||||||
this stream
|
// construct from a file whole content is fully read once to initialize the
|
||||||
*/
|
// content of this stream
|
||||||
rstream(const char *fileName):_rstream(getBuf(fileName)){}
|
rstream(const char *fileName) : _rstream(getBuf(fileName)) {}
|
||||||
rstream& operator>>(int &x) {
|
rstream &operator>>(int &x) { return doRead(x); }
|
||||||
return doRead(x);
|
rstream &operator>>(unsigned &x) { return doRead(x); }
|
||||||
}
|
rstream &operator>>(short &x) { return doRead(x); }
|
||||||
rstream& operator>>(unsigned &x) {
|
rstream &operator>>(unsigned short &x) { return doRead(x); }
|
||||||
return doRead(x);
|
rstream &operator>>(Symbol &e) {
|
||||||
}
|
read((char *)&e, 18);
|
||||||
rstream& operator>>(short &x) {
|
|
||||||
return doRead(x);
|
|
||||||
}
|
|
||||||
rstream& operator>>(unsigned short &x) {
|
|
||||||
return doRead(x);
|
|
||||||
}
|
|
||||||
rstream& operator>>(Symbol &e) {
|
|
||||||
read((char*)&e, 18);
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -119,7 +110,7 @@ private:
|
||||||
// make <directory> from <length> bytes in <data>
|
// make <directory> from <length> bytes in <data>
|
||||||
void makeDirectory(void) {
|
void makeDirectory(void) {
|
||||||
unsigned i = 4;
|
unsigned i = 4;
|
||||||
while(i < length) {
|
while (i < length) {
|
||||||
string s = string(data + i);
|
string s = string(data + i);
|
||||||
directory.insert(make_pair(s, i));
|
directory.insert(make_pair(s, i));
|
||||||
i += s.size() + 1;
|
i += s.size() + 1;
|
||||||
|
|
@ -127,70 +118,71 @@ private:
|
||||||
}
|
}
|
||||||
// initialize <length> and <data> with contents specified by the arguments
|
// initialize <length> and <data> with contents specified by the arguments
|
||||||
void init(const char *_data) {
|
void init(const char *_data) {
|
||||||
unsigned _length = *(unsigned*)_data;
|
unsigned _length = *(unsigned *)_data;
|
||||||
|
|
||||||
if(_length < sizeof(unsigned) || _length != *(unsigned*)_data)
|
if (_length < sizeof(unsigned) || _length != *(unsigned *)_data)
|
||||||
stop("StringTable.init: Invalid symbol table");
|
stop("StringTable.init: Invalid symbol table");
|
||||||
if(_data[_length - 1]) {
|
if (_data[_length - 1]) {
|
||||||
// to prevent runaway strings, make sure the data ends with a zero
|
// to prevent runaway strings, make sure the data ends with a zero
|
||||||
data = new char[length = _length + 1];
|
data = new char[length = _length + 1];
|
||||||
data[_length] = 0;
|
data[_length] = 0;
|
||||||
} else {
|
} else {
|
||||||
data = new char[length = _length];
|
data = new char[length = _length];
|
||||||
}
|
}
|
||||||
*(unsigned*)data = length;
|
*(unsigned *)data = length;
|
||||||
KMP_MEMCPY(data + sizeof(unsigned), _data + sizeof(unsigned),
|
KMP_MEMCPY(data + sizeof(unsigned), _data + sizeof(unsigned),
|
||||||
length - sizeof(unsigned));
|
length - sizeof(unsigned));
|
||||||
makeDirectory();
|
makeDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StringTable(rstream &f) {
|
StringTable(rstream &f) {
|
||||||
/* Construct string table by reading from f.
|
// Construct string table by reading from f.
|
||||||
*/
|
|
||||||
streampos s;
|
streampos s;
|
||||||
unsigned strSize;
|
unsigned strSize;
|
||||||
char *strData;
|
char *strData;
|
||||||
|
|
||||||
s = f.tellg();
|
s = f.tellg();
|
||||||
f>>strSize;
|
f >> strSize;
|
||||||
if(strSize < sizeof(unsigned))
|
if (strSize < sizeof(unsigned))
|
||||||
stop("StringTable: Invalid string table");
|
stop("StringTable: Invalid string table");
|
||||||
strData = new char[strSize];
|
strData = new char[strSize];
|
||||||
*(unsigned*)strData = strSize;
|
*(unsigned *)strData = strSize;
|
||||||
// read the raw data into <strData>
|
// read the raw data into <strData>
|
||||||
f.read(strData + sizeof(unsigned), strSize - sizeof(unsigned));
|
f.read(strData + sizeof(unsigned), strSize - sizeof(unsigned));
|
||||||
s = f.tellg() - s;
|
s = f.tellg() - s;
|
||||||
if(s < strSize)
|
if (s < strSize)
|
||||||
stop("StringTable: Unexpected EOF");
|
stop("StringTable: Unexpected EOF");
|
||||||
init(strData);
|
init(strData);
|
||||||
delete[]strData;
|
delete[] strData;
|
||||||
}
|
}
|
||||||
StringTable(const set<string> &strings) {
|
StringTable(const set<string> &strings) {
|
||||||
/* Construct string table from given strings.
|
// Construct string table from given strings.
|
||||||
*/
|
|
||||||
char *p;
|
char *p;
|
||||||
set<string>::const_iterator it;
|
set<string>::const_iterator it;
|
||||||
size_t s;
|
size_t s;
|
||||||
|
|
||||||
// count required size for data
|
// count required size for data
|
||||||
for(length = sizeof(unsigned), it = strings.begin(); it != strings.end(); ++it) {
|
for (length = sizeof(unsigned), it = strings.begin(); it != strings.end();
|
||||||
|
++it) {
|
||||||
size_t l = (*it).size();
|
size_t l = (*it).size();
|
||||||
|
|
||||||
if(l > (unsigned) 0xFFFFFFFF)
|
if (l > (unsigned)0xFFFFFFFF)
|
||||||
stop("StringTable: String too long");
|
stop("StringTable: String too long");
|
||||||
if(l > 8) {
|
if (l > 8) {
|
||||||
length += l + 1;
|
length += l + 1;
|
||||||
if(length > (unsigned) 0xFFFFFFFF)
|
if (length > (unsigned)0xFFFFFFFF)
|
||||||
stop("StringTable: Symbol table too long");
|
stop("StringTable: Symbol table too long");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data = new char[length];
|
data = new char[length];
|
||||||
*(unsigned*)data = length;
|
*(unsigned *)data = length;
|
||||||
// populate data and directory
|
// populate data and directory
|
||||||
for(p = data + sizeof(unsigned), it = strings.begin(); it != strings.end(); ++it) {
|
for (p = data + sizeof(unsigned), it = strings.begin(); it != strings.end();
|
||||||
|
++it) {
|
||||||
const string &str = *it;
|
const string &str = *it;
|
||||||
size_t l = str.size();
|
size_t l = str.size();
|
||||||
if(l > 8) {
|
if (l > 8) {
|
||||||
directory.insert(make_pair(str, p - data));
|
directory.insert(make_pair(str, p - data));
|
||||||
KMP_MEMCPY(p, str.c_str(), l);
|
KMP_MEMCPY(p, str.c_str(), l);
|
||||||
p[l] = 0;
|
p[l] = 0;
|
||||||
|
|
@ -198,111 +190,107 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
~StringTable() {
|
~StringTable() { delete[] data; }
|
||||||
delete[] data;
|
// Returns encoding for given string based on this string table. Error if
|
||||||
}
|
// string length is greater than 8 but string is not in the string table
|
||||||
/* Returns encoding for given string based on this string table.
|
// -- returns 0.
|
||||||
Error if string length is greater than 8 but string is not in
|
|
||||||
the string table--returns 0.
|
|
||||||
*/
|
|
||||||
__int64 encode(const string &str) {
|
__int64 encode(const string &str) {
|
||||||
__int64 r;
|
__int64 r;
|
||||||
|
|
||||||
if(str.size() <= 8) {
|
if (str.size() <= 8) {
|
||||||
// encoded directly
|
// encoded directly
|
||||||
((char*)&r)[7] = 0;
|
((char *)&r)[7] = 0;
|
||||||
KMP_STRNCPY_S((char*)&r, sizeof(r), str.c_str(), 8);
|
KMP_STRNCPY_S((char *)&r, sizeof(r), str.c_str(), 8);
|
||||||
return r;
|
return r;
|
||||||
} else {
|
} else {
|
||||||
// represented as index into table
|
// represented as index into table
|
||||||
map<string,unsigned>::const_iterator it = directory.find(str);
|
map<string, unsigned>::const_iterator it = directory.find(str);
|
||||||
if(it == directory.end())
|
if (it == directory.end())
|
||||||
stop("StringTable::encode: String now found in string table");
|
stop("StringTable::encode: String now found in string table");
|
||||||
((unsigned*)&r)[0] = 0;
|
((unsigned *)&r)[0] = 0;
|
||||||
((unsigned*)&r)[1] = (*it).second;
|
((unsigned *)&r)[1] = (*it).second;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Returns string represented by x based on this string table.
|
// Returns string represented by x based on this string table. Error if x
|
||||||
Error if x references an invalid position in the table--returns
|
// references an invalid position in the table--returns the empty string.
|
||||||
the empty string.
|
|
||||||
*/
|
|
||||||
string decode(__int64 x) const {
|
string decode(__int64 x) const {
|
||||||
if(*(unsigned*)&x == 0) {
|
if (*(unsigned *)&x == 0) {
|
||||||
// represented as index into table
|
// represented as index into table
|
||||||
unsigned &p = ((unsigned*)&x)[1];
|
unsigned &p = ((unsigned *)&x)[1];
|
||||||
if(p >= length)
|
if (p >= length)
|
||||||
stop("StringTable::decode: Invalid string table lookup");
|
stop("StringTable::decode: Invalid string table lookup");
|
||||||
return string(data + p);
|
return string(data + p);
|
||||||
} else {
|
} else {
|
||||||
// encoded directly
|
// encoded directly
|
||||||
char *p = (char*)&x;
|
char *p = (char *)&x;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < 8 && p[i]; ++i);
|
for (i = 0; i < 8 && p[i]; ++i)
|
||||||
|
;
|
||||||
return string(p, i);
|
return string(p, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void write(ostream &os) {
|
void write(ostream &os) { os.write(data, length); }
|
||||||
os.write(data, length);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* for the named object file, determines the set of defined symbols and the set of undefined external symbols
|
// for the named object file, determines the set of defined symbols and the set
|
||||||
and writes them to <defined> and <undefined> respectively
|
// of undefined external symbols and writes them to <defined> and <undefined>
|
||||||
*/
|
// respectively
|
||||||
void computeExternalSymbols(const char *fileName, set<string> *defined, set<string> *undefined){
|
void computeExternalSymbols(const char *fileName, set<string> *defined,
|
||||||
|
set<string> *undefined) {
|
||||||
streampos fileSize;
|
streampos fileSize;
|
||||||
size_t strTabStart;
|
size_t strTabStart;
|
||||||
unsigned symTabStart, symNEntries;
|
unsigned symTabStart, symNEntries;
|
||||||
rstream f(fileName);
|
rstream f(fileName);
|
||||||
|
|
||||||
f.seekg(0,ios::end);
|
f.seekg(0, ios::end);
|
||||||
fileSize = f.tellg();
|
fileSize = f.tellg();
|
||||||
|
|
||||||
f.seekg(8);
|
f.seekg(8);
|
||||||
f >> symTabStart >> symNEntries;
|
f >> symTabStart >> symNEntries;
|
||||||
// seek to the string table
|
// seek to the string table
|
||||||
f.seekg(strTabStart = symTabStart + 18 * (size_t)symNEntries);
|
f.seekg(strTabStart = symTabStart + 18 * (size_t)symNEntries);
|
||||||
if(f.eof()) {
|
if (f.eof()) {
|
||||||
printf("computeExternalSymbols: fileName='%s', fileSize = %lu, symTabStart = %u, symNEntries = %u\n",
|
printf("computeExternalSymbols: fileName='%s', fileSize = %lu, symTabStart "
|
||||||
fileName, (unsigned long) fileSize, symTabStart, symNEntries);
|
"= %u, symNEntries = %u\n",
|
||||||
|
fileName, (unsigned long)fileSize, symTabStart, symNEntries);
|
||||||
stop("computeExternalSymbols: Unexpected EOF 1");
|
stop("computeExternalSymbols: Unexpected EOF 1");
|
||||||
}
|
}
|
||||||
StringTable stringTable(f); // read the string table
|
StringTable stringTable(f); // read the string table
|
||||||
if(f.tellg() != fileSize)
|
if (f.tellg() != fileSize)
|
||||||
stop("computeExternalSymbols: Unexpected data after string table");
|
stop("computeExternalSymbols: Unexpected data after string table");
|
||||||
|
|
||||||
f.clear();
|
f.clear();
|
||||||
f.seekg(symTabStart); // seek to the symbol table
|
f.seekg(symTabStart); // seek to the symbol table
|
||||||
|
|
||||||
defined->clear(); undefined->clear();
|
defined->clear();
|
||||||
for(int i = 0; i < symNEntries; ++i) {
|
undefined->clear();
|
||||||
|
for (int i = 0; i < symNEntries; ++i) {
|
||||||
// process each entry
|
// process each entry
|
||||||
Symbol e;
|
Symbol e;
|
||||||
|
|
||||||
if(f.eof())
|
if (f.eof())
|
||||||
stop("computeExternalSymbols: Unexpected EOF 2");
|
stop("computeExternalSymbols: Unexpected EOF 2");
|
||||||
f>>e;
|
f >> e;
|
||||||
if(f.fail())
|
if (f.fail())
|
||||||
stop("computeExternalSymbols: File read error");
|
stop("computeExternalSymbols: File read error");
|
||||||
if(e.nAux) { // auxiliary entry: skip
|
if (e.nAux) { // auxiliary entry: skip
|
||||||
f.seekg(e.nAux * 18, ios::cur);
|
f.seekg(e.nAux * 18, ios::cur);
|
||||||
i += e.nAux;
|
i += e.nAux;
|
||||||
}
|
}
|
||||||
// if symbol is extern and defined in the current file, insert it
|
// if symbol is extern and defined in the current file, insert it
|
||||||
if(e.storageClass == 2)
|
if (e.storageClass == 2)
|
||||||
if(e.sectionNum)
|
if (e.sectionNum)
|
||||||
defined->insert(stringTable.decode(e.name));
|
defined->insert(stringTable.decode(e.name));
|
||||||
else
|
else
|
||||||
undefined->insert(stringTable.decode(e.name));
|
undefined->insert(stringTable.decode(e.name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For each occurrence of an external symbol in the object file named by
|
// For each occurrence of an external symbol in the object file named by
|
||||||
by <fileName> that is a member of <hide>, renames it by prefixing
|
// by <fileName> that is a member of <hide>, renames it by prefixing
|
||||||
with "__kmp_external_", writing back the file in-place
|
// with "__kmp_external_", writing back the file in-place
|
||||||
*/
|
|
||||||
void hideSymbols(char *fileName, const set<string> &hide) {
|
void hideSymbols(char *fileName, const set<string> &hide) {
|
||||||
static const string prefix("__kmp_external_");
|
static const string prefix("__kmp_external_");
|
||||||
set<string> strings; // set of all occurring symbols, appropriately prefixed
|
set<string> strings; // set of all occurring symbols, appropriately prefixed
|
||||||
|
|
@ -312,40 +300,40 @@ void hideSymbols(char *fileName, const set<string> &hide) {
|
||||||
int i;
|
int i;
|
||||||
rstream in(fileName);
|
rstream in(fileName);
|
||||||
|
|
||||||
in.seekg(0,ios::end);
|
in.seekg(0, ios::end);
|
||||||
fileSize = in.tellg();
|
fileSize = in.tellg();
|
||||||
|
|
||||||
in.seekg(8);
|
in.seekg(8);
|
||||||
in >> symTabStart >> symNEntries;
|
in >> symTabStart >> symNEntries;
|
||||||
in.seekg(strTabStart = symTabStart + 18 * (size_t)symNEntries);
|
in.seekg(strTabStart = symTabStart + 18 * (size_t)symNEntries);
|
||||||
if(in.eof())
|
if (in.eof())
|
||||||
stop("hideSymbols: Unexpected EOF");
|
stop("hideSymbols: Unexpected EOF");
|
||||||
StringTable stringTableOld(in); // read original string table
|
StringTable stringTableOld(in); // read original string table
|
||||||
|
|
||||||
if(in.tellg() != fileSize)
|
if (in.tellg() != fileSize)
|
||||||
stop("hideSymbols: Unexpected data after string table");
|
stop("hideSymbols: Unexpected data after string table");
|
||||||
|
|
||||||
// compute set of occurring strings with prefix added
|
// compute set of occurring strings with prefix added
|
||||||
for(i = 0; i < symNEntries; ++i) {
|
for (i = 0; i < symNEntries; ++i) {
|
||||||
Symbol e;
|
Symbol e;
|
||||||
|
|
||||||
in.seekg(symTabStart + i * 18);
|
in.seekg(symTabStart + i * 18);
|
||||||
if(in.eof())
|
if (in.eof())
|
||||||
stop("hideSymbols: Unexpected EOF");
|
stop("hideSymbols: Unexpected EOF");
|
||||||
in >> e;
|
in >> e;
|
||||||
if(in.fail())
|
if (in.fail())
|
||||||
stop("hideSymbols: File read error");
|
stop("hideSymbols: File read error");
|
||||||
if(e.nAux)
|
if (e.nAux)
|
||||||
i += e.nAux;
|
i += e.nAux;
|
||||||
const string &s = stringTableOld.decode(e.name);
|
const string &s = stringTableOld.decode(e.name);
|
||||||
// if symbol is extern and found in <hide>, prefix and insert into strings,
|
// if symbol is extern and found in <hide>, prefix and insert into strings,
|
||||||
// otherwise, just insert into strings without prefix
|
// otherwise, just insert into strings without prefix
|
||||||
strings.insert( (e.storageClass == 2 && hide.find(s) != hide.end()) ?
|
strings.insert(
|
||||||
prefix + s : s);
|
(e.storageClass == 2 && hide.find(s) != hide.end()) ? prefix + s : s);
|
||||||
}
|
}
|
||||||
|
|
||||||
ofstream out(fileName, ios::trunc | ios::out | ios::binary);
|
ofstream out(fileName, ios::trunc | ios::out | ios::binary);
|
||||||
if(!out.is_open())
|
if (!out.is_open())
|
||||||
stop("hideSymbols: Error opening output file");
|
stop("hideSymbols: Error opening output file");
|
||||||
|
|
||||||
// make new string table from string set
|
// make new string table from string set
|
||||||
|
|
@ -356,32 +344,32 @@ void hideSymbols(char *fileName, const set<string> &hide) {
|
||||||
char *buf = new char[symTabStart];
|
char *buf = new char[symTabStart];
|
||||||
in.read(buf, symTabStart);
|
in.read(buf, symTabStart);
|
||||||
out.write(buf, symTabStart);
|
out.write(buf, symTabStart);
|
||||||
delete []buf;
|
delete[] buf;
|
||||||
|
|
||||||
// copy input symbol table to output symbol table with name translation
|
// copy input symbol table to output symbol table with name translation
|
||||||
for(i = 0; i < symNEntries; ++i) {
|
for (i = 0; i < symNEntries; ++i) {
|
||||||
Symbol e;
|
Symbol e;
|
||||||
|
|
||||||
in.seekg(symTabStart + i*18);
|
in.seekg(symTabStart + i * 18);
|
||||||
if(in.eof())
|
if (in.eof())
|
||||||
stop("hideSymbols: Unexpected EOF");
|
stop("hideSymbols: Unexpected EOF");
|
||||||
in >> e;
|
in >> e;
|
||||||
if(in.fail())
|
if (in.fail())
|
||||||
stop("hideSymbols: File read error");
|
stop("hideSymbols: File read error");
|
||||||
const string &s = stringTableOld.decode(e.name);
|
const string &s = stringTableOld.decode(e.name);
|
||||||
out.seekp(symTabStart + i*18);
|
out.seekp(symTabStart + i * 18);
|
||||||
e.name = stringTableNew.encode( (e.storageClass == 2 && hide.find(s) != hide.end()) ?
|
e.name = stringTableNew.encode(
|
||||||
prefix + s : s);
|
(e.storageClass == 2 && hide.find(s) != hide.end()) ? prefix + s : s);
|
||||||
out.write((char*)&e, 18);
|
out.write((char *)&e, 18);
|
||||||
if(out.fail())
|
if (out.fail())
|
||||||
stop("hideSymbols: File write error");
|
stop("hideSymbols: File write error");
|
||||||
if(e.nAux) {
|
if (e.nAux) {
|
||||||
// copy auxiliary symbol table entries
|
// copy auxiliary symbol table entries
|
||||||
int nAux = e.nAux;
|
int nAux = e.nAux;
|
||||||
for(int j = 1; j <= nAux; ++j) {
|
for (int j = 1; j <= nAux; ++j) {
|
||||||
in >> e;
|
in >> e;
|
||||||
out.seekp(symTabStart + (i + j) * 18);
|
out.seekp(symTabStart + (i + j) * 18);
|
||||||
out.write((char*)&e, 18);
|
out.write((char *)&e, 18);
|
||||||
}
|
}
|
||||||
i += nAux;
|
i += nAux;
|
||||||
}
|
}
|
||||||
|
|
@ -391,13 +379,12 @@ void hideSymbols(char *fileName, const set<string> &hide) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true iff <a> and <b> have no common element
|
// returns true iff <a> and <b> have no common element
|
||||||
template <class T>
|
template <class T> bool isDisjoint(const set<T> &a, const set<T> &b) {
|
||||||
bool isDisjoint(const set<T> &a, const set<T> &b) {
|
|
||||||
set<T>::const_iterator ita, itb;
|
set<T>::const_iterator ita, itb;
|
||||||
|
|
||||||
for(ita = a.begin(), itb = b.begin(); ita != a.end() && itb != b.end();) {
|
for (ita = a.begin(), itb = b.begin(); ita != a.end() && itb != b.end();) {
|
||||||
const T &ta = *ita, &tb = *itb;
|
const T &ta = *ita, &tb = *itb;
|
||||||
if(ta < tb)
|
if (ta < tb)
|
||||||
++ita;
|
++ita;
|
||||||
else if (tb < ta)
|
else if (tb < ta)
|
||||||
++itb;
|
++itb;
|
||||||
|
|
@ -407,29 +394,31 @@ bool isDisjoint(const set<T> &a, const set<T> &b) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* precondition: <defined> and <undefined> are arrays with <nTotal> elements where
|
// PRE: <defined> and <undefined> are arrays with <nTotal> elements where
|
||||||
<nTotal> >= <nExternal>. The first <nExternal> elements correspond to the external object
|
// <nTotal> >= <nExternal>. The first <nExternal> elements correspond to the
|
||||||
files and the rest correspond to the internal object files.
|
// external object files and the rest correspond to the internal object files.
|
||||||
postcondition: file x is said to depend on file y if undefined[x] and defined[y] are not
|
// POST: file x is said to depend on file y if undefined[x] and defined[y] are
|
||||||
disjoint. Returns the transitive closure of the set of internal object files, as a set of
|
// not disjoint. Returns the transitive closure of the set of internal object
|
||||||
file indexes, under the 'depends on' relation, minus the set of internal object files.
|
// files, as a set of file indexes, under the 'depends on' relation, minus the
|
||||||
*/
|
// set of internal object files.
|
||||||
set<int> *findRequiredExternal(int nExternal, int nTotal, set<string> *defined, set<string> *undefined) {
|
set<int> *findRequiredExternal(int nExternal, int nTotal, set<string> *defined,
|
||||||
|
set<string> *undefined) {
|
||||||
set<int> *required = new set<int>;
|
set<int> *required = new set<int>;
|
||||||
set<int> fresh[2];
|
set<int> fresh[2];
|
||||||
int i, cur = 0;
|
int i, cur = 0;
|
||||||
bool changed;
|
bool changed;
|
||||||
|
|
||||||
for(i = nTotal - 1; i >= nExternal; --i)
|
for (i = nTotal - 1; i >= nExternal; --i)
|
||||||
fresh[cur].insert(i);
|
fresh[cur].insert(i);
|
||||||
do {
|
do {
|
||||||
changed = false;
|
changed = false;
|
||||||
for(set<int>::iterator it = fresh[cur].begin(); it != fresh[cur].end(); ++it) {
|
for (set<int>::iterator it = fresh[cur].begin(); it != fresh[cur].end();
|
||||||
|
++it) {
|
||||||
set<string> &s = undefined[*it];
|
set<string> &s = undefined[*it];
|
||||||
|
|
||||||
for(i = 0; i < nExternal; ++i) {
|
for (i = 0; i < nExternal; ++i) {
|
||||||
if(required->find(i) == required->end()) {
|
if (required->find(i) == required->end()) {
|
||||||
if(!isDisjoint(defined[i], s)) {
|
if (!isDisjoint(defined[i], s)) {
|
||||||
// found a new qualifying element
|
// found a new qualifying element
|
||||||
required->insert(i);
|
required->insert(i);
|
||||||
fresh[1 - cur].insert(i);
|
fresh[1 - cur].insert(i);
|
||||||
|
|
@ -440,7 +429,7 @@ set<int> *findRequiredExternal(int nExternal, int nTotal, set<string> *defined,
|
||||||
}
|
}
|
||||||
fresh[cur].clear();
|
fresh[cur].clear();
|
||||||
cur = 1 - cur;
|
cur = 1 - cur;
|
||||||
} while(changed);
|
} while (changed);
|
||||||
return required;
|
return required;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -449,49 +438,49 @@ int main(int argc, char **argv) {
|
||||||
set<string> *defined, *undefined;
|
set<string> *defined, *undefined;
|
||||||
set<int>::iterator it;
|
set<int>::iterator it;
|
||||||
|
|
||||||
if(argc < 3)
|
if (argc < 3)
|
||||||
stop("Please specify a positive integer followed by a list of object filenames");
|
stop("Please specify a positive integer followed by a list of object "
|
||||||
|
"filenames");
|
||||||
nExternal = atoi(argv[1]);
|
nExternal = atoi(argv[1]);
|
||||||
if(nExternal <= 0)
|
if (nExternal <= 0)
|
||||||
stop("Please specify a positive integer followed by a list of object filenames");
|
stop("Please specify a positive integer followed by a list of object "
|
||||||
if(nExternal + 2 > argc)
|
"filenames");
|
||||||
|
if (nExternal + 2 > argc)
|
||||||
stop("Too few external objects");
|
stop("Too few external objects");
|
||||||
nInternal = argc - nExternal - 2;
|
nInternal = argc - nExternal - 2;
|
||||||
defined = new set<string>[argc - 2];
|
defined = new set<string>[argc - 2];
|
||||||
undefined = new set<string>[argc - 2];
|
undefined = new set<string>[argc - 2];
|
||||||
|
|
||||||
// determine the set of defined and undefined external symbols
|
// determine the set of defined and undefined external symbols
|
||||||
for(i = 2; i < argc; ++i)
|
for (i = 2; i < argc; ++i)
|
||||||
computeExternalSymbols(argv[i], defined + i - 2, undefined + i - 2);
|
computeExternalSymbols(argv[i], defined + i - 2, undefined + i - 2);
|
||||||
|
|
||||||
// determine the set of required external files
|
// determine the set of required external files
|
||||||
set<int> *requiredExternal = findRequiredExternal(nExternal, argc - 2, defined, undefined);
|
set<int> *requiredExternal =
|
||||||
|
findRequiredExternal(nExternal, argc - 2, defined, undefined);
|
||||||
set<string> hide;
|
set<string> hide;
|
||||||
|
|
||||||
/* determine the set of symbols to hide--namely defined external symbols of the
|
// determine the set of symbols to hide--namely defined external symbols of
|
||||||
required external files
|
// the required external files
|
||||||
*/
|
for (it = requiredExternal->begin(); it != requiredExternal->end(); ++it) {
|
||||||
for(it = requiredExternal->begin(); it != requiredExternal->end(); ++it) {
|
|
||||||
int idx = *it;
|
int idx = *it;
|
||||||
set<string>::iterator it2;
|
set<string>::iterator it2;
|
||||||
/* We have to insert one element at a time instead of inserting a range because
|
// We have to insert one element at a time instead of inserting a range
|
||||||
the insert member function taking a range doesn't exist on Windows* OS, at least
|
// because the insert member function taking a range doesn't exist on
|
||||||
at the time of this writing.
|
// Windows* OS, at least at the time of this writing.
|
||||||
*/
|
for (it2 = defined[idx].begin(); it2 != defined[idx].end(); ++it2)
|
||||||
for(it2 = defined[idx].begin(); it2 != defined[idx].end(); ++it2)
|
|
||||||
hide.insert(*it2);
|
hide.insert(*it2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* process the external files--removing those that are not required and hiding
|
// process the external files--removing those that are not required and hiding
|
||||||
the appropriate symbols in the others
|
// the appropriate symbols in the others
|
||||||
*/
|
for (i = 0; i < nExternal; ++i)
|
||||||
for(i = 0; i < nExternal; ++i)
|
if (requiredExternal->find(i) != requiredExternal->end())
|
||||||
if(requiredExternal->find(i) != requiredExternal->end())
|
|
||||||
hideSymbols(argv[2 + i], hide);
|
hideSymbols(argv[2 + i], hide);
|
||||||
else
|
else
|
||||||
remove(argv[2 + i]);
|
remove(argv[2 + i]);
|
||||||
// hide the appropriate symbols in the internal files
|
// hide the appropriate symbols in the internal files
|
||||||
for(i = nExternal + 2; i < argc; ++i)
|
for (i = nExternal + 2; i < argc; ++i)
|
||||||
hideSymbols(argv[i], hide);
|
hideSymbols(argv[i], hide);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -22,19 +22,21 @@
|
||||||
@param gtid Global thread ID of encountering thread
|
@param gtid Global thread ID of encountering thread
|
||||||
@param cncl_kind Cancellation kind (parallel, for, sections, taskgroup)
|
@param cncl_kind Cancellation kind (parallel, for, sections, taskgroup)
|
||||||
|
|
||||||
@return returns true if the cancellation request has been activated and the execution thread
|
@return returns true if the cancellation request has been activated and the
|
||||||
needs to proceed to the end of the canceled region.
|
execution thread needs to proceed to the end of the canceled region.
|
||||||
|
|
||||||
Request cancellation of the binding OpenMP region.
|
Request cancellation of the binding OpenMP region.
|
||||||
*/
|
*/
|
||||||
kmp_int32 __kmpc_cancel(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
|
kmp_int32 __kmpc_cancel(ident_t *loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
|
||||||
kmp_info_t *this_thr = __kmp_threads [ gtid ];
|
kmp_info_t *this_thr = __kmp_threads[gtid];
|
||||||
|
|
||||||
KC_TRACE( 10, ("__kmpc_cancel: T#%d request %d OMP_CANCELLATION=%d\n", gtid, cncl_kind, __kmp_omp_cancellation) );
|
KC_TRACE(10, ("__kmpc_cancel: T#%d request %d OMP_CANCELLATION=%d\n", gtid,
|
||||||
|
cncl_kind, __kmp_omp_cancellation));
|
||||||
|
|
||||||
KMP_DEBUG_ASSERT(cncl_kind != cancel_noreq);
|
KMP_DEBUG_ASSERT(cncl_kind != cancel_noreq);
|
||||||
KMP_DEBUG_ASSERT(cncl_kind == cancel_parallel || cncl_kind == cancel_loop ||
|
KMP_DEBUG_ASSERT(cncl_kind == cancel_parallel || cncl_kind == cancel_loop ||
|
||||||
cncl_kind == cancel_sections || cncl_kind == cancel_taskgroup);
|
cncl_kind == cancel_sections ||
|
||||||
|
cncl_kind == cancel_taskgroup);
|
||||||
KMP_DEBUG_ASSERT(__kmp_get_gtid() == gtid);
|
KMP_DEBUG_ASSERT(__kmp_get_gtid() == gtid);
|
||||||
|
|
||||||
if (__kmp_omp_cancellation) {
|
if (__kmp_omp_cancellation) {
|
||||||
|
|
@ -47,12 +49,14 @@ kmp_int32 __kmpc_cancel(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
|
||||||
{
|
{
|
||||||
kmp_team_t *this_team = this_thr->th.th_team;
|
kmp_team_t *this_team = this_thr->th.th_team;
|
||||||
KMP_DEBUG_ASSERT(this_team);
|
KMP_DEBUG_ASSERT(this_team);
|
||||||
kmp_int32 old = KMP_COMPARE_AND_STORE_RET32(&(this_team->t.t_cancel_request), cancel_noreq, cncl_kind);
|
kmp_int32 old = KMP_COMPARE_AND_STORE_RET32(
|
||||||
|
&(this_team->t.t_cancel_request), cancel_noreq, cncl_kind);
|
||||||
if (old == cancel_noreq || old == cncl_kind) {
|
if (old == cancel_noreq || old == cncl_kind) {
|
||||||
//printf("__kmpc_cancel: this_team->t.t_cancel_request=%d @ %p\n",
|
// printf("__kmpc_cancel: this_team->t.t_cancel_request=%d @ %p\n",
|
||||||
// this_team->t.t_cancel_request, &(this_team->t.t_cancel_request));
|
// this_team->t.t_cancel_request,
|
||||||
// we do not have a cancellation request in this team or we do have one
|
// &(this_team->t.t_cancel_request));
|
||||||
// that matches the current request -> cancel
|
// we do not have a cancellation request in this team or we do have
|
||||||
|
// one that matches the current request -> cancel
|
||||||
return 1 /* true */;
|
return 1 /* true */;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -61,31 +65,31 @@ kmp_int32 __kmpc_cancel(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
|
||||||
// cancellation requests for a task group
|
// cancellation requests for a task group
|
||||||
// are handled through the taskgroup structure
|
// are handled through the taskgroup structure
|
||||||
{
|
{
|
||||||
kmp_taskdata_t* task;
|
kmp_taskdata_t *task;
|
||||||
kmp_taskgroup_t* taskgroup;
|
kmp_taskgroup_t *taskgroup;
|
||||||
|
|
||||||
task = this_thr->th.th_current_task;
|
task = this_thr->th.th_current_task;
|
||||||
KMP_DEBUG_ASSERT( task );
|
KMP_DEBUG_ASSERT(task);
|
||||||
|
|
||||||
taskgroup = task->td_taskgroup;
|
taskgroup = task->td_taskgroup;
|
||||||
if (taskgroup) {
|
if (taskgroup) {
|
||||||
kmp_int32 old = KMP_COMPARE_AND_STORE_RET32(&(taskgroup->cancel_request), cancel_noreq, cncl_kind);
|
kmp_int32 old = KMP_COMPARE_AND_STORE_RET32(
|
||||||
|
&(taskgroup->cancel_request), cancel_noreq, cncl_kind);
|
||||||
if (old == cancel_noreq || old == cncl_kind) {
|
if (old == cancel_noreq || old == cncl_kind) {
|
||||||
// we do not have a cancellation request in this taskgroup or we do have one
|
// we do not have a cancellation request in this taskgroup or we do
|
||||||
// that matches the current request -> cancel
|
// have one that matches the current request -> cancel
|
||||||
return 1 /* true */;
|
return 1 /* true */;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// TODO: what needs to happen here?
|
// TODO: what needs to happen here?
|
||||||
// the specification disallows cancellation w/o taskgroups
|
// the specification disallows cancellation w/o taskgroups
|
||||||
// so we might do anything here, let's abort for now
|
// so we might do anything here, let's abort for now
|
||||||
KMP_ASSERT( 0 /* false */);
|
KMP_ASSERT(0 /* false */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
KMP_ASSERT (0 /* false */);
|
KMP_ASSERT(0 /* false */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,19 +104,23 @@ kmp_int32 __kmpc_cancel(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
|
||||||
@param gtid Global thread ID of encountering thread
|
@param gtid Global thread ID of encountering thread
|
||||||
@param cncl_kind Cancellation kind (parallel, for, sections, taskgroup)
|
@param cncl_kind Cancellation kind (parallel, for, sections, taskgroup)
|
||||||
|
|
||||||
@return returns true if a matching cancellation request has been flagged in the RTL and the
|
@return returns true if a matching cancellation request has been flagged in the
|
||||||
encountering thread has to cancel..
|
RTL and the encountering thread has to cancel..
|
||||||
|
|
||||||
Cancellation point for the encountering thread.
|
Cancellation point for the encountering thread.
|
||||||
*/
|
*/
|
||||||
kmp_int32 __kmpc_cancellationpoint(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
|
kmp_int32 __kmpc_cancellationpoint(ident_t *loc_ref, kmp_int32 gtid,
|
||||||
kmp_info_t *this_thr = __kmp_threads [ gtid ];
|
kmp_int32 cncl_kind) {
|
||||||
|
kmp_info_t *this_thr = __kmp_threads[gtid];
|
||||||
|
|
||||||
KC_TRACE( 10, ("__kmpc_cancellationpoint: T#%d request %d OMP_CANCELLATION=%d\n", gtid, cncl_kind, __kmp_omp_cancellation) );
|
KC_TRACE(10,
|
||||||
|
("__kmpc_cancellationpoint: T#%d request %d OMP_CANCELLATION=%d\n",
|
||||||
|
gtid, cncl_kind, __kmp_omp_cancellation));
|
||||||
|
|
||||||
KMP_DEBUG_ASSERT(cncl_kind != cancel_noreq);
|
KMP_DEBUG_ASSERT(cncl_kind != cancel_noreq);
|
||||||
KMP_DEBUG_ASSERT(cncl_kind == cancel_parallel || cncl_kind == cancel_loop ||
|
KMP_DEBUG_ASSERT(cncl_kind == cancel_parallel || cncl_kind == cancel_loop ||
|
||||||
cncl_kind == cancel_sections || cncl_kind == cancel_taskgroup);
|
cncl_kind == cancel_sections ||
|
||||||
|
cncl_kind == cancel_taskgroup);
|
||||||
KMP_DEBUG_ASSERT(__kmp_get_gtid() == gtid);
|
KMP_DEBUG_ASSERT(__kmp_get_gtid() == gtid);
|
||||||
|
|
||||||
if (__kmp_omp_cancellation) {
|
if (__kmp_omp_cancellation) {
|
||||||
|
|
@ -131,9 +139,8 @@ kmp_int32 __kmpc_cancellationpoint(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 c
|
||||||
// cancellation point so we can cancel
|
// cancellation point so we can cancel
|
||||||
return 1 /* true */;
|
return 1 /* true */;
|
||||||
}
|
}
|
||||||
KMP_ASSERT( 0 /* false */);
|
KMP_ASSERT(0 /* false */);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// we do not have a cancellation request pending, so we just
|
// we do not have a cancellation request pending, so we just
|
||||||
// ignore this cancellation point
|
// ignore this cancellation point
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -144,27 +151,24 @@ kmp_int32 __kmpc_cancellationpoint(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 c
|
||||||
// cancellation requests for a task group
|
// cancellation requests for a task group
|
||||||
// are handled through the taskgroup structure
|
// are handled through the taskgroup structure
|
||||||
{
|
{
|
||||||
kmp_taskdata_t* task;
|
kmp_taskdata_t *task;
|
||||||
kmp_taskgroup_t* taskgroup;
|
kmp_taskgroup_t *taskgroup;
|
||||||
|
|
||||||
task = this_thr->th.th_current_task;
|
task = this_thr->th.th_current_task;
|
||||||
KMP_DEBUG_ASSERT( task );
|
KMP_DEBUG_ASSERT(task);
|
||||||
|
|
||||||
taskgroup = task->td_taskgroup;
|
taskgroup = task->td_taskgroup;
|
||||||
if (taskgroup) {
|
if (taskgroup) {
|
||||||
// return the current status of cancellation for the
|
// return the current status of cancellation for the taskgroup
|
||||||
// taskgroup
|
|
||||||
return !!taskgroup->cancel_request;
|
return !!taskgroup->cancel_request;
|
||||||
}
|
} else {
|
||||||
else {
|
// if a cancellation point is encountered by a task that does not
|
||||||
// if a cancellation point is encountered by a task
|
// belong to a taskgroup, it is OK to ignore it
|
||||||
// that does not belong to a taskgroup, it is OK
|
|
||||||
// to ignore it
|
|
||||||
return 0 /* false */;
|
return 0 /* false */;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
KMP_ASSERT (0 /* false */);
|
KMP_ASSERT(0 /* false */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -178,17 +182,16 @@ kmp_int32 __kmpc_cancellationpoint(ident_t* loc_ref, kmp_int32 gtid, kmp_int32 c
|
||||||
@param loc_ref location of the original task directive
|
@param loc_ref location of the original task directive
|
||||||
@param gtid Global thread ID of encountering thread
|
@param gtid Global thread ID of encountering thread
|
||||||
|
|
||||||
@return returns true if a matching cancellation request has been flagged in the RTL and the
|
@return returns true if a matching cancellation request has been flagged in the
|
||||||
encountering thread has to cancel..
|
RTL and the encountering thread has to cancel..
|
||||||
|
|
||||||
Barrier with cancellation point to send threads from the barrier to the
|
Barrier with cancellation point to send threads from the barrier to the
|
||||||
end of the parallel region. Needs a special code pattern as documented
|
end of the parallel region. Needs a special code pattern as documented
|
||||||
in the design document for the cancellation feature.
|
in the design document for the cancellation feature.
|
||||||
*/
|
*/
|
||||||
kmp_int32
|
kmp_int32 __kmpc_cancel_barrier(ident_t *loc, kmp_int32 gtid) {
|
||||||
__kmpc_cancel_barrier(ident_t *loc, kmp_int32 gtid) {
|
|
||||||
int ret = 0 /* false */;
|
int ret = 0 /* false */;
|
||||||
kmp_info_t *this_thr = __kmp_threads [ gtid ];
|
kmp_info_t *this_thr = __kmp_threads[gtid];
|
||||||
kmp_team_t *this_team = this_thr->th.th_team;
|
kmp_team_t *this_team = this_thr->th.th_team;
|
||||||
|
|
||||||
KMP_DEBUG_ASSERT(__kmp_get_gtid() == gtid);
|
KMP_DEBUG_ASSERT(__kmp_get_gtid() == gtid);
|
||||||
|
|
@ -217,20 +220,19 @@ __kmpc_cancel_barrier(ident_t *loc, kmp_int32 gtid) {
|
||||||
// leaving the above barrier
|
// leaving the above barrier
|
||||||
__kmpc_barrier(loc, gtid);
|
__kmpc_barrier(loc, gtid);
|
||||||
this_team->t.t_cancel_request = cancel_noreq;
|
this_team->t.t_cancel_request = cancel_noreq;
|
||||||
// synchronize the threads again to make sure we
|
// synchronize the threads again to make sure we do not have any run-away
|
||||||
// do not have any run-away threads that cause a race
|
// threads that cause a race on the cancellation flag
|
||||||
// on the cancellation flag
|
|
||||||
__kmpc_barrier(loc, gtid);
|
__kmpc_barrier(loc, gtid);
|
||||||
break;
|
break;
|
||||||
case cancel_taskgroup:
|
case cancel_taskgroup:
|
||||||
// this case should not occur
|
// this case should not occur
|
||||||
KMP_ASSERT (0 /* false */ );
|
KMP_ASSERT(0 /* false */);
|
||||||
break;
|
break;
|
||||||
case cancel_noreq:
|
case cancel_noreq:
|
||||||
// do nothing
|
// do nothing
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
KMP_ASSERT ( 0 /* false */);
|
KMP_ASSERT(0 /* false */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -242,8 +244,8 @@ __kmpc_cancel_barrier(ident_t *loc, kmp_int32 gtid) {
|
||||||
@param loc_ref location of the original task directive
|
@param loc_ref location of the original task directive
|
||||||
@param gtid Global thread ID of encountering thread
|
@param gtid Global thread ID of encountering thread
|
||||||
|
|
||||||
@return returns true if a matching cancellation request has been flagged in the RTL and the
|
@return returns true if a matching cancellation request has been flagged in the
|
||||||
encountering thread has to cancel..
|
RTL and the encountering thread has to cancel..
|
||||||
|
|
||||||
Query function to query the current status of cancellation requests.
|
Query function to query the current status of cancellation requests.
|
||||||
Can be used to implement the following pattern:
|
Can be used to implement the following pattern:
|
||||||
|
|
@ -260,15 +262,13 @@ int __kmp_get_cancellation_status(int cancel_kind) {
|
||||||
switch (cancel_kind) {
|
switch (cancel_kind) {
|
||||||
case cancel_parallel:
|
case cancel_parallel:
|
||||||
case cancel_loop:
|
case cancel_loop:
|
||||||
case cancel_sections:
|
case cancel_sections: {
|
||||||
{
|
|
||||||
kmp_team_t *this_team = this_thr->th.th_team;
|
kmp_team_t *this_team = this_thr->th.th_team;
|
||||||
return this_team->t.t_cancel_request == cancel_kind;
|
return this_team->t.t_cancel_request == cancel_kind;
|
||||||
}
|
}
|
||||||
case cancel_taskgroup:
|
case cancel_taskgroup: {
|
||||||
{
|
kmp_taskdata_t *task;
|
||||||
kmp_taskdata_t* task;
|
kmp_taskgroup_t *taskgroup;
|
||||||
kmp_taskgroup_t* taskgroup;
|
|
||||||
task = this_thr->th.th_current_task;
|
task = this_thr->th.th_current_task;
|
||||||
taskgroup = task->td_taskgroup;
|
taskgroup = task->td_taskgroup;
|
||||||
return taskgroup && taskgroup->cancel_request;
|
return taskgroup && taskgroup->cancel_request;
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -19,124 +19,116 @@
|
||||||
#include "kmp_io.h"
|
#include "kmp_io.h"
|
||||||
|
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
void
|
void __kmp_debug_printf_stdout(char const *format, ...) {
|
||||||
__kmp_debug_printf_stdout( char const * format, ... )
|
|
||||||
{
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start( ap, format );
|
va_start(ap, format);
|
||||||
|
|
||||||
__kmp_vprintf( kmp_out, format, ap );
|
__kmp_vprintf(kmp_out, format, ap);
|
||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void __kmp_debug_printf(char const *format, ...) {
|
||||||
__kmp_debug_printf( char const * format, ... )
|
|
||||||
{
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start( ap, format );
|
va_start(ap, format);
|
||||||
|
|
||||||
__kmp_vprintf( kmp_err, format, ap );
|
__kmp_vprintf(kmp_err, format, ap);
|
||||||
|
|
||||||
va_end( ap );
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KMP_USE_ASSERT
|
#ifdef KMP_USE_ASSERT
|
||||||
int
|
int __kmp_debug_assert(char const *msg, char const *file, int line) {
|
||||||
__kmp_debug_assert(
|
|
||||||
char const * msg,
|
|
||||||
char const * file,
|
|
||||||
int line
|
|
||||||
) {
|
|
||||||
|
|
||||||
if ( file == NULL ) {
|
if (file == NULL) {
|
||||||
file = KMP_I18N_STR( UnknownFile );
|
file = KMP_I18N_STR(UnknownFile);
|
||||||
} else {
|
} else {
|
||||||
// Remove directories from path, leave only file name. File name is enough, there is no need
|
// Remove directories from path, leave only file name. File name is enough,
|
||||||
// in bothering developers and customers with full paths.
|
// there is no need in bothering developers and customers with full paths.
|
||||||
char const * slash = strrchr( file, '/' );
|
char const *slash = strrchr(file, '/');
|
||||||
if ( slash != NULL ) {
|
if (slash != NULL) {
|
||||||
file = slash + 1;
|
file = slash + 1;
|
||||||
}; // if
|
}; // if
|
||||||
}; // if
|
}; // if
|
||||||
|
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
__kmp_acquire_bootstrap_lock( & __kmp_stdio_lock );
|
__kmp_acquire_bootstrap_lock(&__kmp_stdio_lock);
|
||||||
__kmp_debug_printf( "Assertion failure at %s(%d): %s.\n", file, line, msg );
|
__kmp_debug_printf("Assertion failure at %s(%d): %s.\n", file, line, msg);
|
||||||
__kmp_release_bootstrap_lock( & __kmp_stdio_lock );
|
__kmp_release_bootstrap_lock(&__kmp_stdio_lock);
|
||||||
#ifdef USE_ASSERT_BREAK
|
#ifdef USE_ASSERT_BREAK
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
DebugBreak();
|
DebugBreak();
|
||||||
#endif
|
#endif
|
||||||
#endif // USE_ASSERT_BREAK
|
#endif // USE_ASSERT_BREAK
|
||||||
#ifdef USE_ASSERT_STALL
|
#ifdef USE_ASSERT_STALL
|
||||||
/* __kmp_infinite_loop(); */
|
/* __kmp_infinite_loop(); */
|
||||||
for(;;);
|
for (;;)
|
||||||
#endif // USE_ASSERT_STALL
|
;
|
||||||
#ifdef USE_ASSERT_SEG
|
#endif // USE_ASSERT_STALL
|
||||||
|
#ifdef USE_ASSERT_SEG
|
||||||
{
|
{
|
||||||
int volatile * ZERO = (int*) 0;
|
int volatile *ZERO = (int *)0;
|
||||||
++ (*ZERO);
|
++(*ZERO);
|
||||||
}
|
}
|
||||||
#endif // USE_ASSERT_SEG
|
#endif // USE_ASSERT_SEG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__kmp_msg(
|
__kmp_msg(kmp_ms_fatal, KMP_MSG(AssertionFailure, file, line),
|
||||||
kmp_ms_fatal,
|
KMP_HNT(SubmitBugReport), __kmp_msg_null);
|
||||||
KMP_MSG( AssertionFailure, file, line ),
|
|
||||||
KMP_HNT( SubmitBugReport ),
|
|
||||||
__kmp_msg_null
|
|
||||||
);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
} // __kmp_debug_assert
|
} // __kmp_debug_assert
|
||||||
|
|
||||||
#endif // KMP_USE_ASSERT
|
#endif // KMP_USE_ASSERT
|
||||||
|
|
||||||
/* Dump debugging buffer to stderr */
|
/* Dump debugging buffer to stderr */
|
||||||
void
|
void __kmp_dump_debug_buffer(void) {
|
||||||
__kmp_dump_debug_buffer( void )
|
if (__kmp_debug_buffer != NULL) {
|
||||||
{
|
|
||||||
if ( __kmp_debug_buffer != NULL ) {
|
|
||||||
int i;
|
int i;
|
||||||
int dc = __kmp_debug_count;
|
int dc = __kmp_debug_count;
|
||||||
char *db = & __kmp_debug_buffer[ (dc % __kmp_debug_buf_lines) * __kmp_debug_buf_chars ];
|
char *db = &__kmp_debug_buffer[(dc % __kmp_debug_buf_lines) *
|
||||||
char *db_end = & __kmp_debug_buffer[ __kmp_debug_buf_lines * __kmp_debug_buf_chars ];
|
__kmp_debug_buf_chars];
|
||||||
|
char *db_end =
|
||||||
|
&__kmp_debug_buffer[__kmp_debug_buf_lines * __kmp_debug_buf_chars];
|
||||||
char *db2;
|
char *db2;
|
||||||
|
|
||||||
__kmp_acquire_bootstrap_lock( & __kmp_stdio_lock );
|
__kmp_acquire_bootstrap_lock(&__kmp_stdio_lock);
|
||||||
__kmp_printf_no_lock( "\nStart dump of debugging buffer (entry=%d):\n",
|
__kmp_printf_no_lock("\nStart dump of debugging buffer (entry=%d):\n",
|
||||||
dc % __kmp_debug_buf_lines );
|
dc % __kmp_debug_buf_lines);
|
||||||
|
|
||||||
for ( i = 0; i < __kmp_debug_buf_lines; i++ ) {
|
for (i = 0; i < __kmp_debug_buf_lines; i++) {
|
||||||
|
|
||||||
if ( *db != '\0' ) {
|
if (*db != '\0') {
|
||||||
/* Fix up where no carriage return before string termination char */
|
/* Fix up where no carriage return before string termination char */
|
||||||
for ( db2 = db + 1; db2 < db + __kmp_debug_buf_chars - 1; db2 ++) {
|
for (db2 = db + 1; db2 < db + __kmp_debug_buf_chars - 1; db2++) {
|
||||||
if ( *db2 == '\0' ) {
|
if (*db2 == '\0') {
|
||||||
if ( *(db2-1) != '\n' ) { *db2 = '\n'; *(db2+1) = '\0'; }
|
if (*(db2 - 1) != '\n') {
|
||||||
|
*db2 = '\n';
|
||||||
|
*(db2 + 1) = '\0';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Handle case at end by shortening the printed message by one char if necessary */
|
/* Handle case at end by shortening the printed message by one char if
|
||||||
if ( db2 == db + __kmp_debug_buf_chars - 1 &&
|
* necessary */
|
||||||
*db2 == '\0' && *(db2-1) != '\n' ) {
|
if (db2 == db + __kmp_debug_buf_chars - 1 && *db2 == '\0' &&
|
||||||
*(db2-1) = '\n';
|
*(db2 - 1) != '\n') {
|
||||||
|
*(db2 - 1) = '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
__kmp_printf_no_lock( "%4d: %.*s", i, __kmp_debug_buf_chars, db );
|
__kmp_printf_no_lock("%4d: %.*s", i, __kmp_debug_buf_chars, db);
|
||||||
*db = '\0'; /* only let it print once! */
|
*db = '\0'; /* only let it print once! */
|
||||||
}
|
}
|
||||||
|
|
||||||
db += __kmp_debug_buf_chars;
|
db += __kmp_debug_buf_chars;
|
||||||
if ( db >= db_end )
|
if (db >= db_end)
|
||||||
db = __kmp_debug_buffer;
|
db = __kmp_debug_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
__kmp_printf_no_lock( "End dump of debugging buffer (entry=%d).\n\n",
|
__kmp_printf_no_lock("End dump of debugging buffer (entry=%d).\n\n",
|
||||||
( dc+i-1 ) % __kmp_debug_buf_lines );
|
(dc + i - 1) % __kmp_debug_buf_lines);
|
||||||
__kmp_release_bootstrap_lock( & __kmp_stdio_lock );
|
__kmp_release_bootstrap_lock(&__kmp_stdio_lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,94 +19,155 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Build-time assertion.
|
// Build-time assertion.
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// New C++11 style build assert
|
// New C++11 style build assert
|
||||||
#define KMP_BUILD_ASSERT( expr ) static_assert(expr, "Build condition error")
|
#define KMP_BUILD_ASSERT(expr) static_assert(expr, "Build condition error")
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Run-time assertions.
|
// Run-time assertions.
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
extern void __kmp_dump_debug_buffer( void );
|
extern void __kmp_dump_debug_buffer(void);
|
||||||
|
|
||||||
#ifdef KMP_USE_ASSERT
|
#ifdef KMP_USE_ASSERT
|
||||||
extern int __kmp_debug_assert( char const * expr, char const * file, int line );
|
extern int __kmp_debug_assert(char const *expr, char const *file, int line);
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
#define KMP_ASSERT( cond ) ( (cond) ? 0 : __kmp_debug_assert( #cond, __FILE__, __LINE__ ) )
|
#define KMP_ASSERT(cond) \
|
||||||
#define KMP_ASSERT2( cond, msg ) ( (cond) ? 0 : __kmp_debug_assert( (msg), __FILE__, __LINE__ ) )
|
((cond) ? 0 : __kmp_debug_assert(#cond, __FILE__, __LINE__))
|
||||||
#define KMP_DEBUG_ASSERT( cond ) KMP_ASSERT( cond )
|
#define KMP_ASSERT2(cond, msg) \
|
||||||
#define KMP_DEBUG_ASSERT2( cond, msg ) KMP_ASSERT2( cond, msg )
|
((cond) ? 0 : __kmp_debug_assert((msg), __FILE__, __LINE__))
|
||||||
#else
|
#define KMP_DEBUG_ASSERT(cond) KMP_ASSERT(cond)
|
||||||
// Do not expose condition in release build. Use "assertion failure".
|
#define KMP_DEBUG_ASSERT2(cond, msg) KMP_ASSERT2(cond, msg)
|
||||||
#define KMP_ASSERT( cond ) ( (cond) ? 0 : __kmp_debug_assert( "assertion failure", __FILE__, __LINE__ ) )
|
|
||||||
#define KMP_ASSERT2( cond, msg ) KMP_ASSERT( cond )
|
|
||||||
#define KMP_DEBUG_ASSERT( cond ) 0
|
|
||||||
#define KMP_DEBUG_ASSERT2( cond, msg ) 0
|
|
||||||
#endif // KMP_DEBUG
|
|
||||||
#else
|
#else
|
||||||
#define KMP_ASSERT( cond ) 0
|
// Do not expose condition in release build. Use "assertion failure".
|
||||||
#define KMP_ASSERT2( cond, msg ) 0
|
#define KMP_ASSERT(cond) \
|
||||||
#define KMP_DEBUG_ASSERT( cond ) 0
|
((cond) ? 0 : __kmp_debug_assert("assertion failure", __FILE__, __LINE__))
|
||||||
#define KMP_DEBUG_ASSERT2( cond, msg ) 0
|
#define KMP_ASSERT2(cond, msg) KMP_ASSERT(cond)
|
||||||
|
#define KMP_DEBUG_ASSERT(cond) 0
|
||||||
|
#define KMP_DEBUG_ASSERT2(cond, msg) 0
|
||||||
|
#endif // KMP_DEBUG
|
||||||
|
#else
|
||||||
|
#define KMP_ASSERT(cond) 0
|
||||||
|
#define KMP_ASSERT2(cond, msg) 0
|
||||||
|
#define KMP_DEBUG_ASSERT(cond) 0
|
||||||
|
#define KMP_DEBUG_ASSERT2(cond, msg) 0
|
||||||
#endif // KMP_USE_ASSERT
|
#endif // KMP_USE_ASSERT
|
||||||
|
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
extern void __kmp_debug_printf_stdout( char const * format, ... );
|
extern void __kmp_debug_printf_stdout(char const *format, ...);
|
||||||
#endif
|
#endif
|
||||||
extern void __kmp_debug_printf( char const * format, ... );
|
extern void __kmp_debug_printf(char const *format, ...);
|
||||||
|
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
|
|
||||||
extern int kmp_a_debug;
|
extern int kmp_a_debug;
|
||||||
extern int kmp_b_debug;
|
extern int kmp_b_debug;
|
||||||
extern int kmp_c_debug;
|
extern int kmp_c_debug;
|
||||||
extern int kmp_d_debug;
|
extern int kmp_d_debug;
|
||||||
extern int kmp_e_debug;
|
extern int kmp_e_debug;
|
||||||
extern int kmp_f_debug;
|
extern int kmp_f_debug;
|
||||||
extern int kmp_diag;
|
extern int kmp_diag;
|
||||||
|
|
||||||
#define KA_TRACE(d,x) if (kmp_a_debug >= d) { __kmp_debug_printf x ; }
|
#define KA_TRACE(d, x) \
|
||||||
#define KB_TRACE(d,x) if (kmp_b_debug >= d) { __kmp_debug_printf x ; }
|
if (kmp_a_debug >= d) { \
|
||||||
#define KC_TRACE(d,x) if (kmp_c_debug >= d) { __kmp_debug_printf x ; }
|
__kmp_debug_printf x; \
|
||||||
#define KD_TRACE(d,x) if (kmp_d_debug >= d) { __kmp_debug_printf x ; }
|
}
|
||||||
#define KE_TRACE(d,x) if (kmp_e_debug >= d) { __kmp_debug_printf x ; }
|
#define KB_TRACE(d, x) \
|
||||||
#define KF_TRACE(d,x) if (kmp_f_debug >= d) { __kmp_debug_printf x ; }
|
if (kmp_b_debug >= d) { \
|
||||||
#define K_DIAG(d,x) {if (kmp_diag == d) { __kmp_debug_printf_stdout x ; } }
|
__kmp_debug_printf x; \
|
||||||
|
}
|
||||||
|
#define KC_TRACE(d, x) \
|
||||||
|
if (kmp_c_debug >= d) { \
|
||||||
|
__kmp_debug_printf x; \
|
||||||
|
}
|
||||||
|
#define KD_TRACE(d, x) \
|
||||||
|
if (kmp_d_debug >= d) { \
|
||||||
|
__kmp_debug_printf x; \
|
||||||
|
}
|
||||||
|
#define KE_TRACE(d, x) \
|
||||||
|
if (kmp_e_debug >= d) { \
|
||||||
|
__kmp_debug_printf x; \
|
||||||
|
}
|
||||||
|
#define KF_TRACE(d, x) \
|
||||||
|
if (kmp_f_debug >= d) { \
|
||||||
|
__kmp_debug_printf x; \
|
||||||
|
}
|
||||||
|
#define K_DIAG(d, x) \
|
||||||
|
{ \
|
||||||
|
if (kmp_diag == d) { \
|
||||||
|
__kmp_debug_printf_stdout x; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#define KA_DUMP(d,x) if (kmp_a_debug >= d) { int ks; __kmp_disable(&ks); (x) ; __kmp_enable(ks); }
|
#define KA_DUMP(d, x) \
|
||||||
#define KB_DUMP(d,x) if (kmp_b_debug >= d) { int ks; __kmp_disable(&ks); (x) ; __kmp_enable(ks); }
|
if (kmp_a_debug >= d) { \
|
||||||
#define KC_DUMP(d,x) if (kmp_c_debug >= d) { int ks; __kmp_disable(&ks); (x) ; __kmp_enable(ks); }
|
int ks; \
|
||||||
#define KD_DUMP(d,x) if (kmp_d_debug >= d) { int ks; __kmp_disable(&ks); (x) ; __kmp_enable(ks); }
|
__kmp_disable(&ks); \
|
||||||
#define KE_DUMP(d,x) if (kmp_e_debug >= d) { int ks; __kmp_disable(&ks); (x) ; __kmp_enable(ks); }
|
(x); \
|
||||||
#define KF_DUMP(d,x) if (kmp_f_debug >= d) { int ks; __kmp_disable(&ks); (x) ; __kmp_enable(ks); }
|
__kmp_enable(ks); \
|
||||||
|
}
|
||||||
|
#define KB_DUMP(d, x) \
|
||||||
|
if (kmp_b_debug >= d) { \
|
||||||
|
int ks; \
|
||||||
|
__kmp_disable(&ks); \
|
||||||
|
(x); \
|
||||||
|
__kmp_enable(ks); \
|
||||||
|
}
|
||||||
|
#define KC_DUMP(d, x) \
|
||||||
|
if (kmp_c_debug >= d) { \
|
||||||
|
int ks; \
|
||||||
|
__kmp_disable(&ks); \
|
||||||
|
(x); \
|
||||||
|
__kmp_enable(ks); \
|
||||||
|
}
|
||||||
|
#define KD_DUMP(d, x) \
|
||||||
|
if (kmp_d_debug >= d) { \
|
||||||
|
int ks; \
|
||||||
|
__kmp_disable(&ks); \
|
||||||
|
(x); \
|
||||||
|
__kmp_enable(ks); \
|
||||||
|
}
|
||||||
|
#define KE_DUMP(d, x) \
|
||||||
|
if (kmp_e_debug >= d) { \
|
||||||
|
int ks; \
|
||||||
|
__kmp_disable(&ks); \
|
||||||
|
(x); \
|
||||||
|
__kmp_enable(ks); \
|
||||||
|
}
|
||||||
|
#define KF_DUMP(d, x) \
|
||||||
|
if (kmp_f_debug >= d) { \
|
||||||
|
int ks; \
|
||||||
|
__kmp_disable(&ks); \
|
||||||
|
(x); \
|
||||||
|
__kmp_enable(ks); \
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define KA_TRACE(d,x) /* nothing to do */
|
#define KA_TRACE(d, x) /* nothing to do */
|
||||||
#define KB_TRACE(d,x) /* nothing to do */
|
#define KB_TRACE(d, x) /* nothing to do */
|
||||||
#define KC_TRACE(d,x) /* nothing to do */
|
#define KC_TRACE(d, x) /* nothing to do */
|
||||||
#define KD_TRACE(d,x) /* nothing to do */
|
#define KD_TRACE(d, x) /* nothing to do */
|
||||||
#define KE_TRACE(d,x) /* nothing to do */
|
#define KE_TRACE(d, x) /* nothing to do */
|
||||||
#define KF_TRACE(d,x) /* nothing to do */
|
#define KF_TRACE(d, x) /* nothing to do */
|
||||||
#define K_DIAG(d,x) {}/* nothing to do */
|
#define K_DIAG(d, x) \
|
||||||
|
{} /* nothing to do */
|
||||||
|
|
||||||
#define KA_DUMP(d,x) /* nothing to do */
|
#define KA_DUMP(d, x) /* nothing to do */
|
||||||
#define KB_DUMP(d,x) /* nothing to do */
|
#define KB_DUMP(d, x) /* nothing to do */
|
||||||
#define KC_DUMP(d,x) /* nothing to do */
|
#define KC_DUMP(d, x) /* nothing to do */
|
||||||
#define KD_DUMP(d,x) /* nothing to do */
|
#define KD_DUMP(d, x) /* nothing to do */
|
||||||
#define KE_DUMP(d,x) /* nothing to do */
|
#define KE_DUMP(d, x) /* nothing to do */
|
||||||
#define KF_DUMP(d,x) /* nothing to do */
|
#define KF_DUMP(d, x) /* nothing to do */
|
||||||
|
|
||||||
#endif // KMP_DEBUG
|
#endif // KMP_DEBUG
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif /* KMP_DEBUG_H */
|
#endif /* KMP_DEBUG_H */
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#if USE_DEBUGGER
|
#if USE_DEBUGGER
|
||||||
/*
|
/*
|
||||||
* kmp_debugger.c -- debugger support.
|
* kmp_debugger.cpp -- debugger support.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -19,47 +19,36 @@
|
||||||
#include "kmp_omp.h"
|
#include "kmp_omp.h"
|
||||||
#include "kmp_str.h"
|
#include "kmp_str.h"
|
||||||
|
|
||||||
/*
|
// NOTE: All variable names are known to the debugger, do not change!
|
||||||
NOTE: All variable names are known to the debugger, do not change!
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
extern kmp_omp_struct_info_t __kmp_omp_debug_struct_info;
|
extern kmp_omp_struct_info_t __kmp_omp_debug_struct_info;
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
int __kmp_debugging = FALSE; // Boolean whether currently debugging OpenMP RTL.
|
int __kmp_debugging = FALSE; // Boolean whether currently debugging OpenMP RTL.
|
||||||
|
|
||||||
#define offset_and_size_of( structure, field ) \
|
#define offset_and_size_of(structure, field) \
|
||||||
{ \
|
{ offsetof(structure, field), sizeof(((structure *)NULL)->field) }
|
||||||
offsetof( structure, field ), \
|
|
||||||
sizeof( ( (structure *) NULL)->field ) \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define offset_and_size_not_available \
|
#define offset_and_size_not_available \
|
||||||
{ -1, -1 }
|
{ -1, -1 }
|
||||||
|
|
||||||
#define addr_and_size_of( var ) \
|
#define addr_and_size_of(var) \
|
||||||
{ \
|
{ (kmp_uint64)(&var), sizeof(var) }
|
||||||
(kmp_uint64)( & var ), \
|
|
||||||
sizeof( var ) \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define nthr_buffer_size 1024
|
#define nthr_buffer_size 1024
|
||||||
static kmp_int32
|
static kmp_int32 kmp_omp_nthr_info_buffer[nthr_buffer_size] = {
|
||||||
kmp_omp_nthr_info_buffer[ nthr_buffer_size ] =
|
nthr_buffer_size * sizeof(kmp_int32)};
|
||||||
{ nthr_buffer_size * sizeof( kmp_int32 ) };
|
|
||||||
|
|
||||||
/* TODO: Check punctuation for various platforms here */
|
/* TODO: Check punctuation for various platforms here */
|
||||||
static char func_microtask[] = "__kmp_invoke_microtask";
|
static char func_microtask[] = "__kmp_invoke_microtask";
|
||||||
static char func_fork[] = "__kmpc_fork_call";
|
static char func_fork[] = "__kmpc_fork_call";
|
||||||
static char func_fork_teams[] = "__kmpc_fork_teams";
|
static char func_fork_teams[] = "__kmpc_fork_teams";
|
||||||
|
|
||||||
|
|
||||||
// Various info about runtime structures: addresses, field offsets, sizes, etc.
|
// Various info about runtime structures: addresses, field offsets, sizes, etc.
|
||||||
kmp_omp_struct_info_t
|
kmp_omp_struct_info_t __kmp_omp_debug_struct_info = {
|
||||||
__kmp_omp_debug_struct_info = {
|
|
||||||
|
|
||||||
/* Change this only if you make a fundamental data structure change here */
|
/* Change this only if you make a fundamental data structure change here */
|
||||||
KMP_OMP_VERSION,
|
KMP_OMP_VERSION,
|
||||||
|
|
@ -67,166 +56,167 @@ __kmp_omp_debug_struct_info = {
|
||||||
/* sanity check. Only should be checked if versions are identical
|
/* sanity check. Only should be checked if versions are identical
|
||||||
* This is also used for backward compatibility to get the runtime
|
* This is also used for backward compatibility to get the runtime
|
||||||
* structure size if it the runtime is older than the interface */
|
* structure size if it the runtime is older than the interface */
|
||||||
sizeof( kmp_omp_struct_info_t ),
|
sizeof(kmp_omp_struct_info_t),
|
||||||
|
|
||||||
/* OpenMP RTL version info. */
|
/* OpenMP RTL version info. */
|
||||||
addr_and_size_of( __kmp_version_major ),
|
addr_and_size_of(__kmp_version_major),
|
||||||
addr_and_size_of( __kmp_version_minor ),
|
addr_and_size_of(__kmp_version_minor),
|
||||||
addr_and_size_of( __kmp_version_build ),
|
addr_and_size_of(__kmp_version_build),
|
||||||
addr_and_size_of( __kmp_openmp_version ),
|
addr_and_size_of(__kmp_openmp_version),
|
||||||
{ (kmp_uint64)( __kmp_copyright ) + KMP_VERSION_MAGIC_LEN, 0 }, // Skip magic prefix.
|
{(kmp_uint64)(__kmp_copyright) + KMP_VERSION_MAGIC_LEN,
|
||||||
|
0}, // Skip magic prefix.
|
||||||
|
|
||||||
/* Various globals. */
|
/* Various globals. */
|
||||||
addr_and_size_of( __kmp_threads ),
|
addr_and_size_of(__kmp_threads),
|
||||||
addr_and_size_of( __kmp_root ),
|
addr_and_size_of(__kmp_root),
|
||||||
addr_and_size_of( __kmp_threads_capacity ),
|
addr_and_size_of(__kmp_threads_capacity),
|
||||||
addr_and_size_of( __kmp_monitor ),
|
addr_and_size_of(__kmp_monitor),
|
||||||
#if ! KMP_USE_DYNAMIC_LOCK
|
#if !KMP_USE_DYNAMIC_LOCK
|
||||||
addr_and_size_of( __kmp_user_lock_table ),
|
addr_and_size_of(__kmp_user_lock_table),
|
||||||
#endif
|
#endif
|
||||||
addr_and_size_of( func_microtask ),
|
addr_and_size_of(func_microtask),
|
||||||
addr_and_size_of( func_fork ),
|
addr_and_size_of(func_fork),
|
||||||
addr_and_size_of( func_fork_teams ),
|
addr_and_size_of(func_fork_teams),
|
||||||
addr_and_size_of( __kmp_team_counter ),
|
addr_and_size_of(__kmp_team_counter),
|
||||||
addr_and_size_of( __kmp_task_counter ),
|
addr_and_size_of(__kmp_task_counter),
|
||||||
addr_and_size_of( kmp_omp_nthr_info_buffer ),
|
addr_and_size_of(kmp_omp_nthr_info_buffer),
|
||||||
sizeof( void * ),
|
sizeof(void *),
|
||||||
OMP_LOCK_T_SIZE < sizeof(void *),
|
OMP_LOCK_T_SIZE < sizeof(void *),
|
||||||
bs_last_barrier,
|
bs_last_barrier,
|
||||||
INITIAL_TASK_DEQUE_SIZE,
|
INITIAL_TASK_DEQUE_SIZE,
|
||||||
|
|
||||||
// thread structure information
|
// thread structure information
|
||||||
sizeof( kmp_base_info_t ),
|
sizeof(kmp_base_info_t),
|
||||||
offset_and_size_of( kmp_base_info_t, th_info ),
|
offset_and_size_of(kmp_base_info_t, th_info),
|
||||||
offset_and_size_of( kmp_base_info_t, th_team ),
|
offset_and_size_of(kmp_base_info_t, th_team),
|
||||||
offset_and_size_of( kmp_base_info_t, th_root ),
|
offset_and_size_of(kmp_base_info_t, th_root),
|
||||||
offset_and_size_of( kmp_base_info_t, th_serial_team ),
|
offset_and_size_of(kmp_base_info_t, th_serial_team),
|
||||||
offset_and_size_of( kmp_base_info_t, th_ident ),
|
offset_and_size_of(kmp_base_info_t, th_ident),
|
||||||
offset_and_size_of( kmp_base_info_t, th_spin_here ),
|
offset_and_size_of(kmp_base_info_t, th_spin_here),
|
||||||
offset_and_size_of( kmp_base_info_t, th_next_waiting ),
|
offset_and_size_of(kmp_base_info_t, th_next_waiting),
|
||||||
offset_and_size_of( kmp_base_info_t, th_task_team ),
|
offset_and_size_of(kmp_base_info_t, th_task_team),
|
||||||
offset_and_size_of( kmp_base_info_t, th_current_task ),
|
offset_and_size_of(kmp_base_info_t, th_current_task),
|
||||||
offset_and_size_of( kmp_base_info_t, th_task_state ),
|
offset_and_size_of(kmp_base_info_t, th_task_state),
|
||||||
offset_and_size_of( kmp_base_info_t, th_bar ),
|
offset_and_size_of(kmp_base_info_t, th_bar),
|
||||||
offset_and_size_of( kmp_bstate_t, b_worker_arrived ),
|
offset_and_size_of(kmp_bstate_t, b_worker_arrived),
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
// teams information
|
// teams information
|
||||||
offset_and_size_of( kmp_base_info_t, th_teams_microtask),
|
offset_and_size_of(kmp_base_info_t, th_teams_microtask),
|
||||||
offset_and_size_of( kmp_base_info_t, th_teams_level),
|
offset_and_size_of(kmp_base_info_t, th_teams_level),
|
||||||
offset_and_size_of( kmp_teams_size_t, nteams ),
|
offset_and_size_of(kmp_teams_size_t, nteams),
|
||||||
offset_and_size_of( kmp_teams_size_t, nth ),
|
offset_and_size_of(kmp_teams_size_t, nth),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// kmp_desc structure (for info field above)
|
// kmp_desc structure (for info field above)
|
||||||
sizeof( kmp_desc_base_t ),
|
sizeof(kmp_desc_base_t),
|
||||||
offset_and_size_of( kmp_desc_base_t, ds_tid ),
|
offset_and_size_of(kmp_desc_base_t, ds_tid),
|
||||||
offset_and_size_of( kmp_desc_base_t, ds_gtid ),
|
offset_and_size_of(kmp_desc_base_t, ds_gtid),
|
||||||
// On Windows* OS, ds_thread contains a thread /handle/, which is not usable, while thread /id/
|
// On Windows* OS, ds_thread contains a thread /handle/, which is not usable,
|
||||||
// is in ds_thread_id.
|
// while thread /id/ is in ds_thread_id.
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
offset_and_size_of( kmp_desc_base_t, ds_thread_id),
|
offset_and_size_of(kmp_desc_base_t, ds_thread_id),
|
||||||
#else
|
#else
|
||||||
offset_and_size_of( kmp_desc_base_t, ds_thread),
|
offset_and_size_of(kmp_desc_base_t, ds_thread),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// team structure information
|
// team structure information
|
||||||
sizeof( kmp_base_team_t ),
|
sizeof(kmp_base_team_t),
|
||||||
offset_and_size_of( kmp_base_team_t, t_master_tid ),
|
offset_and_size_of(kmp_base_team_t, t_master_tid),
|
||||||
offset_and_size_of( kmp_base_team_t, t_ident ),
|
offset_and_size_of(kmp_base_team_t, t_ident),
|
||||||
offset_and_size_of( kmp_base_team_t, t_parent ),
|
offset_and_size_of(kmp_base_team_t, t_parent),
|
||||||
offset_and_size_of( kmp_base_team_t, t_nproc ),
|
offset_and_size_of(kmp_base_team_t, t_nproc),
|
||||||
offset_and_size_of( kmp_base_team_t, t_threads ),
|
offset_and_size_of(kmp_base_team_t, t_threads),
|
||||||
offset_and_size_of( kmp_base_team_t, t_serialized ),
|
offset_and_size_of(kmp_base_team_t, t_serialized),
|
||||||
offset_and_size_of( kmp_base_team_t, t_id ),
|
offset_and_size_of(kmp_base_team_t, t_id),
|
||||||
offset_and_size_of( kmp_base_team_t, t_pkfn ),
|
offset_and_size_of(kmp_base_team_t, t_pkfn),
|
||||||
offset_and_size_of( kmp_base_team_t, t_task_team ),
|
offset_and_size_of(kmp_base_team_t, t_task_team),
|
||||||
offset_and_size_of( kmp_base_team_t, t_implicit_task_taskdata ),
|
offset_and_size_of(kmp_base_team_t, t_implicit_task_taskdata),
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
offset_and_size_of( kmp_base_team_t, t_cancel_request ),
|
offset_and_size_of(kmp_base_team_t, t_cancel_request),
|
||||||
#endif
|
#endif
|
||||||
offset_and_size_of( kmp_base_team_t, t_bar ),
|
offset_and_size_of(kmp_base_team_t, t_bar),
|
||||||
offset_and_size_of( kmp_balign_team_t, b_master_arrived ),
|
offset_and_size_of(kmp_balign_team_t, b_master_arrived),
|
||||||
offset_and_size_of( kmp_balign_team_t, b_team_arrived ),
|
offset_and_size_of(kmp_balign_team_t, b_team_arrived),
|
||||||
|
|
||||||
// root structure information
|
// root structure information
|
||||||
sizeof( kmp_base_root_t ),
|
sizeof(kmp_base_root_t),
|
||||||
offset_and_size_of( kmp_base_root_t, r_root_team ),
|
offset_and_size_of(kmp_base_root_t, r_root_team),
|
||||||
offset_and_size_of( kmp_base_root_t, r_hot_team ),
|
offset_and_size_of(kmp_base_root_t, r_hot_team),
|
||||||
offset_and_size_of( kmp_base_root_t, r_uber_thread ),
|
offset_and_size_of(kmp_base_root_t, r_uber_thread),
|
||||||
offset_and_size_not_available,
|
offset_and_size_not_available,
|
||||||
|
|
||||||
// ident structure information
|
// ident structure information
|
||||||
sizeof( ident_t ),
|
sizeof(ident_t),
|
||||||
offset_and_size_of( ident_t, psource ),
|
offset_and_size_of(ident_t, psource),
|
||||||
offset_and_size_of( ident_t, flags ),
|
offset_and_size_of(ident_t, flags),
|
||||||
|
|
||||||
// lock structure information
|
// lock structure information
|
||||||
sizeof( kmp_base_queuing_lock_t ),
|
sizeof(kmp_base_queuing_lock_t),
|
||||||
offset_and_size_of( kmp_base_queuing_lock_t, initialized ),
|
offset_and_size_of(kmp_base_queuing_lock_t, initialized),
|
||||||
offset_and_size_of( kmp_base_queuing_lock_t, location ),
|
offset_and_size_of(kmp_base_queuing_lock_t, location),
|
||||||
offset_and_size_of( kmp_base_queuing_lock_t, tail_id ),
|
offset_and_size_of(kmp_base_queuing_lock_t, tail_id),
|
||||||
offset_and_size_of( kmp_base_queuing_lock_t, head_id ),
|
offset_and_size_of(kmp_base_queuing_lock_t, head_id),
|
||||||
offset_and_size_of( kmp_base_queuing_lock_t, next_ticket ),
|
offset_and_size_of(kmp_base_queuing_lock_t, next_ticket),
|
||||||
offset_and_size_of( kmp_base_queuing_lock_t, now_serving ),
|
offset_and_size_of(kmp_base_queuing_lock_t, now_serving),
|
||||||
offset_and_size_of( kmp_base_queuing_lock_t, owner_id ),
|
offset_and_size_of(kmp_base_queuing_lock_t, owner_id),
|
||||||
offset_and_size_of( kmp_base_queuing_lock_t, depth_locked ),
|
offset_and_size_of(kmp_base_queuing_lock_t, depth_locked),
|
||||||
offset_and_size_of( kmp_base_queuing_lock_t, flags ),
|
offset_and_size_of(kmp_base_queuing_lock_t, flags),
|
||||||
|
|
||||||
#if ! KMP_USE_DYNAMIC_LOCK
|
#if !KMP_USE_DYNAMIC_LOCK
|
||||||
/* Lock table. */
|
/* Lock table. */
|
||||||
sizeof( kmp_lock_table_t ),
|
sizeof(kmp_lock_table_t),
|
||||||
offset_and_size_of( kmp_lock_table_t, used ),
|
offset_and_size_of(kmp_lock_table_t, used),
|
||||||
offset_and_size_of( kmp_lock_table_t, allocated ),
|
offset_and_size_of(kmp_lock_table_t, allocated),
|
||||||
offset_and_size_of( kmp_lock_table_t, table ),
|
offset_and_size_of(kmp_lock_table_t, table),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Task team structure information.
|
// Task team structure information.
|
||||||
sizeof( kmp_base_task_team_t ),
|
sizeof(kmp_base_task_team_t),
|
||||||
offset_and_size_of( kmp_base_task_team_t, tt_threads_data ),
|
offset_and_size_of(kmp_base_task_team_t, tt_threads_data),
|
||||||
offset_and_size_of( kmp_base_task_team_t, tt_found_tasks ),
|
offset_and_size_of(kmp_base_task_team_t, tt_found_tasks),
|
||||||
offset_and_size_of( kmp_base_task_team_t, tt_nproc ),
|
offset_and_size_of(kmp_base_task_team_t, tt_nproc),
|
||||||
offset_and_size_of( kmp_base_task_team_t, tt_unfinished_threads ),
|
offset_and_size_of(kmp_base_task_team_t, tt_unfinished_threads),
|
||||||
offset_and_size_of( kmp_base_task_team_t, tt_active ),
|
offset_and_size_of(kmp_base_task_team_t, tt_active),
|
||||||
|
|
||||||
// task_data_t.
|
// task_data_t.
|
||||||
sizeof( kmp_taskdata_t ),
|
sizeof(kmp_taskdata_t),
|
||||||
offset_and_size_of( kmp_taskdata_t, td_task_id ),
|
offset_and_size_of(kmp_taskdata_t, td_task_id),
|
||||||
offset_and_size_of( kmp_taskdata_t, td_flags ),
|
offset_and_size_of(kmp_taskdata_t, td_flags),
|
||||||
offset_and_size_of( kmp_taskdata_t, td_team ),
|
offset_and_size_of(kmp_taskdata_t, td_team),
|
||||||
offset_and_size_of( kmp_taskdata_t, td_parent ),
|
offset_and_size_of(kmp_taskdata_t, td_parent),
|
||||||
offset_and_size_of( kmp_taskdata_t, td_level ),
|
offset_and_size_of(kmp_taskdata_t, td_level),
|
||||||
offset_and_size_of( kmp_taskdata_t, td_ident ),
|
offset_and_size_of(kmp_taskdata_t, td_ident),
|
||||||
offset_and_size_of( kmp_taskdata_t, td_allocated_child_tasks ),
|
offset_and_size_of(kmp_taskdata_t, td_allocated_child_tasks),
|
||||||
offset_and_size_of( kmp_taskdata_t, td_incomplete_child_tasks ),
|
offset_and_size_of(kmp_taskdata_t, td_incomplete_child_tasks),
|
||||||
|
|
||||||
offset_and_size_of( kmp_taskdata_t, td_taskwait_ident ),
|
offset_and_size_of(kmp_taskdata_t, td_taskwait_ident),
|
||||||
offset_and_size_of( kmp_taskdata_t, td_taskwait_counter ),
|
offset_and_size_of(kmp_taskdata_t, td_taskwait_counter),
|
||||||
offset_and_size_of( kmp_taskdata_t, td_taskwait_thread ),
|
offset_and_size_of(kmp_taskdata_t, td_taskwait_thread),
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
offset_and_size_of( kmp_taskdata_t, td_taskgroup ),
|
offset_and_size_of(kmp_taskdata_t, td_taskgroup),
|
||||||
offset_and_size_of( kmp_taskgroup_t, count ),
|
offset_and_size_of(kmp_taskgroup_t, count),
|
||||||
offset_and_size_of( kmp_taskgroup_t, cancel_request ),
|
offset_and_size_of(kmp_taskgroup_t, cancel_request),
|
||||||
|
|
||||||
offset_and_size_of( kmp_taskdata_t, td_depnode ),
|
offset_and_size_of(kmp_taskdata_t, td_depnode),
|
||||||
offset_and_size_of( kmp_depnode_list_t, node ),
|
offset_and_size_of(kmp_depnode_list_t, node),
|
||||||
offset_and_size_of( kmp_depnode_list_t, next ),
|
offset_and_size_of(kmp_depnode_list_t, next),
|
||||||
offset_and_size_of( kmp_base_depnode_t, successors ),
|
offset_and_size_of(kmp_base_depnode_t, successors),
|
||||||
offset_and_size_of( kmp_base_depnode_t, task ),
|
offset_and_size_of(kmp_base_depnode_t, task),
|
||||||
offset_and_size_of( kmp_base_depnode_t, npredecessors ),
|
offset_and_size_of(kmp_base_depnode_t, npredecessors),
|
||||||
offset_and_size_of( kmp_base_depnode_t, nrefs ),
|
offset_and_size_of(kmp_base_depnode_t, nrefs),
|
||||||
#endif
|
#endif
|
||||||
offset_and_size_of( kmp_task_t, routine ),
|
offset_and_size_of(kmp_task_t, routine),
|
||||||
|
|
||||||
// thread_data_t.
|
// thread_data_t.
|
||||||
sizeof( kmp_thread_data_t ),
|
sizeof(kmp_thread_data_t),
|
||||||
offset_and_size_of( kmp_base_thread_data_t, td_deque ),
|
offset_and_size_of(kmp_base_thread_data_t, td_deque),
|
||||||
offset_and_size_of( kmp_base_thread_data_t, td_deque_size ),
|
offset_and_size_of(kmp_base_thread_data_t, td_deque_size),
|
||||||
offset_and_size_of( kmp_base_thread_data_t, td_deque_head ),
|
offset_and_size_of(kmp_base_thread_data_t, td_deque_head),
|
||||||
offset_and_size_of( kmp_base_thread_data_t, td_deque_tail ),
|
offset_and_size_of(kmp_base_thread_data_t, td_deque_tail),
|
||||||
offset_and_size_of( kmp_base_thread_data_t, td_deque_ntasks ),
|
offset_and_size_of(kmp_base_thread_data_t, td_deque_ntasks),
|
||||||
offset_and_size_of( kmp_base_thread_data_t, td_deque_last_stolen ),
|
offset_and_size_of(kmp_base_thread_data_t, td_deque_last_stolen),
|
||||||
|
|
||||||
// The last field.
|
// The last field.
|
||||||
KMP_OMP_VERSION,
|
KMP_OMP_VERSION,
|
||||||
|
|
@ -236,80 +226,66 @@ __kmp_omp_debug_struct_info = {
|
||||||
#undef offset_and_size_of
|
#undef offset_and_size_of
|
||||||
#undef addr_and_size_of
|
#undef addr_and_size_of
|
||||||
|
|
||||||
/*
|
/* Intel compiler on IA-32 architecture issues a warning "conversion
|
||||||
Intel compiler on IA-32 architecture issues a warning "conversion
|
|
||||||
from "unsigned long long" to "char *" may lose significant bits"
|
from "unsigned long long" to "char *" may lose significant bits"
|
||||||
when 64-bit value is assigned to 32-bit pointer. Use this function
|
when 64-bit value is assigned to 32-bit pointer. Use this function
|
||||||
to suppress the warning.
|
to suppress the warning. */
|
||||||
*/
|
static inline void *__kmp_convert_to_ptr(kmp_uint64 addr) {
|
||||||
static inline
|
#if KMP_COMPILER_ICC
|
||||||
void *
|
#pragma warning(push)
|
||||||
__kmp_convert_to_ptr(
|
#pragma warning(disable : 810) // conversion from "unsigned long long" to "char
|
||||||
kmp_uint64 addr
|
// *" may lose significant bits
|
||||||
) {
|
#pragma warning(disable : 1195) // conversion from integer to smaller pointer
|
||||||
#if KMP_COMPILER_ICC
|
#endif // KMP_COMPILER_ICC
|
||||||
#pragma warning( push )
|
return (void *)addr;
|
||||||
#pragma warning( disable: 810 ) // conversion from "unsigned long long" to "char *" may lose significant bits
|
#if KMP_COMPILER_ICC
|
||||||
#pragma warning( disable: 1195 ) // conversion from integer to smaller pointer
|
#pragma warning(pop)
|
||||||
#endif // KMP_COMPILER_ICC
|
#endif // KMP_COMPILER_ICC
|
||||||
return (void *) addr;
|
|
||||||
#if KMP_COMPILER_ICC
|
|
||||||
#pragma warning( pop )
|
|
||||||
#endif // KMP_COMPILER_ICC
|
|
||||||
} // __kmp_convert_to_ptr
|
} // __kmp_convert_to_ptr
|
||||||
|
|
||||||
|
static int kmp_location_match(kmp_str_loc_t *loc, kmp_omp_nthr_item_t *item) {
|
||||||
static int
|
|
||||||
kmp_location_match(
|
|
||||||
kmp_str_loc_t * loc,
|
|
||||||
kmp_omp_nthr_item_t * item
|
|
||||||
) {
|
|
||||||
|
|
||||||
int file_match = 0;
|
int file_match = 0;
|
||||||
int func_match = 0;
|
int func_match = 0;
|
||||||
int line_match = 0;
|
int line_match = 0;
|
||||||
|
|
||||||
char * file = (char *) __kmp_convert_to_ptr( item->file );
|
char *file = (char *)__kmp_convert_to_ptr(item->file);
|
||||||
char * func = (char *) __kmp_convert_to_ptr( item->func );
|
char *func = (char *)__kmp_convert_to_ptr(item->func);
|
||||||
file_match = __kmp_str_fname_match( & loc->fname, file );
|
file_match = __kmp_str_fname_match(&loc->fname, file);
|
||||||
func_match =
|
func_match =
|
||||||
item->func == 0 // If item->func is NULL, it allows any func name.
|
item->func == 0 // If item->func is NULL, it allows any func name.
|
||||||
||
|
|| strcmp(func, "*") == 0 ||
|
||||||
strcmp( func, "*" ) == 0
|
(loc->func != NULL && strcmp(loc->func, func) == 0);
|
||||||
||
|
|
||||||
( loc->func != NULL && strcmp( loc->func, func ) == 0 );
|
|
||||||
line_match =
|
line_match =
|
||||||
item->begin <= loc->line
|
item->begin <= loc->line &&
|
||||||
&&
|
(item->end <= 0 ||
|
||||||
( item->end <= 0 || loc->line <= item->end ); // if item->end <= 0, it means "end of file".
|
loc->line <= item->end); // if item->end <= 0, it means "end of file".
|
||||||
|
|
||||||
return ( file_match && func_match && line_match );
|
return (file_match && func_match && line_match);
|
||||||
|
|
||||||
} // kmp_location_match
|
} // kmp_location_match
|
||||||
|
|
||||||
|
int __kmp_omp_num_threads(ident_t const *ident) {
|
||||||
int
|
|
||||||
__kmp_omp_num_threads(
|
|
||||||
ident_t const * ident
|
|
||||||
) {
|
|
||||||
|
|
||||||
int num_threads = 0;
|
int num_threads = 0;
|
||||||
|
|
||||||
kmp_omp_nthr_info_t * info =
|
kmp_omp_nthr_info_t *info = (kmp_omp_nthr_info_t *)__kmp_convert_to_ptr(
|
||||||
(kmp_omp_nthr_info_t *) __kmp_convert_to_ptr( __kmp_omp_debug_struct_info.nthr_info.addr );
|
__kmp_omp_debug_struct_info.nthr_info.addr);
|
||||||
if ( info->num > 0 && info->array != 0 ) {
|
if (info->num > 0 && info->array != 0) {
|
||||||
kmp_omp_nthr_item_t * items = (kmp_omp_nthr_item_t *) __kmp_convert_to_ptr( info->array );
|
kmp_omp_nthr_item_t *items =
|
||||||
kmp_str_loc_t loc = __kmp_str_loc_init( ident->psource, 1 );
|
(kmp_omp_nthr_item_t *)__kmp_convert_to_ptr(info->array);
|
||||||
|
kmp_str_loc_t loc = __kmp_str_loc_init(ident->psource, 1);
|
||||||
int i;
|
int i;
|
||||||
for ( i = 0; i < info->num; ++ i ) {
|
for (i = 0; i < info->num; ++i) {
|
||||||
if ( kmp_location_match( & loc, & items[ i ] ) ) {
|
if (kmp_location_match(&loc, &items[i])) {
|
||||||
num_threads = items[ i ].num_threads;
|
num_threads = items[i].num_threads;
|
||||||
}; // if
|
}; // if
|
||||||
}; // for
|
}; // for
|
||||||
__kmp_str_loc_free( & loc );
|
__kmp_str_loc_free(&loc);
|
||||||
}; // if
|
}; // if
|
||||||
|
|
||||||
return num_threads;;
|
return num_threads;
|
||||||
|
;
|
||||||
|
|
||||||
} // __kmp_omp_num_threads
|
} // __kmp_omp_num_threads
|
||||||
#endif /* USE_DEBUGGER */
|
#endif /* USE_DEBUGGER */
|
||||||
|
|
|
||||||
|
|
@ -18,34 +18,34 @@
|
||||||
#define KMP_DEBUGGER_H
|
#define KMP_DEBUGGER_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
/* * This external variable can be set by any debugger to flag to the runtime that we
|
/* This external variable can be set by any debugger to flag to the runtime
|
||||||
are currently executing inside a debugger. This will allow the debugger to override
|
that we are currently executing inside a debugger. This will allow the
|
||||||
the number of threads spawned in a parallel region by using __kmp_omp_num_threads() (below).
|
debugger to override the number of threads spawned in a parallel region by
|
||||||
* When __kmp_debugging is TRUE, each team and each task gets a unique integer identifier
|
using __kmp_omp_num_threads() (below).
|
||||||
that can be used by debugger to conveniently identify teams and tasks.
|
* When __kmp_debugging is TRUE, each team and each task gets a unique integer
|
||||||
* The debugger has access to __kmp_omp_debug_struct_info which contains information
|
identifier that can be used by debugger to conveniently identify teams and
|
||||||
about the OpenMP library's important internal structures. This access will allow the debugger
|
tasks.
|
||||||
to read detailed information from the typical OpenMP constructs (teams, threads, tasking, etc. )
|
* The debugger has access to __kmp_omp_debug_struct_info which contains
|
||||||
during a debugging session and offer detailed and useful information which the user can probe
|
information about the OpenMP library's important internal structures. This
|
||||||
about the OpenMP portion of their code.
|
access will allow the debugger to read detailed information from the typical
|
||||||
*/
|
OpenMP constructs (teams, threads, tasking, etc. ) during a debugging
|
||||||
|
session and offer detailed and useful information which the user can probe
|
||||||
|
about the OpenMP portion of their code. */
|
||||||
extern int __kmp_debugging; /* Boolean whether currently debugging OpenMP RTL */
|
extern int __kmp_debugging; /* Boolean whether currently debugging OpenMP RTL */
|
||||||
// Return number of threads specified by the debugger for given parallel region.
|
// Return number of threads specified by the debugger for given parallel region.
|
||||||
/* The ident field, which represents a source file location, is used to check if the
|
/* The ident field, which represents a source file location, is used to check if
|
||||||
debugger has changed the number of threads for the parallel region at source file
|
the debugger has changed the number of threads for the parallel region at
|
||||||
location ident. This way, specific parallel regions' number of threads can be changed
|
source file location ident. This way, specific parallel regions' number of
|
||||||
at the debugger's request.
|
threads can be changed at the debugger's request. */
|
||||||
*/
|
int __kmp_omp_num_threads(ident_t const *ident);
|
||||||
int __kmp_omp_num_threads( ident_t const * ident );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
|
||||||
#endif // KMP_DEBUGGER_H
|
#endif // KMP_DEBUGGER_H
|
||||||
|
|
||||||
#endif // USE_DEBUGGER
|
#endif // USE_DEBUGGER
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -13,339 +13,283 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* We use GetEnvironmentVariable for Windows* OS instead of getenv because the
|
||||||
------------------------------------------------------------------------------------------------
|
act of loading a DLL on Windows* OS makes any user-set environment variables
|
||||||
We use GetEnvironmentVariable for Windows* OS instead of getenv because the act of
|
(i.e. with putenv()) unavailable. getenv() apparently gets a clean copy of
|
||||||
loading a DLL on Windows* OS makes any user-set environment variables (i.e. with putenv())
|
the env variables as they existed at the start of the run. JH 12/23/2002
|
||||||
unavailable. getenv() apparently gets a clean copy of the env variables as they existed
|
|
||||||
at the start of the run.
|
|
||||||
JH 12/23/2002
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
On Windows* OS, there are two environments (at least, see below):
|
On Windows* OS, there are two environments (at least, see below):
|
||||||
|
|
||||||
1. Environment maintained by Windows* OS on IA-32 architecture.
|
1. Environment maintained by Windows* OS on IA-32 architecture. Accessible
|
||||||
Accessible through GetEnvironmentVariable(),
|
through GetEnvironmentVariable(), SetEnvironmentVariable(), and
|
||||||
SetEnvironmentVariable(), and GetEnvironmentStrings().
|
GetEnvironmentStrings().
|
||||||
|
|
||||||
2. Environment maintained by C RTL. Accessible through getenv(), putenv().
|
2. Environment maintained by C RTL. Accessible through getenv(), putenv().
|
||||||
|
|
||||||
putenv() function updates both C and Windows* OS on IA-32 architecture. getenv() function
|
putenv() function updates both C and Windows* OS on IA-32 architecture.
|
||||||
search for variables in C RTL environment only. Windows* OS on IA-32 architecture functions work *only*
|
getenv() function search for variables in C RTL environment only.
|
||||||
with Windows* OS on IA-32 architecture.
|
Windows* OS on IA-32 architecture functions work *only* with Windows* OS on
|
||||||
|
IA-32 architecture.
|
||||||
|
|
||||||
Windows* OS on IA-32 architecture maintained by OS, so there is always only one Windows* OS on
|
Windows* OS on IA-32 architecture maintained by OS, so there is always only
|
||||||
IA-32 architecture per process. Changes in Windows* OS on IA-32 architecture are process-visible.
|
one Windows* OS on IA-32 architecture per process. Changes in Windows* OS on
|
||||||
|
IA-32 architecture are process-visible.
|
||||||
|
|
||||||
C environment maintained by C RTL. Multiple copies of C RTL may be present in the process, and
|
C environment maintained by C RTL. Multiple copies of C RTL may be present
|
||||||
each C RTL maintains its own environment. :-(
|
in the process, and each C RTL maintains its own environment. :-(
|
||||||
|
|
||||||
Thus, proper way to work with environment on Windows* OS is:
|
Thus, proper way to work with environment on Windows* OS is:
|
||||||
|
|
||||||
1. Set variables with putenv() function -- both C and Windows* OS on
|
1. Set variables with putenv() function -- both C and Windows* OS on IA-32
|
||||||
IA-32 architecture are being updated. Windows* OS on
|
architecture are being updated. Windows* OS on IA-32 architecture may be
|
||||||
IA-32 architecture may be considered as primary target,
|
considered primary target, while updating C RTL environment is free bonus.
|
||||||
while updating C RTL environment is a free bonus.
|
|
||||||
|
|
||||||
2. Get variables with GetEnvironmentVariable() -- getenv() does not
|
2. Get variables with GetEnvironmentVariable() -- getenv() does not
|
||||||
search Windows* OS on IA-32 architecture, and can not see variables
|
search Windows* OS on IA-32 architecture, and can not see variables
|
||||||
set with SetEnvironmentVariable().
|
set with SetEnvironmentVariable().
|
||||||
|
|
||||||
2007-04-05 -- lev
|
2007-04-05 -- lev
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "kmp_environment.h"
|
#include "kmp_environment.h"
|
||||||
|
|
||||||
#include "kmp_os.h" // KMP_OS_*.
|
|
||||||
#include "kmp.h" //
|
#include "kmp.h" //
|
||||||
#include "kmp_str.h" // __kmp_str_*().
|
|
||||||
#include "kmp_i18n.h"
|
#include "kmp_i18n.h"
|
||||||
|
#include "kmp_os.h" // KMP_OS_*.
|
||||||
|
#include "kmp_str.h" // __kmp_str_*().
|
||||||
|
|
||||||
#if KMP_OS_UNIX
|
#if KMP_OS_UNIX
|
||||||
#include <stdlib.h> // getenv, setenv, unsetenv.
|
#include <stdlib.h> // getenv, setenv, unsetenv.
|
||||||
#include <string.h> // strlen, strcpy.
|
#include <string.h> // strlen, strcpy.
|
||||||
#if KMP_OS_DARWIN
|
#if KMP_OS_DARWIN
|
||||||
#include <crt_externs.h>
|
#include <crt_externs.h>
|
||||||
#define environ (*_NSGetEnviron())
|
#define environ (*_NSGetEnviron())
|
||||||
#else
|
|
||||||
extern char * * environ;
|
|
||||||
#endif
|
|
||||||
#elif KMP_OS_WINDOWS
|
|
||||||
#include <windows.h> // GetEnvironmentVariable, SetEnvironmentVariable, GetLastError.
|
|
||||||
#else
|
#else
|
||||||
#error Unknown or unsupported OS.
|
extern char **environ;
|
||||||
|
#endif
|
||||||
|
#elif KMP_OS_WINDOWS
|
||||||
|
#include <windows.h> // GetEnvironmentVariable, SetEnvironmentVariable,
|
||||||
|
// GetLastError.
|
||||||
|
#else
|
||||||
|
#error Unknown or unsupported OS.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// TODO: Eliminate direct memory allocations, use string operations instead.
|
// TODO: Eliminate direct memory allocations, use string operations instead.
|
||||||
|
|
||||||
static inline
|
static inline void *allocate(size_t size) {
|
||||||
void *
|
void *ptr = KMP_INTERNAL_MALLOC(size);
|
||||||
allocate(
|
if (ptr == NULL) {
|
||||||
size_t size
|
KMP_FATAL(MemoryAllocFailed);
|
||||||
) {
|
|
||||||
void * ptr = KMP_INTERNAL_MALLOC( size );
|
|
||||||
if ( ptr == NULL ) {
|
|
||||||
KMP_FATAL( MemoryAllocFailed );
|
|
||||||
}; // if
|
}; // if
|
||||||
return ptr;
|
return ptr;
|
||||||
} // allocate
|
} // allocate
|
||||||
|
|
||||||
|
char *__kmp_env_get(char const *name) {
|
||||||
|
|
||||||
char *
|
char *result = NULL;
|
||||||
__kmp_env_get( char const * name ) {
|
|
||||||
|
|
||||||
char * result = NULL;
|
#if KMP_OS_UNIX
|
||||||
|
char const *value = getenv(name);
|
||||||
#if KMP_OS_UNIX
|
if (value != NULL) {
|
||||||
char const * value = getenv( name );
|
size_t len = KMP_STRLEN(value) + 1;
|
||||||
if ( value != NULL ) {
|
result = (char *)KMP_INTERNAL_MALLOC(len);
|
||||||
size_t len = KMP_STRLEN( value ) + 1;
|
if (result == NULL) {
|
||||||
result = (char *) KMP_INTERNAL_MALLOC( len );
|
KMP_FATAL(MemoryAllocFailed);
|
||||||
if ( result == NULL ) {
|
|
||||||
KMP_FATAL( MemoryAllocFailed );
|
|
||||||
}; // if
|
}; // if
|
||||||
KMP_STRNCPY_S( result, len, value, len );
|
KMP_STRNCPY_S(result, len, value, len);
|
||||||
}; // if
|
}; // if
|
||||||
#elif KMP_OS_WINDOWS
|
#elif KMP_OS_WINDOWS
|
||||||
/*
|
/* We use GetEnvironmentVariable for Windows* OS instead of getenv because the
|
||||||
We use GetEnvironmentVariable for Windows* OS instead of getenv because the act of
|
act of loading a DLL on Windows* OS makes any user-set environment
|
||||||
loading a DLL on Windows* OS makes any user-set environment variables (i.e. with putenv())
|
variables (i.e. with putenv()) unavailable. getenv() apparently gets a
|
||||||
unavailable. getenv() apparently gets a clean copy of the env variables as they existed
|
clean copy of the env variables as they existed at the start of the run.
|
||||||
at the start of the run.
|
JH 12/23/2002 */
|
||||||
JH 12/23/2002
|
|
||||||
*/
|
|
||||||
DWORD rc;
|
DWORD rc;
|
||||||
rc = GetEnvironmentVariable( name, NULL, 0 );
|
rc = GetEnvironmentVariable(name, NULL, 0);
|
||||||
if ( ! rc ) {
|
if (!rc) {
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
if ( error != ERROR_ENVVAR_NOT_FOUND ) {
|
if (error != ERROR_ENVVAR_NOT_FOUND) {
|
||||||
__kmp_msg(
|
__kmp_msg(kmp_ms_fatal, KMP_MSG(CantGetEnvVar, name), KMP_ERR(error),
|
||||||
kmp_ms_fatal,
|
__kmp_msg_null);
|
||||||
KMP_MSG( CantGetEnvVar, name ),
|
|
||||||
KMP_ERR( error ),
|
|
||||||
__kmp_msg_null
|
|
||||||
);
|
|
||||||
}; // if
|
}; // if
|
||||||
// Variable is not found, it's ok, just continue.
|
// Variable is not found, it's ok, just continue.
|
||||||
} else {
|
} else {
|
||||||
DWORD len = rc;
|
DWORD len = rc;
|
||||||
result = (char *) KMP_INTERNAL_MALLOC( len );
|
result = (char *)KMP_INTERNAL_MALLOC(len);
|
||||||
if ( result == NULL ) {
|
if (result == NULL) {
|
||||||
KMP_FATAL( MemoryAllocFailed );
|
KMP_FATAL(MemoryAllocFailed);
|
||||||
}; // if
|
}; // if
|
||||||
rc = GetEnvironmentVariable( name, result, len );
|
rc = GetEnvironmentVariable(name, result, len);
|
||||||
if ( ! rc ) {
|
if (!rc) {
|
||||||
// GetEnvironmentVariable() may return 0 if variable is empty.
|
// GetEnvironmentVariable() may return 0 if variable is empty.
|
||||||
// In such a case GetLastError() returns ERROR_SUCCESS.
|
// In such a case GetLastError() returns ERROR_SUCCESS.
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
if ( error != ERROR_SUCCESS ) {
|
if (error != ERROR_SUCCESS) {
|
||||||
// Unexpected error. The variable should be in the environment,
|
// Unexpected error. The variable should be in the environment,
|
||||||
// and buffer should be large enough.
|
// and buffer should be large enough.
|
||||||
__kmp_msg(
|
__kmp_msg(kmp_ms_fatal, KMP_MSG(CantGetEnvVar, name), KMP_ERR(error),
|
||||||
kmp_ms_fatal,
|
__kmp_msg_null);
|
||||||
KMP_MSG( CantGetEnvVar, name ),
|
KMP_INTERNAL_FREE((void *)result);
|
||||||
KMP_ERR( error ),
|
|
||||||
__kmp_msg_null
|
|
||||||
);
|
|
||||||
KMP_INTERNAL_FREE( (void *) result );
|
|
||||||
result = NULL;
|
result = NULL;
|
||||||
}; // if
|
}; // if
|
||||||
}; // if
|
}; // if
|
||||||
}; // if
|
}; // if
|
||||||
#else
|
#else
|
||||||
#error Unknown or unsupported OS.
|
#error Unknown or unsupported OS.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
} // func __kmp_env_get
|
} // func __kmp_env_get
|
||||||
|
|
||||||
|
|
||||||
// TODO: Find and replace all regular free() with __kmp_env_free().
|
// TODO: Find and replace all regular free() with __kmp_env_free().
|
||||||
|
|
||||||
void
|
void __kmp_env_free(char const **value) {
|
||||||
__kmp_env_free( char const * * value ) {
|
|
||||||
|
|
||||||
KMP_DEBUG_ASSERT( value != NULL );
|
KMP_DEBUG_ASSERT(value != NULL);
|
||||||
KMP_INTERNAL_FREE( (void *) * value );
|
KMP_INTERNAL_FREE((void *)*value);
|
||||||
* value = NULL;
|
*value = NULL;
|
||||||
|
|
||||||
} // func __kmp_env_free
|
} // func __kmp_env_free
|
||||||
|
|
||||||
|
int __kmp_env_exists(char const *name) {
|
||||||
|
|
||||||
|
#if KMP_OS_UNIX
|
||||||
int
|
char const *value = getenv(name);
|
||||||
__kmp_env_exists( char const * name ) {
|
return ((value == NULL) ? (0) : (1));
|
||||||
|
#elif KMP_OS_WINDOWS
|
||||||
#if KMP_OS_UNIX
|
|
||||||
char const * value = getenv( name );
|
|
||||||
return ( ( value == NULL ) ? ( 0 ) : ( 1 ) );
|
|
||||||
#elif KMP_OS_WINDOWS
|
|
||||||
DWORD rc;
|
DWORD rc;
|
||||||
rc = GetEnvironmentVariable( name, NULL, 0 );
|
rc = GetEnvironmentVariable(name, NULL, 0);
|
||||||
if ( rc == 0 ) {
|
if (rc == 0) {
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
if ( error != ERROR_ENVVAR_NOT_FOUND ) {
|
if (error != ERROR_ENVVAR_NOT_FOUND) {
|
||||||
__kmp_msg(
|
__kmp_msg(kmp_ms_fatal, KMP_MSG(CantGetEnvVar, name), KMP_ERR(error),
|
||||||
kmp_ms_fatal,
|
__kmp_msg_null);
|
||||||
KMP_MSG( CantGetEnvVar, name ),
|
|
||||||
KMP_ERR( error ),
|
|
||||||
__kmp_msg_null
|
|
||||||
);
|
|
||||||
}; // if
|
}; // if
|
||||||
return 0;
|
return 0;
|
||||||
}; // if
|
}; // if
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
#error Unknown or unsupported OS.
|
#error Unknown or unsupported OS.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // func __kmp_env_exists
|
} // func __kmp_env_exists
|
||||||
|
|
||||||
|
void __kmp_env_set(char const *name, char const *value, int overwrite) {
|
||||||
|
|
||||||
|
#if KMP_OS_UNIX
|
||||||
void
|
int rc = setenv(name, value, overwrite);
|
||||||
__kmp_env_set( char const * name, char const * value, int overwrite ) {
|
if (rc != 0) {
|
||||||
|
|
||||||
#if KMP_OS_UNIX
|
|
||||||
int rc = setenv( name, value, overwrite );
|
|
||||||
if ( rc != 0 ) {
|
|
||||||
// Dead code. I tried to put too many variables into Linux* OS
|
// Dead code. I tried to put too many variables into Linux* OS
|
||||||
// environment on IA-32 architecture. When application consumes
|
// environment on IA-32 architecture. When application consumes
|
||||||
// more than ~2.5 GB of memory, entire system feels bad. Sometimes
|
// more than ~2.5 GB of memory, entire system feels bad. Sometimes
|
||||||
// application is killed (by OS?), sometimes system stops
|
// application is killed (by OS?), sometimes system stops
|
||||||
// responding... But this error message never appears. --ln
|
// responding... But this error message never appears. --ln
|
||||||
__kmp_msg(
|
__kmp_msg(kmp_ms_fatal, KMP_MSG(CantSetEnvVar, name),
|
||||||
kmp_ms_fatal,
|
KMP_HNT(NotEnoughMemory), __kmp_msg_null);
|
||||||
KMP_MSG( CantSetEnvVar, name ),
|
|
||||||
KMP_HNT( NotEnoughMemory ),
|
|
||||||
__kmp_msg_null
|
|
||||||
);
|
|
||||||
}; // if
|
}; // if
|
||||||
#elif KMP_OS_WINDOWS
|
#elif KMP_OS_WINDOWS
|
||||||
BOOL rc;
|
BOOL rc;
|
||||||
if ( ! overwrite ) {
|
if (!overwrite) {
|
||||||
rc = GetEnvironmentVariable( name, NULL, 0 );
|
rc = GetEnvironmentVariable(name, NULL, 0);
|
||||||
if ( rc ) {
|
if (rc) {
|
||||||
// Variable exists, do not overwrite.
|
// Variable exists, do not overwrite.
|
||||||
return;
|
return;
|
||||||
}; // if
|
}; // if
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
if ( error != ERROR_ENVVAR_NOT_FOUND ) {
|
if (error != ERROR_ENVVAR_NOT_FOUND) {
|
||||||
__kmp_msg(
|
__kmp_msg(kmp_ms_fatal, KMP_MSG(CantGetEnvVar, name), KMP_ERR(error),
|
||||||
kmp_ms_fatal,
|
__kmp_msg_null);
|
||||||
KMP_MSG( CantGetEnvVar, name ),
|
|
||||||
KMP_ERR( error ),
|
|
||||||
__kmp_msg_null
|
|
||||||
);
|
|
||||||
}; // if
|
}; // if
|
||||||
}; // if
|
}; // if
|
||||||
rc = SetEnvironmentVariable( name, value );
|
rc = SetEnvironmentVariable(name, value);
|
||||||
if ( ! rc ) {
|
if (!rc) {
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
__kmp_msg(
|
__kmp_msg(kmp_ms_fatal, KMP_MSG(CantSetEnvVar, name), KMP_ERR(error),
|
||||||
kmp_ms_fatal,
|
__kmp_msg_null);
|
||||||
KMP_MSG( CantSetEnvVar, name ),
|
|
||||||
KMP_ERR( error ),
|
|
||||||
__kmp_msg_null
|
|
||||||
);
|
|
||||||
}; // if
|
}; // if
|
||||||
#else
|
#else
|
||||||
#error Unknown or unsupported OS.
|
#error Unknown or unsupported OS.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // func __kmp_env_set
|
} // func __kmp_env_set
|
||||||
|
|
||||||
|
void __kmp_env_unset(char const *name) {
|
||||||
|
|
||||||
|
#if KMP_OS_UNIX
|
||||||
void
|
unsetenv(name);
|
||||||
__kmp_env_unset( char const * name ) {
|
#elif KMP_OS_WINDOWS
|
||||||
|
BOOL rc = SetEnvironmentVariable(name, NULL);
|
||||||
#if KMP_OS_UNIX
|
if (!rc) {
|
||||||
unsetenv( name );
|
|
||||||
#elif KMP_OS_WINDOWS
|
|
||||||
BOOL rc = SetEnvironmentVariable( name, NULL );
|
|
||||||
if ( ! rc ) {
|
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
__kmp_msg(
|
__kmp_msg(kmp_ms_fatal, KMP_MSG(CantSetEnvVar, name), KMP_ERR(error),
|
||||||
kmp_ms_fatal,
|
__kmp_msg_null);
|
||||||
KMP_MSG( CantSetEnvVar, name ),
|
|
||||||
KMP_ERR( error ),
|
|
||||||
__kmp_msg_null
|
|
||||||
);
|
|
||||||
}; // if
|
}; // if
|
||||||
#else
|
#else
|
||||||
#error Unknown or unsupported OS.
|
#error Unknown or unsupported OS.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // func __kmp_env_unset
|
} // func __kmp_env_unset
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
/* Intel OpenMP RTL string representation of environment: just a string of
|
||||||
|
characters, variables are separated with vertical bars, e. g.:
|
||||||
/*
|
|
||||||
Intel OpenMP RTL string representation of environment: just a string of characters, variables
|
|
||||||
are separated with vertical bars, e. g.:
|
|
||||||
|
|
||||||
"KMP_WARNINGS=0|KMP_AFFINITY=compact|"
|
"KMP_WARNINGS=0|KMP_AFFINITY=compact|"
|
||||||
|
|
||||||
Empty variables are allowed and ignored:
|
Empty variables are allowed and ignored:
|
||||||
|
|
||||||
"||KMP_WARNINGS=1||"
|
"||KMP_WARNINGS=1||"
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static
|
static void
|
||||||
void
|
___kmp_env_blk_parse_string(kmp_env_blk_t *block, // M: Env block to fill.
|
||||||
___kmp_env_blk_parse_string(
|
char const *env // I: String to parse.
|
||||||
kmp_env_blk_t * block, // M: Env block to fill.
|
) {
|
||||||
char const * env // I: String to parse.
|
|
||||||
) {
|
|
||||||
|
|
||||||
char const chr_delimiter = '|';
|
char const chr_delimiter = '|';
|
||||||
char const str_delimiter[] = { chr_delimiter, 0 };
|
char const str_delimiter[] = {chr_delimiter, 0};
|
||||||
|
|
||||||
char * bulk = NULL;
|
char *bulk = NULL;
|
||||||
kmp_env_var_t * vars = NULL;
|
kmp_env_var_t *vars = NULL;
|
||||||
int count = 0; // Number of used elements in vars array.
|
int count = 0; // Number of used elements in vars array.
|
||||||
int delimiters = 0; // Number of delimiters in input string.
|
int delimiters = 0; // Number of delimiters in input string.
|
||||||
|
|
||||||
// Copy original string, we will modify the copy.
|
// Copy original string, we will modify the copy.
|
||||||
bulk = __kmp_str_format( "%s", env );
|
bulk = __kmp_str_format("%s", env);
|
||||||
|
|
||||||
// Loop thru all the vars in environment block. Count delimiters (maximum number of variables
|
// Loop thru all the vars in environment block. Count delimiters (maximum
|
||||||
// is number of delimiters plus one).
|
// number of variables is number of delimiters plus one).
|
||||||
{
|
{
|
||||||
char const * ptr = bulk;
|
char const *ptr = bulk;
|
||||||
for ( ; ; ) {
|
for (;;) {
|
||||||
ptr = strchr( ptr, chr_delimiter );
|
ptr = strchr(ptr, chr_delimiter);
|
||||||
if ( ptr == NULL ) {
|
if (ptr == NULL) {
|
||||||
break;
|
break;
|
||||||
}; // if
|
}; // if
|
||||||
++ delimiters;
|
++delimiters;
|
||||||
ptr += 1;
|
ptr += 1;
|
||||||
}; // forever
|
}; // forever
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate vars array.
|
// Allocate vars array.
|
||||||
vars = (kmp_env_var_t *) allocate( ( delimiters + 1 ) * sizeof( kmp_env_var_t ) );
|
vars = (kmp_env_var_t *)allocate((delimiters + 1) * sizeof(kmp_env_var_t));
|
||||||
|
|
||||||
// Loop thru all the variables.
|
// Loop thru all the variables.
|
||||||
{
|
{
|
||||||
char * var; // Pointer to variable (both name and value).
|
char *var; // Pointer to variable (both name and value).
|
||||||
char * name; // Pointer to name of variable.
|
char *name; // Pointer to name of variable.
|
||||||
char * value; // Pointer to value.
|
char *value; // Pointer to value.
|
||||||
char * buf; // Buffer for __kmp_str_token() function.
|
char *buf; // Buffer for __kmp_str_token() function.
|
||||||
var = __kmp_str_token( bulk, str_delimiter, & buf ); // Get the first var.
|
var = __kmp_str_token(bulk, str_delimiter, &buf); // Get the first var.
|
||||||
while ( var != NULL ) {
|
while (var != NULL) {
|
||||||
// Save found variable in vars array.
|
// Save found variable in vars array.
|
||||||
__kmp_str_split( var, '=', & name, & value );
|
__kmp_str_split(var, '=', &name, &value);
|
||||||
KMP_DEBUG_ASSERT( count < delimiters + 1 );
|
KMP_DEBUG_ASSERT(count < delimiters + 1);
|
||||||
vars[ count ].name = name;
|
vars[count].name = name;
|
||||||
vars[ count ].value = value;
|
vars[count].value = value;
|
||||||
++ count;
|
++count;
|
||||||
// Get the next var.
|
// Get the next var.
|
||||||
var = __kmp_str_token( NULL, str_delimiter, & buf );
|
var = __kmp_str_token(NULL, str_delimiter, &buf);
|
||||||
}; // while
|
}; // while
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -356,12 +300,10 @@ ___kmp_env_blk_parse_string(
|
||||||
|
|
||||||
}; // ___kmp_env_blk_parse_string
|
}; // ___kmp_env_blk_parse_string
|
||||||
|
|
||||||
|
/* Windows* OS (actually, DOS) environment block is a piece of memory with
|
||||||
|
environment variables. Each variable is terminated with zero byte, entire
|
||||||
/*
|
block is terminated with one extra zero byte, so we have two zero bytes at
|
||||||
Windows* OS (actually, DOS) environment block is a piece of memory with environment variables. Each
|
the end of environment block, e. g.:
|
||||||
variable is terminated with zero byte, entire block is terminated with one extra zero byte, so
|
|
||||||
we have two zero bytes at the end of environment block, e. g.:
|
|
||||||
|
|
||||||
"HOME=C:\\users\\lev\x00OS=Windows_NT\x00\x00"
|
"HOME=C:\\users\\lev\x00OS=Windows_NT\x00\x00"
|
||||||
|
|
||||||
|
|
@ -369,61 +311,63 @@ ___kmp_env_blk_parse_string(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
static
|
static void ___kmp_env_blk_parse_windows(
|
||||||
void
|
kmp_env_blk_t *block, // M: Env block to fill.
|
||||||
___kmp_env_blk_parse_windows(
|
char const *env // I: Pointer to Windows* OS (DOS) environment block.
|
||||||
kmp_env_blk_t * block, // M: Env block to fill.
|
) {
|
||||||
char const * env // I: Pointer to Windows* OS (DOS) environment block.
|
|
||||||
) {
|
|
||||||
|
|
||||||
char * bulk = NULL;
|
char *bulk = NULL;
|
||||||
kmp_env_var_t * vars = NULL;
|
kmp_env_var_t *vars = NULL;
|
||||||
int count = 0; // Number of used elements in vars array.
|
int count = 0; // Number of used elements in vars array.
|
||||||
int size = 0; // Size of bulk.
|
int size = 0; // Size of bulk.
|
||||||
|
|
||||||
char * name; // Pointer to name of variable.
|
char *name; // Pointer to name of variable.
|
||||||
char * value; // Pointer to value.
|
char *value; // Pointer to value.
|
||||||
|
|
||||||
if ( env != NULL ) {
|
if (env != NULL) {
|
||||||
|
|
||||||
// Loop thru all the vars in environment block. Count variables, find size of block.
|
// Loop thru all the vars in environment block. Count variables, find size
|
||||||
|
// of block.
|
||||||
{
|
{
|
||||||
char const * var; // Pointer to beginning of var.
|
char const *var; // Pointer to beginning of var.
|
||||||
int len; // Length of variable.
|
int len; // Length of variable.
|
||||||
count = 0;
|
count = 0;
|
||||||
var = env; // The first variable starts and beginning of environment block.
|
var =
|
||||||
len = KMP_STRLEN( var );
|
env; // The first variable starts and beginning of environment block.
|
||||||
while ( len != 0 ) {
|
len = KMP_STRLEN(var);
|
||||||
++ count;
|
while (len != 0) {
|
||||||
|
++count;
|
||||||
size = size + len + 1;
|
size = size + len + 1;
|
||||||
var = var + len + 1; // Move pointer to the beginning of the next variable.
|
var = var + len +
|
||||||
len = KMP_STRLEN( var );
|
1; // Move pointer to the beginning of the next variable.
|
||||||
|
len = KMP_STRLEN(var);
|
||||||
}; // while
|
}; // while
|
||||||
size = size + 1; // Total size of env block, including terminating zero byte.
|
size =
|
||||||
|
size + 1; // Total size of env block, including terminating zero byte.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy original block to bulk, we will modify bulk, not original block.
|
// Copy original block to bulk, we will modify bulk, not original block.
|
||||||
bulk = (char *) allocate( size );
|
bulk = (char *)allocate(size);
|
||||||
KMP_MEMCPY_S( bulk, size, env, size );
|
KMP_MEMCPY_S(bulk, size, env, size);
|
||||||
// Allocate vars array.
|
// Allocate vars array.
|
||||||
vars = (kmp_env_var_t *) allocate( count * sizeof( kmp_env_var_t ) );
|
vars = (kmp_env_var_t *)allocate(count * sizeof(kmp_env_var_t));
|
||||||
|
|
||||||
// Loop thru all the vars, now in bulk.
|
// Loop thru all the vars, now in bulk.
|
||||||
{
|
{
|
||||||
char * var; // Pointer to beginning of var.
|
char *var; // Pointer to beginning of var.
|
||||||
int len; // Length of variable.
|
int len; // Length of variable.
|
||||||
count = 0;
|
count = 0;
|
||||||
var = bulk;
|
var = bulk;
|
||||||
len = KMP_STRLEN( var );
|
len = KMP_STRLEN(var);
|
||||||
while ( len != 0 ) {
|
while (len != 0) {
|
||||||
// Save variable in vars array.
|
// Save variable in vars array.
|
||||||
__kmp_str_split( var, '=', & name, & value );
|
__kmp_str_split(var, '=', &name, &value);
|
||||||
vars[ count ].name = name;
|
vars[count].name = name;
|
||||||
vars[ count ].value = value;
|
vars[count].value = value;
|
||||||
++ count;
|
++count;
|
||||||
// Get the next var.
|
// Get the next var.
|
||||||
var = var + len + 1;
|
var = var + len + 1;
|
||||||
len = KMP_STRLEN( var );
|
len = KMP_STRLEN(var);
|
||||||
}; // while
|
}; // while
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -437,22 +381,19 @@ ___kmp_env_blk_parse_windows(
|
||||||
}; // ___kmp_env_blk_parse_windows
|
}; // ___kmp_env_blk_parse_windows
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Unix environment block is a array of pointers to variables, last pointer in
|
||||||
/*
|
array is NULL:
|
||||||
Unix environment block is a array of pointers to variables, last pointer in array is NULL:
|
|
||||||
|
|
||||||
{ "HOME=/home/lev", "TERM=xterm", NULL }
|
{ "HOME=/home/lev", "TERM=xterm", NULL }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static
|
static void
|
||||||
void
|
___kmp_env_blk_parse_unix(kmp_env_blk_t *block, // M: Env block to fill.
|
||||||
___kmp_env_blk_parse_unix(
|
char **env // I: Unix environment to parse.
|
||||||
kmp_env_blk_t * block, // M: Env block to fill.
|
) {
|
||||||
char * * env // I: Unix environment to parse.
|
|
||||||
) {
|
|
||||||
|
|
||||||
char * bulk = NULL;
|
char *bulk = NULL;
|
||||||
kmp_env_var_t * vars = NULL;
|
kmp_env_var_t *vars = NULL;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int size = 0; // Size of bulk.
|
int size = 0; // Size of bulk.
|
||||||
|
|
||||||
|
|
@ -460,32 +401,32 @@ ___kmp_env_blk_parse_unix(
|
||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
size = 0;
|
size = 0;
|
||||||
while ( env[ count ] != NULL ) {
|
while (env[count] != NULL) {
|
||||||
size += KMP_STRLEN( env[ count ] ) + 1;
|
size += KMP_STRLEN(env[count]) + 1;
|
||||||
++ count;
|
++count;
|
||||||
}; // while
|
}; // while
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate memory.
|
// Allocate memory.
|
||||||
bulk = (char *) allocate( size );
|
bulk = (char *)allocate(size);
|
||||||
vars = (kmp_env_var_t *) allocate( count * sizeof( kmp_env_var_t ) );
|
vars = (kmp_env_var_t *)allocate(count * sizeof(kmp_env_var_t));
|
||||||
|
|
||||||
// Loop thru all the vars.
|
// Loop thru all the vars.
|
||||||
{
|
{
|
||||||
char * var; // Pointer to beginning of var.
|
char *var; // Pointer to beginning of var.
|
||||||
char * name; // Pointer to name of variable.
|
char *name; // Pointer to name of variable.
|
||||||
char * value; // Pointer to value.
|
char *value; // Pointer to value.
|
||||||
int len; // Length of variable.
|
int len; // Length of variable.
|
||||||
int i;
|
int i;
|
||||||
var = bulk;
|
var = bulk;
|
||||||
for ( i = 0; i < count; ++ i ) {
|
for (i = 0; i < count; ++i) {
|
||||||
// Copy variable to bulk.
|
// Copy variable to bulk.
|
||||||
len = KMP_STRLEN( env[ i ] );
|
len = KMP_STRLEN(env[i]);
|
||||||
KMP_MEMCPY_S( var, size, env[ i ], len + 1 );
|
KMP_MEMCPY_S(var, size, env[i], len + 1);
|
||||||
// Save found variable in vars array.
|
// Save found variable in vars array.
|
||||||
__kmp_str_split( var, '=', & name, & value );
|
__kmp_str_split(var, '=', &name, &value);
|
||||||
vars[ i ].name = name;
|
vars[i].name = name;
|
||||||
vars[ i ].value = value;
|
vars[i].value = value;
|
||||||
// Move pointer.
|
// Move pointer.
|
||||||
var += len + 1;
|
var += len + 1;
|
||||||
}; // for
|
}; // for
|
||||||
|
|
@ -498,74 +439,52 @@ ___kmp_env_blk_parse_unix(
|
||||||
|
|
||||||
}; // ___kmp_env_blk_parse_unix
|
}; // ___kmp_env_blk_parse_unix
|
||||||
|
|
||||||
|
void __kmp_env_blk_init(kmp_env_blk_t *block, // M: Block to initialize.
|
||||||
|
char const *bulk // I: Initialization string, or NULL.
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (bulk != NULL) {
|
||||||
void
|
___kmp_env_blk_parse_string(block, bulk);
|
||||||
__kmp_env_blk_init(
|
|
||||||
kmp_env_blk_t * block, // M: Block to initialize.
|
|
||||||
char const * bulk // I: Initialization string, or NULL.
|
|
||||||
) {
|
|
||||||
|
|
||||||
if ( bulk != NULL ) {
|
|
||||||
___kmp_env_blk_parse_string( block, bulk );
|
|
||||||
} else {
|
} else {
|
||||||
#if KMP_OS_UNIX
|
#if KMP_OS_UNIX
|
||||||
___kmp_env_blk_parse_unix( block, environ );
|
___kmp_env_blk_parse_unix(block, environ);
|
||||||
#elif KMP_OS_WINDOWS
|
#elif KMP_OS_WINDOWS
|
||||||
{
|
{
|
||||||
char * mem = GetEnvironmentStrings();
|
char *mem = GetEnvironmentStrings();
|
||||||
if ( mem == NULL ) {
|
if (mem == NULL) {
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
__kmp_msg(
|
__kmp_msg(kmp_ms_fatal, KMP_MSG(CantGetEnvironment), KMP_ERR(error),
|
||||||
kmp_ms_fatal,
|
__kmp_msg_null);
|
||||||
KMP_MSG( CantGetEnvironment ),
|
|
||||||
KMP_ERR( error ),
|
|
||||||
__kmp_msg_null
|
|
||||||
);
|
|
||||||
}; // if
|
}; // if
|
||||||
___kmp_env_blk_parse_windows( block, mem );
|
___kmp_env_blk_parse_windows(block, mem);
|
||||||
FreeEnvironmentStrings( mem );
|
FreeEnvironmentStrings(mem);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#error Unknown or unsupported OS.
|
#error Unknown or unsupported OS.
|
||||||
#endif
|
#endif
|
||||||
}; // if
|
}; // if
|
||||||
|
|
||||||
} // __kmp_env_blk_init
|
} // __kmp_env_blk_init
|
||||||
|
|
||||||
|
static int ___kmp_env_var_cmp( // Comparison function for qsort().
|
||||||
|
kmp_env_var_t const *lhs, kmp_env_var_t const *rhs) {
|
||||||
static
|
return strcmp(lhs->name, rhs->name);
|
||||||
int
|
|
||||||
___kmp_env_var_cmp( // Comparison function for qsort().
|
|
||||||
kmp_env_var_t const * lhs,
|
|
||||||
kmp_env_var_t const * rhs
|
|
||||||
) {
|
|
||||||
return strcmp( lhs->name, rhs->name );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void __kmp_env_blk_sort(
|
||||||
__kmp_env_blk_sort(
|
kmp_env_blk_t *block // M: Block of environment variables to sort.
|
||||||
kmp_env_blk_t * block // M: Block of environment variables to sort.
|
) {
|
||||||
) {
|
|
||||||
|
|
||||||
qsort(
|
qsort((void *)block->vars, block->count, sizeof(kmp_env_var_t),
|
||||||
(void *) block->vars,
|
(int (*)(void const *, void const *)) & ___kmp_env_var_cmp);
|
||||||
block->count,
|
|
||||||
sizeof( kmp_env_var_t ),
|
|
||||||
( int ( * )( void const *, void const * ) ) & ___kmp_env_var_cmp
|
|
||||||
);
|
|
||||||
|
|
||||||
} // __kmp_env_block_sort
|
} // __kmp_env_block_sort
|
||||||
|
|
||||||
|
void __kmp_env_blk_free(
|
||||||
|
kmp_env_blk_t *block // M: Block of environment variables to free.
|
||||||
|
) {
|
||||||
|
|
||||||
|
KMP_INTERNAL_FREE((void *)block->vars);
|
||||||
void
|
|
||||||
__kmp_env_blk_free(
|
|
||||||
kmp_env_blk_t * block // M: Block of environment variables to free.
|
|
||||||
) {
|
|
||||||
|
|
||||||
KMP_INTERNAL_FREE( (void *) block->vars );
|
|
||||||
__kmp_str_free(&(block->bulk));
|
__kmp_str_free(&(block->bulk));
|
||||||
|
|
||||||
block->count = 0;
|
block->count = 0;
|
||||||
|
|
@ -573,23 +492,20 @@ __kmp_env_blk_free(
|
||||||
|
|
||||||
} // __kmp_env_blk_free
|
} // __kmp_env_blk_free
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char const * // R: Value of variable or NULL if variable does not exist.
|
char const * // R: Value of variable or NULL if variable does not exist.
|
||||||
__kmp_env_blk_var(
|
__kmp_env_blk_var(
|
||||||
kmp_env_blk_t * block, // I: Block of environment variables.
|
kmp_env_blk_t *block, // I: Block of environment variables.
|
||||||
char const * name // I: Name of variable to find.
|
char const *name // I: Name of variable to find.
|
||||||
) {
|
) {
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for ( i = 0; i < block->count; ++ i ) {
|
for (i = 0; i < block->count; ++i) {
|
||||||
if ( strcmp( block->vars[ i ].name, name ) == 0 ) {
|
if (strcmp(block->vars[i].name, name) == 0) {
|
||||||
return block->vars[ i ].value;
|
return block->vars[i].value;
|
||||||
}; // if
|
}; // if
|
||||||
}; // for
|
}; // for
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
} // __kmp_env_block_var
|
} // __kmp_env_block_var
|
||||||
|
|
||||||
|
|
||||||
// end of file //
|
// end of file //
|
||||||
|
|
|
||||||
|
|
@ -20,56 +20,56 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Return a copy of the value of environment variable or NULL if the variable does not exist.
|
// Return a copy of the value of environment variable or NULL if the variable
|
||||||
|
// does not exist.
|
||||||
// *Note*: Returned pointed *must* be freed after use with __kmp_env_free().
|
// *Note*: Returned pointed *must* be freed after use with __kmp_env_free().
|
||||||
char * __kmp_env_get( char const * name );
|
char *__kmp_env_get(char const *name);
|
||||||
void __kmp_env_free( char const * * value );
|
void __kmp_env_free(char const **value);
|
||||||
|
|
||||||
// Return 1 if the environment variable exists or 0 if does not exist.
|
// Return 1 if the environment variable exists or 0 if does not exist.
|
||||||
int __kmp_env_exists( char const * name );
|
int __kmp_env_exists(char const *name);
|
||||||
|
|
||||||
// Set the environment variable.
|
// Set the environment variable.
|
||||||
void __kmp_env_set( char const * name, char const * value, int overwrite );
|
void __kmp_env_set(char const *name, char const *value, int overwrite);
|
||||||
|
|
||||||
// Unset (remove) environment variable.
|
// Unset (remove) environment variable.
|
||||||
void __kmp_env_unset( char const * name );
|
void __kmp_env_unset(char const *name);
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
// Working with environment blocks.
|
// Working with environment blocks.
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*
|
/* kmp_env_blk_t is read-only collection of environment variables (or
|
||||||
kmp_env_blk_t is read-only collection of environment variables (or environment-like). Usage:
|
environment-like). Usage:
|
||||||
|
|
||||||
kmp_env_blk_t block;
|
kmp_env_blk_t block;
|
||||||
__kmp_env_blk_init( & block, NULL ); // Initialize block from process environment.
|
__kmp_env_blk_init( & block, NULL ); // Initialize block from process
|
||||||
// or
|
// environment.
|
||||||
__kmp_env_blk_init( & block, "KMP_WARNING=1|KMP_AFFINITY=none" ); // from string.
|
// or
|
||||||
__kmp_env_blk_sort( & block ); // Optionally, sort list.
|
__kmp_env_blk_init( & block, "KMP_WARNING=1|KMP_AFFINITY=none" ); // from string
|
||||||
for ( i = 0; i < block.count; ++ i ) {
|
__kmp_env_blk_sort( & block ); // Optionally, sort list.
|
||||||
|
for ( i = 0; i < block.count; ++ i ) {
|
||||||
// Process block.vars[ i ].name and block.vars[ i ].value...
|
// Process block.vars[ i ].name and block.vars[ i ].value...
|
||||||
}; // for i
|
}; // for i
|
||||||
__kmp_env_block_free( & block );
|
__kmp_env_block_free( & block );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct __kmp_env_var {
|
struct __kmp_env_var {
|
||||||
char const * name;
|
char const *name;
|
||||||
char const * value;
|
char const *value;
|
||||||
};
|
};
|
||||||
typedef struct __kmp_env_var kmp_env_var_t;
|
typedef struct __kmp_env_var kmp_env_var_t;
|
||||||
|
|
||||||
struct __kmp_env_blk {
|
struct __kmp_env_blk {
|
||||||
char const * bulk;
|
char const *bulk;
|
||||||
kmp_env_var_t const * vars;
|
kmp_env_var_t const *vars;
|
||||||
int count;
|
int count;
|
||||||
};
|
};
|
||||||
typedef struct __kmp_env_blk kmp_env_blk_t;
|
typedef struct __kmp_env_blk kmp_env_blk_t;
|
||||||
|
|
||||||
void __kmp_env_blk_init( kmp_env_blk_t * block, char const * bulk );
|
void __kmp_env_blk_init(kmp_env_blk_t *block, char const *bulk);
|
||||||
void __kmp_env_blk_free( kmp_env_blk_t * block );
|
void __kmp_env_blk_free(kmp_env_blk_t *block);
|
||||||
void __kmp_env_blk_sort( kmp_env_blk_t * block );
|
void __kmp_env_blk_sort(kmp_env_blk_t *block);
|
||||||
char const * __kmp_env_blk_var( kmp_env_blk_t * block, char const * name );
|
char const *__kmp_env_blk_var(kmp_env_blk_t *block, char const *name);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
@ -78,4 +78,3 @@ char const * __kmp_env_blk_var( kmp_env_blk_t * block, char const * name );
|
||||||
#endif // KMP_ENVIRONMENT_H
|
#endif // KMP_ENVIRONMENT_H
|
||||||
|
|
||||||
// end of file //
|
// end of file //
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,59 +14,45 @@
|
||||||
|
|
||||||
|
|
||||||
#include "kmp.h"
|
#include "kmp.h"
|
||||||
|
#include "kmp_error.h"
|
||||||
#include "kmp_i18n.h"
|
#include "kmp_i18n.h"
|
||||||
#include "kmp_str.h"
|
#include "kmp_str.h"
|
||||||
#include "kmp_error.h"
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
#define MIN_STACK 100
|
#define MIN_STACK 100
|
||||||
|
|
||||||
|
static char const *cons_text_c[] = {
|
||||||
static char const * cons_text_c[] = {
|
"(none)", "\"parallel\"", "work-sharing", /* this is not called "for"
|
||||||
"(none)",
|
because of lowering of
|
||||||
"\"parallel\"",
|
"sections" pragmas */
|
||||||
"work-sharing", /* this is not called "for" because of lowering of "sections" pragmas */
|
"\"ordered\" work-sharing", /* this is not called "for ordered" because of
|
||||||
"\"ordered\" work-sharing", /* this is not called "for ordered" because of lowering of "sections" pragmas */
|
lowering of "sections" pragmas */
|
||||||
"\"sections\"",
|
"\"sections\"",
|
||||||
"work-sharing", /* this is not called "single" because of lowering of "sections" pragmas */
|
"work-sharing", /* this is not called "single" because of lowering of
|
||||||
"\"taskq\"",
|
"sections" pragmas */
|
||||||
"\"taskq\"",
|
"\"taskq\"", "\"taskq\"", "\"taskq ordered\"", "\"critical\"",
|
||||||
"\"taskq ordered\"",
|
|
||||||
"\"critical\"",
|
|
||||||
"\"ordered\"", /* in PARALLEL */
|
"\"ordered\"", /* in PARALLEL */
|
||||||
"\"ordered\"", /* in PDO */
|
"\"ordered\"", /* in PDO */
|
||||||
"\"ordered\"", /* in TASKQ */
|
"\"ordered\"", /* in TASKQ */
|
||||||
"\"master\"",
|
"\"master\"", "\"reduce\"", "\"barrier\""};
|
||||||
"\"reduce\"",
|
|
||||||
"\"barrier\""
|
|
||||||
};
|
|
||||||
|
|
||||||
#define get_src( ident ) ( (ident) == NULL ? NULL : (ident)->psource )
|
#define get_src(ident) ((ident) == NULL ? NULL : (ident)->psource)
|
||||||
|
|
||||||
#define PUSH_MSG( ct, ident ) \
|
#define PUSH_MSG(ct, ident) \
|
||||||
"\tpushing on stack: %s (%s)\n", cons_text_c[ (ct) ], get_src( (ident) )
|
"\tpushing on stack: %s (%s)\n", cons_text_c[(ct)], get_src((ident))
|
||||||
#define POP_MSG( p ) \
|
#define POP_MSG(p) \
|
||||||
"\tpopping off stack: %s (%s)\n", \
|
"\tpopping off stack: %s (%s)\n", cons_text_c[(p)->stack_data[tos].type], \
|
||||||
cons_text_c[ (p)->stack_data[ tos ].type ], \
|
get_src((p)->stack_data[tos].ident)
|
||||||
get_src( (p)->stack_data[ tos ].ident )
|
|
||||||
|
|
||||||
static int const cons_text_c_num = sizeof( cons_text_c ) / sizeof( char const * );
|
static int const cons_text_c_num = sizeof(cons_text_c) / sizeof(char const *);
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
/* --------------- START OF STATIC LOCAL ROUTINES ------------------------- */
|
/* --------------- START OF STATIC LOCAL ROUTINES ------------------------- */
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
|
|
||||||
static void
|
static void __kmp_check_null_func(void) { /* nothing to do */
|
||||||
__kmp_check_null_func( void )
|
|
||||||
{
|
|
||||||
/* nothing to do */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __kmp_expand_cons_stack(int gtid, struct cons_header *p) {
|
||||||
__kmp_expand_cons_stack( int gtid, struct cons_header *p )
|
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
struct cons_data *d;
|
struct cons_data *d;
|
||||||
|
|
||||||
|
|
@ -74,14 +60,15 @@ __kmp_expand_cons_stack( int gtid, struct cons_header *p )
|
||||||
if (gtid < 0)
|
if (gtid < 0)
|
||||||
__kmp_check_null_func();
|
__kmp_check_null_func();
|
||||||
|
|
||||||
KE_TRACE( 10, ("expand cons_stack (%d %d)\n", gtid, __kmp_get_gtid() ) );
|
KE_TRACE(10, ("expand cons_stack (%d %d)\n", gtid, __kmp_get_gtid()));
|
||||||
|
|
||||||
d = p->stack_data;
|
d = p->stack_data;
|
||||||
|
|
||||||
p->stack_size = (p->stack_size * 2) + 100;
|
p->stack_size = (p->stack_size * 2) + 100;
|
||||||
|
|
||||||
/* TODO free the old data */
|
/* TODO free the old data */
|
||||||
p->stack_data = (struct cons_data *) __kmp_allocate( sizeof( struct cons_data ) * (p->stack_size+1) );
|
p->stack_data = (struct cons_data *)__kmp_allocate(sizeof(struct cons_data) *
|
||||||
|
(p->stack_size + 1));
|
||||||
|
|
||||||
for (i = p->stack_top; i >= 0; --i)
|
for (i = p->stack_top; i >= 0; --i)
|
||||||
p->stack_data[i] = d[i];
|
p->stack_data[i] = d[i];
|
||||||
|
|
@ -90,183 +77,174 @@ __kmp_expand_cons_stack( int gtid, struct cons_header *p )
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Function returns allocated memory, caller must free it!
|
// NOTE: Function returns allocated memory, caller must free it!
|
||||||
static char const *
|
static char const *__kmp_pragma(int ct, ident_t const *ident) {
|
||||||
__kmp_pragma(
|
char const *cons = NULL; // Construct name.
|
||||||
int ct,
|
char *file = NULL; // File name.
|
||||||
ident_t const * ident
|
char *func = NULL; // Function (routine) name.
|
||||||
) {
|
char *line = NULL; // Line number.
|
||||||
char const * cons = NULL; // Construct name.
|
|
||||||
char * file = NULL; // File name.
|
|
||||||
char * func = NULL; // Function (routine) name.
|
|
||||||
char * line = NULL; // Line number.
|
|
||||||
kmp_str_buf_t buffer;
|
kmp_str_buf_t buffer;
|
||||||
kmp_msg_t prgm;
|
kmp_msg_t prgm;
|
||||||
__kmp_str_buf_init( & buffer );
|
__kmp_str_buf_init(&buffer);
|
||||||
if ( 0 < ct && ct < cons_text_c_num ) {
|
if (0 < ct && ct < cons_text_c_num) {
|
||||||
cons = cons_text_c[ ct ];
|
cons = cons_text_c[ct];
|
||||||
} else {
|
} else {
|
||||||
KMP_DEBUG_ASSERT( 0 );
|
KMP_DEBUG_ASSERT(0);
|
||||||
};
|
};
|
||||||
if ( ident != NULL && ident->psource != NULL ) {
|
if (ident != NULL && ident->psource != NULL) {
|
||||||
char * tail = NULL;
|
char *tail = NULL;
|
||||||
__kmp_str_buf_print( & buffer, "%s", ident->psource ); // Copy source to buffer.
|
__kmp_str_buf_print(&buffer, "%s",
|
||||||
|
ident->psource); // Copy source to buffer.
|
||||||
// Split string in buffer to file, func, and line.
|
// Split string in buffer to file, func, and line.
|
||||||
tail = buffer.str;
|
tail = buffer.str;
|
||||||
__kmp_str_split( tail, ';', NULL, & tail );
|
__kmp_str_split(tail, ';', NULL, &tail);
|
||||||
__kmp_str_split( tail, ';', & file, & tail );
|
__kmp_str_split(tail, ';', &file, &tail);
|
||||||
__kmp_str_split( tail, ';', & func, & tail );
|
__kmp_str_split(tail, ';', &func, &tail);
|
||||||
__kmp_str_split( tail, ';', & line, & tail );
|
__kmp_str_split(tail, ';', &line, &tail);
|
||||||
}; // if
|
}; // if
|
||||||
prgm = __kmp_msg_format( kmp_i18n_fmt_Pragma, cons, file, func, line );
|
prgm = __kmp_msg_format(kmp_i18n_fmt_Pragma, cons, file, func, line);
|
||||||
__kmp_str_buf_free( & buffer );
|
__kmp_str_buf_free(&buffer);
|
||||||
return prgm.str;
|
return prgm.str;
|
||||||
} // __kmp_pragma
|
} // __kmp_pragma
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
/* ----------------- END OF STATIC LOCAL ROUTINES ------------------------- */
|
/* ----------------- END OF STATIC LOCAL ROUTINES ------------------------- */
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
|
|
||||||
|
void __kmp_error_construct(kmp_i18n_id_t id, // Message identifier.
|
||||||
void
|
|
||||||
__kmp_error_construct(
|
|
||||||
kmp_i18n_id_t id, // Message identifier.
|
|
||||||
enum cons_type ct, // Construct type.
|
enum cons_type ct, // Construct type.
|
||||||
ident_t const * ident // Construct ident.
|
ident_t const *ident // Construct ident.
|
||||||
) {
|
) {
|
||||||
char const * construct = __kmp_pragma( ct, ident );
|
char const *construct = __kmp_pragma(ct, ident);
|
||||||
__kmp_msg( kmp_ms_fatal, __kmp_msg_format( id, construct ), __kmp_msg_null );
|
__kmp_msg(kmp_ms_fatal, __kmp_msg_format(id, construct), __kmp_msg_null);
|
||||||
KMP_INTERNAL_FREE( (void *) construct );
|
KMP_INTERNAL_FREE((void *)construct);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void __kmp_error_construct2(kmp_i18n_id_t id, // Message identifier.
|
||||||
__kmp_error_construct2(
|
|
||||||
kmp_i18n_id_t id, // Message identifier.
|
|
||||||
enum cons_type ct, // First construct type.
|
enum cons_type ct, // First construct type.
|
||||||
ident_t const * ident, // First construct ident.
|
ident_t const *ident, // First construct ident.
|
||||||
struct cons_data const * cons // Second construct.
|
struct cons_data const *cons // Second construct.
|
||||||
) {
|
) {
|
||||||
char const * construct1 = __kmp_pragma( ct, ident );
|
char const *construct1 = __kmp_pragma(ct, ident);
|
||||||
char const * construct2 = __kmp_pragma( cons->type, cons->ident );
|
char const *construct2 = __kmp_pragma(cons->type, cons->ident);
|
||||||
__kmp_msg( kmp_ms_fatal, __kmp_msg_format( id, construct1, construct2 ), __kmp_msg_null );
|
__kmp_msg(kmp_ms_fatal, __kmp_msg_format(id, construct1, construct2),
|
||||||
KMP_INTERNAL_FREE( (void *) construct1 );
|
__kmp_msg_null);
|
||||||
KMP_INTERNAL_FREE( (void *) construct2 );
|
KMP_INTERNAL_FREE((void *)construct1);
|
||||||
|
KMP_INTERNAL_FREE((void *)construct2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct cons_header *__kmp_allocate_cons_stack(int gtid) {
|
||||||
struct cons_header *
|
|
||||||
__kmp_allocate_cons_stack( int gtid )
|
|
||||||
{
|
|
||||||
struct cons_header *p;
|
struct cons_header *p;
|
||||||
|
|
||||||
/* TODO for monitor perhaps? */
|
/* TODO for monitor perhaps? */
|
||||||
if ( gtid < 0 ) {
|
if (gtid < 0) {
|
||||||
__kmp_check_null_func();
|
__kmp_check_null_func();
|
||||||
}; // if
|
}; // if
|
||||||
KE_TRACE( 10, ("allocate cons_stack (%d)\n", gtid ) );
|
KE_TRACE(10, ("allocate cons_stack (%d)\n", gtid));
|
||||||
p = (struct cons_header *) __kmp_allocate( sizeof( struct cons_header ) );
|
p = (struct cons_header *)__kmp_allocate(sizeof(struct cons_header));
|
||||||
p->p_top = p->w_top = p->s_top = 0;
|
p->p_top = p->w_top = p->s_top = 0;
|
||||||
p->stack_data = (struct cons_data *) __kmp_allocate( sizeof( struct cons_data ) * (MIN_STACK+1) );
|
p->stack_data = (struct cons_data *)__kmp_allocate(sizeof(struct cons_data) *
|
||||||
|
(MIN_STACK + 1));
|
||||||
p->stack_size = MIN_STACK;
|
p->stack_size = MIN_STACK;
|
||||||
p->stack_top = 0;
|
p->stack_top = 0;
|
||||||
p->stack_data[ 0 ].type = ct_none;
|
p->stack_data[0].type = ct_none;
|
||||||
p->stack_data[ 0 ].prev = 0;
|
p->stack_data[0].prev = 0;
|
||||||
p->stack_data[ 0 ].ident = NULL;
|
p->stack_data[0].ident = NULL;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void __kmp_free_cons_stack(void *ptr) {
|
||||||
__kmp_free_cons_stack( void * ptr ) {
|
struct cons_header *p = (struct cons_header *)ptr;
|
||||||
struct cons_header * p = (struct cons_header *) ptr;
|
if (p != NULL) {
|
||||||
if ( p != NULL ) {
|
if (p->stack_data != NULL) {
|
||||||
if ( p->stack_data != NULL ) {
|
__kmp_free(p->stack_data);
|
||||||
__kmp_free( p->stack_data );
|
|
||||||
p->stack_data = NULL;
|
p->stack_data = NULL;
|
||||||
}; // if
|
}; // if
|
||||||
__kmp_free( p );
|
__kmp_free(p);
|
||||||
}; // if
|
}; // if
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if KMP_DEBUG
|
#if KMP_DEBUG
|
||||||
static void
|
static void dump_cons_stack(int gtid, struct cons_header *p) {
|
||||||
dump_cons_stack( int gtid, struct cons_header * p ) {
|
|
||||||
int i;
|
int i;
|
||||||
int tos = p->stack_top;
|
int tos = p->stack_top;
|
||||||
kmp_str_buf_t buffer;
|
kmp_str_buf_t buffer;
|
||||||
__kmp_str_buf_init( & buffer );
|
__kmp_str_buf_init(&buffer);
|
||||||
__kmp_str_buf_print( & buffer, "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n" );
|
__kmp_str_buf_print(
|
||||||
__kmp_str_buf_print( & buffer, "Begin construct stack with %d items for thread %d\n", tos, gtid );
|
&buffer,
|
||||||
__kmp_str_buf_print( & buffer, " stack_top=%d { P=%d, W=%d, S=%d }\n", tos, p->p_top, p->w_top, p->s_top );
|
"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n");
|
||||||
for ( i = tos; i > 0; i-- ) {
|
__kmp_str_buf_print(&buffer,
|
||||||
struct cons_data * c = & ( p->stack_data[ i ] );
|
"Begin construct stack with %d items for thread %d\n",
|
||||||
__kmp_str_buf_print( & buffer, " stack_data[%2d] = { %s (%s) %d %p }\n", i, cons_text_c[ c->type ], get_src( c->ident ), c->prev, c->name );
|
tos, gtid);
|
||||||
|
__kmp_str_buf_print(&buffer, " stack_top=%d { P=%d, W=%d, S=%d }\n", tos,
|
||||||
|
p->p_top, p->w_top, p->s_top);
|
||||||
|
for (i = tos; i > 0; i--) {
|
||||||
|
struct cons_data *c = &(p->stack_data[i]);
|
||||||
|
__kmp_str_buf_print(
|
||||||
|
&buffer, " stack_data[%2d] = { %s (%s) %d %p }\n", i,
|
||||||
|
cons_text_c[c->type], get_src(c->ident), c->prev, c->name);
|
||||||
}; // for i
|
}; // for i
|
||||||
__kmp_str_buf_print( & buffer, "End construct stack for thread %d\n", gtid );
|
__kmp_str_buf_print(&buffer, "End construct stack for thread %d\n", gtid);
|
||||||
__kmp_str_buf_print( & buffer, "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n" );
|
__kmp_str_buf_print(
|
||||||
__kmp_debug_printf( "%s", buffer.str );
|
&buffer,
|
||||||
__kmp_str_buf_free( & buffer );
|
"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n");
|
||||||
|
__kmp_debug_printf("%s", buffer.str);
|
||||||
|
__kmp_str_buf_free(&buffer);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void __kmp_push_parallel(int gtid, ident_t const *ident) {
|
||||||
__kmp_push_parallel( int gtid, ident_t const * ident )
|
|
||||||
{
|
|
||||||
int tos;
|
int tos;
|
||||||
struct cons_header *p = __kmp_threads[ gtid ]->th.th_cons;
|
struct cons_header *p = __kmp_threads[gtid]->th.th_cons;
|
||||||
|
|
||||||
KMP_DEBUG_ASSERT( __kmp_threads[ gtid ]-> th.th_cons );
|
KMP_DEBUG_ASSERT(__kmp_threads[gtid]->th.th_cons);
|
||||||
KE_TRACE( 10, ("__kmp_push_parallel (%d %d)\n", gtid, __kmp_get_gtid() ) );
|
KE_TRACE(10, ("__kmp_push_parallel (%d %d)\n", gtid, __kmp_get_gtid()));
|
||||||
KE_TRACE( 100, ( PUSH_MSG( ct_parallel, ident ) ) );
|
KE_TRACE(100, (PUSH_MSG(ct_parallel, ident)));
|
||||||
if ( p->stack_top >= p->stack_size ) {
|
if (p->stack_top >= p->stack_size) {
|
||||||
__kmp_expand_cons_stack( gtid, p );
|
__kmp_expand_cons_stack(gtid, p);
|
||||||
}; // if
|
}; // if
|
||||||
tos = ++p->stack_top;
|
tos = ++p->stack_top;
|
||||||
p->stack_data[ tos ].type = ct_parallel;
|
p->stack_data[tos].type = ct_parallel;
|
||||||
p->stack_data[ tos ].prev = p->p_top;
|
p->stack_data[tos].prev = p->p_top;
|
||||||
p->stack_data[ tos ].ident = ident;
|
p->stack_data[tos].ident = ident;
|
||||||
p->stack_data[ tos ].name = NULL;
|
p->stack_data[tos].name = NULL;
|
||||||
p->p_top = tos;
|
p->p_top = tos;
|
||||||
KE_DUMP( 1000, dump_cons_stack( gtid, p ) );
|
KE_DUMP(1000, dump_cons_stack(gtid, p));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void __kmp_check_workshare(int gtid, enum cons_type ct, ident_t const *ident) {
|
||||||
__kmp_check_workshare( int gtid, enum cons_type ct, ident_t const * ident )
|
struct cons_header *p = __kmp_threads[gtid]->th.th_cons;
|
||||||
{
|
|
||||||
struct cons_header *p = __kmp_threads[ gtid ]->th.th_cons;
|
|
||||||
|
|
||||||
KMP_DEBUG_ASSERT( __kmp_threads[ gtid ]-> th.th_cons );
|
KMP_DEBUG_ASSERT(__kmp_threads[gtid]->th.th_cons);
|
||||||
KE_TRACE( 10, ("__kmp_check_workshare (%d %d)\n", gtid, __kmp_get_gtid() ) );
|
KE_TRACE(10, ("__kmp_check_workshare (%d %d)\n", gtid, __kmp_get_gtid()));
|
||||||
|
|
||||||
|
if (p->stack_top >= p->stack_size) {
|
||||||
if ( p->stack_top >= p->stack_size ) {
|
__kmp_expand_cons_stack(gtid, p);
|
||||||
__kmp_expand_cons_stack( gtid, p );
|
|
||||||
}; // if
|
}; // if
|
||||||
if ( p->w_top > p->p_top &&
|
if (p->w_top > p->p_top &&
|
||||||
!(IS_CONS_TYPE_TASKQ(p->stack_data[ p->w_top ].type) && IS_CONS_TYPE_TASKQ(ct))) {
|
!(IS_CONS_TYPE_TASKQ(p->stack_data[p->w_top].type) &&
|
||||||
|
IS_CONS_TYPE_TASKQ(ct))) {
|
||||||
// We are already in a WORKSHARE construct for this PARALLEL region.
|
// We are already in a WORKSHARE construct for this PARALLEL region.
|
||||||
__kmp_error_construct2( kmp_i18n_msg_CnsInvalidNesting, ct, ident, & p->stack_data[ p->w_top ] );
|
__kmp_error_construct2(kmp_i18n_msg_CnsInvalidNesting, ct, ident,
|
||||||
|
&p->stack_data[p->w_top]);
|
||||||
}; // if
|
}; // if
|
||||||
if ( p->s_top > p->p_top ) {
|
if (p->s_top > p->p_top) {
|
||||||
// We are already in a SYNC construct for this PARALLEL region.
|
// We are already in a SYNC construct for this PARALLEL region.
|
||||||
__kmp_error_construct2( kmp_i18n_msg_CnsInvalidNesting, ct, ident, & p->stack_data[ p->s_top ] );
|
__kmp_error_construct2(kmp_i18n_msg_CnsInvalidNesting, ct, ident,
|
||||||
|
&p->stack_data[p->s_top]);
|
||||||
}; // if
|
}; // if
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void __kmp_push_workshare(int gtid, enum cons_type ct, ident_t const *ident) {
|
||||||
__kmp_push_workshare( int gtid, enum cons_type ct, ident_t const * ident )
|
|
||||||
{
|
|
||||||
int tos;
|
int tos;
|
||||||
struct cons_header *p = __kmp_threads[ gtid ]->th.th_cons;
|
struct cons_header *p = __kmp_threads[gtid]->th.th_cons;
|
||||||
KE_TRACE( 10, ("__kmp_push_workshare (%d %d)\n", gtid, __kmp_get_gtid() ) );
|
KE_TRACE(10, ("__kmp_push_workshare (%d %d)\n", gtid, __kmp_get_gtid()));
|
||||||
__kmp_check_workshare( gtid, ct, ident );
|
__kmp_check_workshare(gtid, ct, ident);
|
||||||
KE_TRACE( 100, ( PUSH_MSG( ct, ident ) ) );
|
KE_TRACE(100, (PUSH_MSG(ct, ident)));
|
||||||
tos = ++p->stack_top;
|
tos = ++p->stack_top;
|
||||||
p->stack_data[ tos ].type = ct;
|
p->stack_data[tos].type = ct;
|
||||||
p->stack_data[ tos ].prev = p->w_top;
|
p->stack_data[tos].prev = p->w_top;
|
||||||
p->stack_data[ tos ].ident = ident;
|
p->stack_data[tos].ident = ident;
|
||||||
p->stack_data[ tos ].name = NULL;
|
p->stack_data[tos].name = NULL;
|
||||||
p->w_top = tos;
|
p->w_top = tos;
|
||||||
KE_DUMP( 1000, dump_cons_stack( gtid, p ) );
|
KE_DUMP(1000, dump_cons_stack(gtid, p));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -276,37 +254,32 @@ __kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_l
|
||||||
__kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p lck )
|
__kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p lck )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
struct cons_header *p = __kmp_threads[ gtid ]->th.th_cons;
|
struct cons_header *p = __kmp_threads[gtid]->th.th_cons;
|
||||||
|
|
||||||
KE_TRACE( 10, ("__kmp_check_sync (gtid=%d)\n", __kmp_get_gtid() ) );
|
KE_TRACE(10, ("__kmp_check_sync (gtid=%d)\n", __kmp_get_gtid()));
|
||||||
|
|
||||||
if (p->stack_top >= p->stack_size)
|
if (p->stack_top >= p->stack_size)
|
||||||
__kmp_expand_cons_stack( gtid, p );
|
__kmp_expand_cons_stack(gtid, p);
|
||||||
|
|
||||||
if (ct == ct_ordered_in_parallel || ct == ct_ordered_in_pdo || ct == ct_ordered_in_taskq ) {
|
if (ct == ct_ordered_in_parallel || ct == ct_ordered_in_pdo ||
|
||||||
|
ct == ct_ordered_in_taskq) {
|
||||||
if (p->w_top <= p->p_top) {
|
if (p->w_top <= p->p_top) {
|
||||||
/* we are not in a worksharing construct */
|
/* we are not in a worksharing construct */
|
||||||
#ifdef BUILD_PARALLEL_ORDERED
|
#ifdef BUILD_PARALLEL_ORDERED
|
||||||
/* do not report error messages for PARALLEL ORDERED */
|
/* do not report error messages for PARALLEL ORDERED */
|
||||||
KMP_ASSERT( ct == ct_ordered_in_parallel );
|
KMP_ASSERT(ct == ct_ordered_in_parallel);
|
||||||
#else
|
#else
|
||||||
__kmp_error_construct( kmp_i18n_msg_CnsBoundToWorksharing, ct, ident );
|
__kmp_error_construct(kmp_i18n_msg_CnsBoundToWorksharing, ct, ident);
|
||||||
#endif /* BUILD_PARALLEL_ORDERED */
|
#endif /* BUILD_PARALLEL_ORDERED */
|
||||||
} else {
|
} else {
|
||||||
/* inside a WORKSHARING construct for this PARALLEL region */
|
/* inside a WORKSHARING construct for this PARALLEL region */
|
||||||
if (!IS_CONS_TYPE_ORDERED(p->stack_data[ p->w_top ].type)) {
|
if (!IS_CONS_TYPE_ORDERED(p->stack_data[p->w_top].type)) {
|
||||||
if (p->stack_data[ p->w_top ].type == ct_taskq) {
|
if (p->stack_data[p->w_top].type == ct_taskq) {
|
||||||
__kmp_error_construct2(
|
__kmp_error_construct2(kmp_i18n_msg_CnsNotInTaskConstruct, ct, ident,
|
||||||
kmp_i18n_msg_CnsNotInTaskConstruct,
|
&p->stack_data[p->w_top]);
|
||||||
ct, ident,
|
|
||||||
& p->stack_data[ p->w_top ]
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
__kmp_error_construct2(
|
__kmp_error_construct2(kmp_i18n_msg_CnsNoOrderedClause, ct, ident,
|
||||||
kmp_i18n_msg_CnsNoOrderedClause,
|
&p->stack_data[p->w_top]);
|
||||||
ct, ident,
|
|
||||||
& p->stack_data[ p->w_top ]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -315,57 +288,55 @@ __kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_l
|
||||||
int index = p->s_top;
|
int index = p->s_top;
|
||||||
enum cons_type stack_type;
|
enum cons_type stack_type;
|
||||||
|
|
||||||
stack_type = p->stack_data[ index ].type;
|
stack_type = p->stack_data[index].type;
|
||||||
|
|
||||||
if (stack_type == ct_critical ||
|
if (stack_type == ct_critical ||
|
||||||
( ( stack_type == ct_ordered_in_parallel ||
|
((stack_type == ct_ordered_in_parallel ||
|
||||||
stack_type == ct_ordered_in_pdo ||
|
stack_type == ct_ordered_in_pdo ||
|
||||||
stack_type == ct_ordered_in_taskq ) && /* C doesn't allow named ordered; ordered in ordered gets error */
|
stack_type ==
|
||||||
p->stack_data[ index ].ident != NULL &&
|
ct_ordered_in_taskq) && /* C doesn't allow named ordered;
|
||||||
(p->stack_data[ index ].ident->flags & KMP_IDENT_KMPC ))) {
|
ordered in ordered gets error */
|
||||||
|
p->stack_data[index].ident != NULL &&
|
||||||
|
(p->stack_data[index].ident->flags & KMP_IDENT_KMPC))) {
|
||||||
/* we are in ORDERED which is inside an ORDERED or CRITICAL construct */
|
/* we are in ORDERED which is inside an ORDERED or CRITICAL construct */
|
||||||
__kmp_error_construct2(
|
__kmp_error_construct2(kmp_i18n_msg_CnsInvalidNesting, ct, ident,
|
||||||
kmp_i18n_msg_CnsInvalidNesting,
|
&p->stack_data[index]);
|
||||||
ct, ident,
|
|
||||||
& p->stack_data[ index ]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ( ct == ct_critical ) {
|
} else if (ct == ct_critical) {
|
||||||
#if KMP_USE_DYNAMIC_LOCK
|
#if KMP_USE_DYNAMIC_LOCK
|
||||||
if ( lck != NULL && __kmp_get_user_lock_owner( lck, seq ) == gtid ) { /* this same thread already has lock for this critical section */
|
if (lck != NULL &&
|
||||||
|
__kmp_get_user_lock_owner(lck, seq) ==
|
||||||
|
gtid) { /* this thread already has lock for this critical section */
|
||||||
#else
|
#else
|
||||||
if ( lck != NULL && __kmp_get_user_lock_owner( lck ) == gtid ) { /* this same thread already has lock for this critical section */
|
if (lck != NULL &&
|
||||||
|
__kmp_get_user_lock_owner(lck) ==
|
||||||
|
gtid) { /* this thread already has lock for this critical section */
|
||||||
#endif
|
#endif
|
||||||
int index = p->s_top;
|
int index = p->s_top;
|
||||||
struct cons_data cons = { NULL, ct_critical, 0, NULL };
|
struct cons_data cons = {NULL, ct_critical, 0, NULL};
|
||||||
/* walk up construct stack and try to find critical with matching name */
|
/* walk up construct stack and try to find critical with matching name */
|
||||||
while ( index != 0 && p->stack_data[ index ].name != lck ) {
|
while (index != 0 && p->stack_data[index].name != lck) {
|
||||||
index = p->stack_data[ index ].prev;
|
index = p->stack_data[index].prev;
|
||||||
}
|
}
|
||||||
if ( index != 0 ) {
|
if (index != 0) {
|
||||||
/* found match on the stack (may not always because of interleaved critical for Fortran) */
|
/* found match on the stack (may not always because of interleaved
|
||||||
cons = p->stack_data[ index ];
|
* critical for Fortran) */
|
||||||
|
cons = p->stack_data[index];
|
||||||
}
|
}
|
||||||
/* we are in CRITICAL which is inside a CRITICAL construct of the same name */
|
/* we are in CRITICAL which is inside a CRITICAL construct of same name */
|
||||||
__kmp_error_construct2( kmp_i18n_msg_CnsNestingSameName, ct, ident, & cons );
|
__kmp_error_construct2(kmp_i18n_msg_CnsNestingSameName, ct, ident, &cons);
|
||||||
}
|
}
|
||||||
} else if ( ct == ct_master || ct == ct_reduce ) {
|
} else if (ct == ct_master || ct == ct_reduce) {
|
||||||
if (p->w_top > p->p_top) {
|
if (p->w_top > p->p_top) {
|
||||||
/* inside a WORKSHARING construct for this PARALLEL region */
|
/* inside a WORKSHARING construct for this PARALLEL region */
|
||||||
__kmp_error_construct2(
|
__kmp_error_construct2(kmp_i18n_msg_CnsInvalidNesting, ct, ident,
|
||||||
kmp_i18n_msg_CnsInvalidNesting,
|
&p->stack_data[p->w_top]);
|
||||||
ct, ident,
|
|
||||||
& p->stack_data[ p->w_top ]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (ct == ct_reduce && p->s_top > p->p_top) {
|
if (ct == ct_reduce && p->s_top > p->p_top) {
|
||||||
/* inside a another SYNC construct for this PARALLEL region */
|
/* inside a another SYNC construct for this PARALLEL region */
|
||||||
__kmp_error_construct2(
|
__kmp_error_construct2(kmp_i18n_msg_CnsInvalidNesting, ct, ident,
|
||||||
kmp_i18n_msg_CnsInvalidNesting,
|
&p->stack_data[p->s_top]);
|
||||||
ct, ident,
|
|
||||||
& p->stack_data[ p->s_top ]
|
|
||||||
);
|
|
||||||
}; // if
|
}; // if
|
||||||
}; // if
|
}; // if
|
||||||
}
|
}
|
||||||
|
|
@ -378,146 +349,117 @@ __kmp_push_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lo
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int tos;
|
int tos;
|
||||||
struct cons_header *p = __kmp_threads[ gtid ]->th.th_cons;
|
struct cons_header *p = __kmp_threads[gtid]->th.th_cons;
|
||||||
|
|
||||||
KMP_ASSERT( gtid == __kmp_get_gtid() );
|
KMP_ASSERT(gtid == __kmp_get_gtid());
|
||||||
KE_TRACE( 10, ("__kmp_push_sync (gtid=%d)\n", gtid ) );
|
KE_TRACE(10, ("__kmp_push_sync (gtid=%d)\n", gtid));
|
||||||
#if KMP_USE_DYNAMIC_LOCK
|
#if KMP_USE_DYNAMIC_LOCK
|
||||||
__kmp_check_sync( gtid, ct, ident, lck, seq );
|
__kmp_check_sync(gtid, ct, ident, lck, seq);
|
||||||
#else
|
#else
|
||||||
__kmp_check_sync( gtid, ct, ident, lck );
|
__kmp_check_sync(gtid, ct, ident, lck);
|
||||||
#endif
|
#endif
|
||||||
KE_TRACE( 100, ( PUSH_MSG( ct, ident ) ) );
|
KE_TRACE(100, (PUSH_MSG(ct, ident)));
|
||||||
tos = ++ p->stack_top;
|
tos = ++p->stack_top;
|
||||||
p->stack_data[ tos ].type = ct;
|
p->stack_data[tos].type = ct;
|
||||||
p->stack_data[ tos ].prev = p->s_top;
|
p->stack_data[tos].prev = p->s_top;
|
||||||
p->stack_data[ tos ].ident = ident;
|
p->stack_data[tos].ident = ident;
|
||||||
p->stack_data[ tos ].name = lck;
|
p->stack_data[tos].name = lck;
|
||||||
p->s_top = tos;
|
p->s_top = tos;
|
||||||
KE_DUMP( 1000, dump_cons_stack( gtid, p ) );
|
KE_DUMP(1000, dump_cons_stack(gtid, p));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
void
|
void __kmp_pop_parallel(int gtid, ident_t const *ident) {
|
||||||
__kmp_pop_parallel( int gtid, ident_t const * ident )
|
|
||||||
{
|
|
||||||
int tos;
|
int tos;
|
||||||
struct cons_header *p = __kmp_threads[ gtid ]->th.th_cons;
|
struct cons_header *p = __kmp_threads[gtid]->th.th_cons;
|
||||||
tos = p->stack_top;
|
tos = p->stack_top;
|
||||||
KE_TRACE( 10, ("__kmp_pop_parallel (%d %d)\n", gtid, __kmp_get_gtid() ) );
|
KE_TRACE(10, ("__kmp_pop_parallel (%d %d)\n", gtid, __kmp_get_gtid()));
|
||||||
if ( tos == 0 || p->p_top == 0 ) {
|
if (tos == 0 || p->p_top == 0) {
|
||||||
__kmp_error_construct( kmp_i18n_msg_CnsDetectedEnd, ct_parallel, ident );
|
__kmp_error_construct(kmp_i18n_msg_CnsDetectedEnd, ct_parallel, ident);
|
||||||
}
|
}
|
||||||
if ( tos != p->p_top || p->stack_data[ tos ].type != ct_parallel ) {
|
if (tos != p->p_top || p->stack_data[tos].type != ct_parallel) {
|
||||||
__kmp_error_construct2(
|
__kmp_error_construct2(kmp_i18n_msg_CnsExpectedEnd, ct_parallel, ident,
|
||||||
kmp_i18n_msg_CnsExpectedEnd,
|
&p->stack_data[tos]);
|
||||||
ct_parallel, ident,
|
|
||||||
& p->stack_data[ tos ]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
KE_TRACE( 100, ( POP_MSG( p ) ) );
|
KE_TRACE(100, (POP_MSG(p)));
|
||||||
p->p_top = p->stack_data[ tos ].prev;
|
p->p_top = p->stack_data[tos].prev;
|
||||||
p->stack_data[ tos ].type = ct_none;
|
p->stack_data[tos].type = ct_none;
|
||||||
p->stack_data[ tos ].ident = NULL;
|
p->stack_data[tos].ident = NULL;
|
||||||
p->stack_top = tos - 1;
|
p->stack_top = tos - 1;
|
||||||
KE_DUMP( 1000, dump_cons_stack( gtid, p ) );
|
KE_DUMP(1000, dump_cons_stack(gtid, p));
|
||||||
}
|
}
|
||||||
|
|
||||||
enum cons_type
|
enum cons_type __kmp_pop_workshare(int gtid, enum cons_type ct,
|
||||||
__kmp_pop_workshare( int gtid, enum cons_type ct, ident_t const * ident )
|
ident_t const *ident) {
|
||||||
{
|
|
||||||
int tos;
|
int tos;
|
||||||
struct cons_header *p = __kmp_threads[ gtid ]->th.th_cons;
|
struct cons_header *p = __kmp_threads[gtid]->th.th_cons;
|
||||||
|
|
||||||
tos = p->stack_top;
|
tos = p->stack_top;
|
||||||
KE_TRACE( 10, ("__kmp_pop_workshare (%d %d)\n", gtid, __kmp_get_gtid() ) );
|
KE_TRACE(10, ("__kmp_pop_workshare (%d %d)\n", gtid, __kmp_get_gtid()));
|
||||||
if ( tos == 0 || p->w_top == 0 ) {
|
if (tos == 0 || p->w_top == 0) {
|
||||||
__kmp_error_construct( kmp_i18n_msg_CnsDetectedEnd, ct, ident );
|
__kmp_error_construct(kmp_i18n_msg_CnsDetectedEnd, ct, ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( tos != p->w_top ||
|
if (tos != p->w_top ||
|
||||||
( p->stack_data[ tos ].type != ct &&
|
(p->stack_data[tos].type != ct &&
|
||||||
/* below are two exceptions to the rule that construct types must match */
|
// below are two exceptions to the rule that construct types must match
|
||||||
! ( p->stack_data[ tos ].type == ct_pdo_ordered && ct == ct_pdo ) &&
|
!(p->stack_data[tos].type == ct_pdo_ordered && ct == ct_pdo) &&
|
||||||
! ( p->stack_data[ tos ].type == ct_task_ordered && ct == ct_task )
|
!(p->stack_data[tos].type == ct_task_ordered && ct == ct_task))) {
|
||||||
)
|
|
||||||
) {
|
|
||||||
__kmp_check_null_func();
|
__kmp_check_null_func();
|
||||||
__kmp_error_construct2(
|
__kmp_error_construct2(kmp_i18n_msg_CnsExpectedEnd, ct, ident,
|
||||||
kmp_i18n_msg_CnsExpectedEnd,
|
&p->stack_data[tos]);
|
||||||
ct, ident,
|
|
||||||
& p->stack_data[ tos ]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
KE_TRACE( 100, ( POP_MSG( p ) ) );
|
KE_TRACE(100, (POP_MSG(p)));
|
||||||
p->w_top = p->stack_data[ tos ].prev;
|
p->w_top = p->stack_data[tos].prev;
|
||||||
p->stack_data[ tos ].type = ct_none;
|
p->stack_data[tos].type = ct_none;
|
||||||
p->stack_data[ tos ].ident = NULL;
|
p->stack_data[tos].ident = NULL;
|
||||||
p->stack_top = tos - 1;
|
p->stack_top = tos - 1;
|
||||||
KE_DUMP( 1000, dump_cons_stack( gtid, p ) );
|
KE_DUMP(1000, dump_cons_stack(gtid, p));
|
||||||
return p->stack_data[ p->w_top ].type;
|
return p->stack_data[p->w_top].type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void __kmp_pop_sync(int gtid, enum cons_type ct, ident_t const *ident) {
|
||||||
__kmp_pop_sync( int gtid, enum cons_type ct, ident_t const * ident )
|
|
||||||
{
|
|
||||||
int tos;
|
int tos;
|
||||||
struct cons_header *p = __kmp_threads[ gtid ]->th.th_cons;
|
struct cons_header *p = __kmp_threads[gtid]->th.th_cons;
|
||||||
tos = p->stack_top;
|
tos = p->stack_top;
|
||||||
KE_TRACE( 10, ("__kmp_pop_sync (%d %d)\n", gtid, __kmp_get_gtid() ) );
|
KE_TRACE(10, ("__kmp_pop_sync (%d %d)\n", gtid, __kmp_get_gtid()));
|
||||||
if ( tos == 0 || p->s_top == 0 ) {
|
if (tos == 0 || p->s_top == 0) {
|
||||||
__kmp_error_construct( kmp_i18n_msg_CnsDetectedEnd, ct, ident );
|
__kmp_error_construct(kmp_i18n_msg_CnsDetectedEnd, ct, ident);
|
||||||
};
|
};
|
||||||
if ( tos != p->s_top || p->stack_data[ tos ].type != ct ) {
|
if (tos != p->s_top || p->stack_data[tos].type != ct) {
|
||||||
__kmp_check_null_func();
|
__kmp_check_null_func();
|
||||||
__kmp_error_construct2(
|
__kmp_error_construct2(kmp_i18n_msg_CnsExpectedEnd, ct, ident,
|
||||||
kmp_i18n_msg_CnsExpectedEnd,
|
&p->stack_data[tos]);
|
||||||
ct, ident,
|
|
||||||
& p->stack_data[ tos ]
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
if ( gtid < 0 ) {
|
if (gtid < 0) {
|
||||||
__kmp_check_null_func();
|
__kmp_check_null_func();
|
||||||
};
|
};
|
||||||
KE_TRACE( 100, ( POP_MSG( p ) ) );
|
KE_TRACE(100, (POP_MSG(p)));
|
||||||
p->s_top = p->stack_data[ tos ].prev;
|
p->s_top = p->stack_data[tos].prev;
|
||||||
p->stack_data[ tos ].type = ct_none;
|
p->stack_data[tos].type = ct_none;
|
||||||
p->stack_data[ tos ].ident = NULL;
|
p->stack_data[tos].ident = NULL;
|
||||||
p->stack_top = tos - 1;
|
p->stack_top = tos - 1;
|
||||||
KE_DUMP( 1000, dump_cons_stack( gtid, p ) );
|
KE_DUMP(1000, dump_cons_stack(gtid, p));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
void
|
void __kmp_check_barrier(int gtid, enum cons_type ct, ident_t const *ident) {
|
||||||
__kmp_check_barrier( int gtid, enum cons_type ct, ident_t const * ident )
|
struct cons_header *p = __kmp_threads[gtid]->th.th_cons;
|
||||||
{
|
KE_TRACE(10, ("__kmp_check_barrier (loc: %p, gtid: %d %d)\n", ident, gtid,
|
||||||
struct cons_header *p = __kmp_threads[ gtid ]->th.th_cons;
|
__kmp_get_gtid()));
|
||||||
KE_TRACE( 10, ("__kmp_check_barrier (loc: %p, gtid: %d %d)\n", ident, gtid, __kmp_get_gtid() ) );
|
if (ident != 0) {
|
||||||
if ( ident != 0 ) {
|
|
||||||
__kmp_check_null_func();
|
__kmp_check_null_func();
|
||||||
}
|
}
|
||||||
if ( p->w_top > p->p_top ) {
|
if (p->w_top > p->p_top) {
|
||||||
/* we are already in a WORKSHARING construct for this PARALLEL region */
|
/* we are already in a WORKSHARING construct for this PARALLEL region */
|
||||||
__kmp_error_construct2(
|
__kmp_error_construct2(kmp_i18n_msg_CnsInvalidNesting, ct, ident,
|
||||||
kmp_i18n_msg_CnsInvalidNesting,
|
&p->stack_data[p->w_top]);
|
||||||
ct, ident,
|
|
||||||
& p->stack_data[ p->w_top ]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (p->s_top > p->p_top) {
|
if (p->s_top > p->p_top) {
|
||||||
/* we are already in a SYNC construct for this PARALLEL region */
|
/* we are already in a SYNC construct for this PARALLEL region */
|
||||||
__kmp_error_construct2(
|
__kmp_error_construct2(kmp_i18n_msg_CnsInvalidNesting, ct, ident,
|
||||||
kmp_i18n_msg_CnsInvalidNesting,
|
&p->stack_data[p->s_top]);
|
||||||
ct, ident,
|
|
||||||
& p->stack_data[ p->s_top ]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
|
|
|
||||||
|
|
@ -20,38 +20,44 @@
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void __kmp_error_construct( kmp_i18n_id_t id, enum cons_type ct, ident_t const * ident );
|
void __kmp_error_construct(kmp_i18n_id_t id, enum cons_type ct,
|
||||||
void __kmp_error_construct2( kmp_i18n_id_t id, enum cons_type ct, ident_t const * ident, struct cons_data const * cons );
|
ident_t const *ident);
|
||||||
|
void __kmp_error_construct2(kmp_i18n_id_t id, enum cons_type ct,
|
||||||
|
ident_t const *ident, struct cons_data const *cons);
|
||||||
|
|
||||||
struct cons_header * __kmp_allocate_cons_stack( int gtid );
|
struct cons_header *__kmp_allocate_cons_stack(int gtid);
|
||||||
void __kmp_free_cons_stack( void * ptr );
|
void __kmp_free_cons_stack(void *ptr);
|
||||||
|
|
||||||
void __kmp_push_parallel( int gtid, ident_t const * ident );
|
void __kmp_push_parallel(int gtid, ident_t const *ident);
|
||||||
void __kmp_push_workshare( int gtid, enum cons_type ct, ident_t const * ident );
|
void __kmp_push_workshare(int gtid, enum cons_type ct, ident_t const *ident);
|
||||||
#if KMP_USE_DYNAMIC_LOCK
|
#if KMP_USE_DYNAMIC_LOCK
|
||||||
void __kmp_push_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p name, kmp_uint32 );
|
void __kmp_push_sync(int gtid, enum cons_type ct, ident_t const *ident,
|
||||||
|
kmp_user_lock_p name, kmp_uint32);
|
||||||
#else
|
#else
|
||||||
void __kmp_push_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p name );
|
void __kmp_push_sync(int gtid, enum cons_type ct, ident_t const *ident,
|
||||||
|
kmp_user_lock_p name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void __kmp_check_workshare( int gtid, enum cons_type ct, ident_t const * ident );
|
void __kmp_check_workshare(int gtid, enum cons_type ct, ident_t const *ident);
|
||||||
#if KMP_USE_DYNAMIC_LOCK
|
#if KMP_USE_DYNAMIC_LOCK
|
||||||
void __kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p name, kmp_uint32 );
|
void __kmp_check_sync(int gtid, enum cons_type ct, ident_t const *ident,
|
||||||
|
kmp_user_lock_p name, kmp_uint32);
|
||||||
#else
|
#else
|
||||||
void __kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_lock_p name );
|
void __kmp_check_sync(int gtid, enum cons_type ct, ident_t const *ident,
|
||||||
|
kmp_user_lock_p name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void __kmp_pop_parallel( int gtid, ident_t const * ident );
|
void __kmp_pop_parallel(int gtid, ident_t const *ident);
|
||||||
enum cons_type __kmp_pop_workshare( int gtid, enum cons_type ct, ident_t const * ident );
|
enum cons_type __kmp_pop_workshare(int gtid, enum cons_type ct,
|
||||||
void __kmp_pop_sync( int gtid, enum cons_type ct, ident_t const * ident );
|
ident_t const *ident);
|
||||||
void __kmp_check_barrier( int gtid, enum cons_type ct, ident_t const * ident );
|
void __kmp_pop_sync(int gtid, enum cons_type ct, ident_t const *ident);
|
||||||
|
void __kmp_check_barrier(int gtid, enum cons_type ct, ident_t const *ident);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // KMP_ERROR_H
|
#endif // KMP_ERROR_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,20 +17,21 @@
|
||||||
#include "kmp_affinity.h"
|
#include "kmp_affinity.h"
|
||||||
|
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
# if defined KMP_WIN_CDECL || !defined KMP_DYNAMIC_LIB
|
#if defined KMP_WIN_CDECL || !defined KMP_DYNAMIC_LIB
|
||||||
# define KMP_FTN_ENTRIES KMP_FTN_UPPER
|
#define KMP_FTN_ENTRIES KMP_FTN_UPPER
|
||||||
# endif
|
#endif
|
||||||
#elif KMP_OS_UNIX
|
#elif KMP_OS_UNIX
|
||||||
# define KMP_FTN_ENTRIES KMP_FTN_PLAIN
|
#define KMP_FTN_ENTRIES KMP_FTN_PLAIN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Note: This string is not printed when KMP_VERSION=1.
|
// Note: This string is not printed when KMP_VERSION=1.
|
||||||
char const __kmp_version_ftncdecl[] = KMP_VERSION_PREFIX "Fortran __cdecl OMP support: "
|
char const __kmp_version_ftncdecl[] =
|
||||||
|
KMP_VERSION_PREFIX "Fortran __cdecl OMP support: "
|
||||||
#ifdef KMP_FTN_ENTRIES
|
#ifdef KMP_FTN_ENTRIES
|
||||||
"yes";
|
"yes";
|
||||||
# define FTN_STDCALL /* no stdcall */
|
#define FTN_STDCALL /* no stdcall */
|
||||||
# include "kmp_ftn_os.h"
|
#include "kmp_ftn_os.h"
|
||||||
# include "kmp_ftn_entry.h"
|
#include "kmp_ftn_entry.h"
|
||||||
#else
|
#else
|
||||||
"no";
|
"no";
|
||||||
#endif /* KMP_FTN_ENTRIES */
|
#endif /* KMP_FTN_ENTRIES */
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -17,18 +17,19 @@
|
||||||
#include "kmp_affinity.h"
|
#include "kmp_affinity.h"
|
||||||
|
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
# define KMP_FTN_ENTRIES KMP_FTN_PLAIN
|
#define KMP_FTN_ENTRIES KMP_FTN_PLAIN
|
||||||
#elif KMP_OS_UNIX
|
#elif KMP_OS_UNIX
|
||||||
# define KMP_FTN_ENTRIES KMP_FTN_APPEND
|
#define KMP_FTN_ENTRIES KMP_FTN_APPEND
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Note: This string is not printed when KMP_VERSION=1.
|
// Note: This string is not printed when KMP_VERSION=1.
|
||||||
char const __kmp_version_ftnextra[] = KMP_VERSION_PREFIX "Fortran \"extra\" OMP support: "
|
char const __kmp_version_ftnextra[] =
|
||||||
|
KMP_VERSION_PREFIX "Fortran \"extra\" OMP support: "
|
||||||
#ifdef KMP_FTN_ENTRIES
|
#ifdef KMP_FTN_ENTRIES
|
||||||
"yes";
|
"yes";
|
||||||
# define FTN_STDCALL /* nothing to do */
|
#define FTN_STDCALL /* nothing to do */
|
||||||
# include "kmp_ftn_os.h"
|
#include "kmp_ftn_os.h"
|
||||||
# include "kmp_ftn_entry.h"
|
#include "kmp_ftn_entry.h"
|
||||||
#else
|
#else
|
||||||
"no";
|
"no";
|
||||||
#endif /* KMP_FTN_ENTRIES */
|
#endif /* KMP_FTN_ENTRIES */
|
||||||
|
|
|
||||||
|
|
@ -16,123 +16,123 @@
|
||||||
#ifndef KMP_FTN_OS_H
|
#ifndef KMP_FTN_OS_H
|
||||||
#define KMP_FTN_OS_H
|
#define KMP_FTN_OS_H
|
||||||
|
|
||||||
// KMP_FNT_ENTRIES may be one of: KMP_FTN_PLAIN, KMP_FTN_UPPER, KMP_FTN_APPEND, KMP_FTN_UAPPEND.
|
// KMP_FNT_ENTRIES may be one of: KMP_FTN_PLAIN, KMP_FTN_UPPER, KMP_FTN_APPEND,
|
||||||
|
// KMP_FTN_UAPPEND.
|
||||||
|
|
||||||
/* -------------------------- External definitions ------------------------ */
|
/* -------------------------- External definitions ------------------------ */
|
||||||
|
|
||||||
#if KMP_FTN_ENTRIES == KMP_FTN_PLAIN
|
#if KMP_FTN_ENTRIES == KMP_FTN_PLAIN
|
||||||
|
|
||||||
#define FTN_SET_STACKSIZE kmp_set_stacksize
|
#define FTN_SET_STACKSIZE kmp_set_stacksize
|
||||||
#define FTN_SET_STACKSIZE_S kmp_set_stacksize_s
|
#define FTN_SET_STACKSIZE_S kmp_set_stacksize_s
|
||||||
#define FTN_GET_STACKSIZE kmp_get_stacksize
|
#define FTN_GET_STACKSIZE kmp_get_stacksize
|
||||||
#define FTN_GET_STACKSIZE_S kmp_get_stacksize_s
|
#define FTN_GET_STACKSIZE_S kmp_get_stacksize_s
|
||||||
#define FTN_SET_BLOCKTIME kmp_set_blocktime
|
#define FTN_SET_BLOCKTIME kmp_set_blocktime
|
||||||
#define FTN_GET_BLOCKTIME kmp_get_blocktime
|
#define FTN_GET_BLOCKTIME kmp_get_blocktime
|
||||||
#define FTN_SET_LIBRARY_SERIAL kmp_set_library_serial
|
#define FTN_SET_LIBRARY_SERIAL kmp_set_library_serial
|
||||||
#define FTN_SET_LIBRARY_TURNAROUND kmp_set_library_turnaround
|
#define FTN_SET_LIBRARY_TURNAROUND kmp_set_library_turnaround
|
||||||
#define FTN_SET_LIBRARY_THROUGHPUT kmp_set_library_throughput
|
#define FTN_SET_LIBRARY_THROUGHPUT kmp_set_library_throughput
|
||||||
#define FTN_SET_LIBRARY kmp_set_library
|
#define FTN_SET_LIBRARY kmp_set_library
|
||||||
#define FTN_GET_LIBRARY kmp_get_library
|
#define FTN_GET_LIBRARY kmp_get_library
|
||||||
#define FTN_SET_DEFAULTS kmp_set_defaults
|
#define FTN_SET_DEFAULTS kmp_set_defaults
|
||||||
#define FTN_SET_DISP_NUM_BUFFERS kmp_set_disp_num_buffers
|
#define FTN_SET_DISP_NUM_BUFFERS kmp_set_disp_num_buffers
|
||||||
#define FTN_SET_AFFINITY kmp_set_affinity
|
#define FTN_SET_AFFINITY kmp_set_affinity
|
||||||
#define FTN_GET_AFFINITY kmp_get_affinity
|
#define FTN_GET_AFFINITY kmp_get_affinity
|
||||||
#define FTN_GET_AFFINITY_MAX_PROC kmp_get_affinity_max_proc
|
#define FTN_GET_AFFINITY_MAX_PROC kmp_get_affinity_max_proc
|
||||||
#define FTN_CREATE_AFFINITY_MASK kmp_create_affinity_mask
|
#define FTN_CREATE_AFFINITY_MASK kmp_create_affinity_mask
|
||||||
#define FTN_DESTROY_AFFINITY_MASK kmp_destroy_affinity_mask
|
#define FTN_DESTROY_AFFINITY_MASK kmp_destroy_affinity_mask
|
||||||
#define FTN_SET_AFFINITY_MASK_PROC kmp_set_affinity_mask_proc
|
#define FTN_SET_AFFINITY_MASK_PROC kmp_set_affinity_mask_proc
|
||||||
#define FTN_UNSET_AFFINITY_MASK_PROC kmp_unset_affinity_mask_proc
|
#define FTN_UNSET_AFFINITY_MASK_PROC kmp_unset_affinity_mask_proc
|
||||||
#define FTN_GET_AFFINITY_MASK_PROC kmp_get_affinity_mask_proc
|
#define FTN_GET_AFFINITY_MASK_PROC kmp_get_affinity_mask_proc
|
||||||
|
|
||||||
#define FTN_MALLOC kmp_malloc
|
#define FTN_MALLOC kmp_malloc
|
||||||
#define FTN_ALIGNED_MALLOC kmp_aligned_malloc
|
#define FTN_ALIGNED_MALLOC kmp_aligned_malloc
|
||||||
#define FTN_CALLOC kmp_calloc
|
#define FTN_CALLOC kmp_calloc
|
||||||
#define FTN_REALLOC kmp_realloc
|
#define FTN_REALLOC kmp_realloc
|
||||||
#define FTN_FREE kmp_free
|
#define FTN_FREE kmp_free
|
||||||
|
|
||||||
#define FTN_GET_NUM_KNOWN_THREADS kmp_get_num_known_threads
|
#define FTN_GET_NUM_KNOWN_THREADS kmp_get_num_known_threads
|
||||||
|
|
||||||
#define FTN_SET_NUM_THREADS omp_set_num_threads
|
#define FTN_SET_NUM_THREADS omp_set_num_threads
|
||||||
#define FTN_GET_NUM_THREADS omp_get_num_threads
|
#define FTN_GET_NUM_THREADS omp_get_num_threads
|
||||||
#define FTN_GET_MAX_THREADS omp_get_max_threads
|
#define FTN_GET_MAX_THREADS omp_get_max_threads
|
||||||
#define FTN_GET_THREAD_NUM omp_get_thread_num
|
#define FTN_GET_THREAD_NUM omp_get_thread_num
|
||||||
#define FTN_GET_NUM_PROCS omp_get_num_procs
|
#define FTN_GET_NUM_PROCS omp_get_num_procs
|
||||||
#define FTN_SET_DYNAMIC omp_set_dynamic
|
#define FTN_SET_DYNAMIC omp_set_dynamic
|
||||||
#define FTN_GET_DYNAMIC omp_get_dynamic
|
#define FTN_GET_DYNAMIC omp_get_dynamic
|
||||||
#define FTN_SET_NESTED omp_set_nested
|
#define FTN_SET_NESTED omp_set_nested
|
||||||
#define FTN_GET_NESTED omp_get_nested
|
#define FTN_GET_NESTED omp_get_nested
|
||||||
#define FTN_IN_PARALLEL omp_in_parallel
|
#define FTN_IN_PARALLEL omp_in_parallel
|
||||||
#define FTN_GET_THREAD_LIMIT omp_get_thread_limit
|
#define FTN_GET_THREAD_LIMIT omp_get_thread_limit
|
||||||
#define FTN_SET_SCHEDULE omp_set_schedule
|
#define FTN_SET_SCHEDULE omp_set_schedule
|
||||||
#define FTN_GET_SCHEDULE omp_get_schedule
|
#define FTN_GET_SCHEDULE omp_get_schedule
|
||||||
#define FTN_SET_MAX_ACTIVE_LEVELS omp_set_max_active_levels
|
#define FTN_SET_MAX_ACTIVE_LEVELS omp_set_max_active_levels
|
||||||
#define FTN_GET_MAX_ACTIVE_LEVELS omp_get_max_active_levels
|
#define FTN_GET_MAX_ACTIVE_LEVELS omp_get_max_active_levels
|
||||||
#define FTN_GET_ACTIVE_LEVEL omp_get_active_level
|
#define FTN_GET_ACTIVE_LEVEL omp_get_active_level
|
||||||
#define FTN_GET_LEVEL omp_get_level
|
#define FTN_GET_LEVEL omp_get_level
|
||||||
#define FTN_GET_ANCESTOR_THREAD_NUM omp_get_ancestor_thread_num
|
#define FTN_GET_ANCESTOR_THREAD_NUM omp_get_ancestor_thread_num
|
||||||
#define FTN_GET_TEAM_SIZE omp_get_team_size
|
#define FTN_GET_TEAM_SIZE omp_get_team_size
|
||||||
#define FTN_IN_FINAL omp_in_final
|
#define FTN_IN_FINAL omp_in_final
|
||||||
// #define FTN_SET_PROC_BIND omp_set_proc_bind
|
// #define FTN_SET_PROC_BIND omp_set_proc_bind
|
||||||
#define FTN_GET_PROC_BIND omp_get_proc_bind
|
#define FTN_GET_PROC_BIND omp_get_proc_bind
|
||||||
// #define FTN_CURR_PROC_BIND omp_curr_proc_bind
|
// #define FTN_CURR_PROC_BIND omp_curr_proc_bind
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
#define FTN_GET_NUM_TEAMS omp_get_num_teams
|
#define FTN_GET_NUM_TEAMS omp_get_num_teams
|
||||||
#define FTN_GET_TEAM_NUM omp_get_team_num
|
#define FTN_GET_TEAM_NUM omp_get_team_num
|
||||||
#endif
|
#endif
|
||||||
#define FTN_INIT_LOCK omp_init_lock
|
#define FTN_INIT_LOCK omp_init_lock
|
||||||
#if KMP_USE_DYNAMIC_LOCK
|
#if KMP_USE_DYNAMIC_LOCK
|
||||||
#define FTN_INIT_LOCK_WITH_HINT omp_init_lock_with_hint
|
#define FTN_INIT_LOCK_WITH_HINT omp_init_lock_with_hint
|
||||||
#define FTN_INIT_NEST_LOCK_WITH_HINT omp_init_nest_lock_with_hint
|
#define FTN_INIT_NEST_LOCK_WITH_HINT omp_init_nest_lock_with_hint
|
||||||
#endif
|
#endif
|
||||||
#define FTN_DESTROY_LOCK omp_destroy_lock
|
#define FTN_DESTROY_LOCK omp_destroy_lock
|
||||||
#define FTN_SET_LOCK omp_set_lock
|
#define FTN_SET_LOCK omp_set_lock
|
||||||
#define FTN_UNSET_LOCK omp_unset_lock
|
#define FTN_UNSET_LOCK omp_unset_lock
|
||||||
#define FTN_TEST_LOCK omp_test_lock
|
#define FTN_TEST_LOCK omp_test_lock
|
||||||
#define FTN_INIT_NEST_LOCK omp_init_nest_lock
|
#define FTN_INIT_NEST_LOCK omp_init_nest_lock
|
||||||
#define FTN_DESTROY_NEST_LOCK omp_destroy_nest_lock
|
#define FTN_DESTROY_NEST_LOCK omp_destroy_nest_lock
|
||||||
#define FTN_SET_NEST_LOCK omp_set_nest_lock
|
#define FTN_SET_NEST_LOCK omp_set_nest_lock
|
||||||
#define FTN_UNSET_NEST_LOCK omp_unset_nest_lock
|
#define FTN_UNSET_NEST_LOCK omp_unset_nest_lock
|
||||||
#define FTN_TEST_NEST_LOCK omp_test_nest_lock
|
#define FTN_TEST_NEST_LOCK omp_test_nest_lock
|
||||||
|
|
||||||
#define FTN_SET_WARNINGS_ON kmp_set_warnings_on
|
#define FTN_SET_WARNINGS_ON kmp_set_warnings_on
|
||||||
#define FTN_SET_WARNINGS_OFF kmp_set_warnings_off
|
#define FTN_SET_WARNINGS_OFF kmp_set_warnings_off
|
||||||
|
|
||||||
#define FTN_GET_WTIME omp_get_wtime
|
#define FTN_GET_WTIME omp_get_wtime
|
||||||
#define FTN_GET_WTICK omp_get_wtick
|
#define FTN_GET_WTICK omp_get_wtick
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
|
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
|
||||||
#define FTN_GET_NUM_DEVICES omp_get_num_devices
|
#define FTN_GET_NUM_DEVICES omp_get_num_devices
|
||||||
#endif
|
#endif
|
||||||
#define FTN_GET_DEFAULT_DEVICE omp_get_default_device
|
#define FTN_GET_DEFAULT_DEVICE omp_get_default_device
|
||||||
#define FTN_SET_DEFAULT_DEVICE omp_set_default_device
|
#define FTN_SET_DEFAULT_DEVICE omp_set_default_device
|
||||||
#define FTN_IS_INITIAL_DEVICE omp_is_initial_device
|
#define FTN_IS_INITIAL_DEVICE omp_is_initial_device
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
#define FTN_GET_CANCELLATION omp_get_cancellation
|
#define FTN_GET_CANCELLATION omp_get_cancellation
|
||||||
#define FTN_GET_CANCELLATION_STATUS kmp_get_cancellation_status
|
#define FTN_GET_CANCELLATION_STATUS kmp_get_cancellation_status
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OMP_45_ENABLED
|
#if OMP_45_ENABLED
|
||||||
#define FTN_GET_MAX_TASK_PRIORITY omp_get_max_task_priority
|
#define FTN_GET_MAX_TASK_PRIORITY omp_get_max_task_priority
|
||||||
#define FTN_GET_NUM_PLACES omp_get_num_places
|
#define FTN_GET_NUM_PLACES omp_get_num_places
|
||||||
#define FTN_GET_PLACE_NUM_PROCS omp_get_place_num_procs
|
#define FTN_GET_PLACE_NUM_PROCS omp_get_place_num_procs
|
||||||
#define FTN_GET_PLACE_PROC_IDS omp_get_place_proc_ids
|
#define FTN_GET_PLACE_PROC_IDS omp_get_place_proc_ids
|
||||||
#define FTN_GET_PLACE_NUM omp_get_place_num
|
#define FTN_GET_PLACE_NUM omp_get_place_num
|
||||||
#define FTN_GET_PARTITION_NUM_PLACES omp_get_partition_num_places
|
#define FTN_GET_PARTITION_NUM_PLACES omp_get_partition_num_places
|
||||||
#define FTN_GET_PARTITION_PLACE_NUMS omp_get_partition_place_nums
|
#define FTN_GET_PARTITION_PLACE_NUMS omp_get_partition_place_nums
|
||||||
# ifdef KMP_STUB
|
#ifdef KMP_STUB
|
||||||
#define FTN_GET_INITIAL_DEVICE omp_get_initial_device
|
#define FTN_GET_INITIAL_DEVICE omp_get_initial_device
|
||||||
#define FTN_TARGET_ALLOC omp_target_alloc
|
#define FTN_TARGET_ALLOC omp_target_alloc
|
||||||
#define FTN_TARGET_FREE omp_target_free
|
#define FTN_TARGET_FREE omp_target_free
|
||||||
#define FTN_TARGET_IS_PRESENT omp_target_is_present
|
#define FTN_TARGET_IS_PRESENT omp_target_is_present
|
||||||
#define FTN_TARGET_MEMCPY omp_target_memcpy
|
#define FTN_TARGET_MEMCPY omp_target_memcpy
|
||||||
#define FTN_TARGET_MEMCPY_RECT omp_target_memcpy_rect
|
#define FTN_TARGET_MEMCPY_RECT omp_target_memcpy_rect
|
||||||
#define FTN_TARGET_ASSOCIATE_PTR omp_target_associate_ptr
|
#define FTN_TARGET_ASSOCIATE_PTR omp_target_associate_ptr
|
||||||
#define FTN_TARGET_DISASSOCIATE_PTR omp_target_disassociate_ptr
|
#define FTN_TARGET_DISASSOCIATE_PTR omp_target_disassociate_ptr
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* KMP_FTN_PLAIN */
|
#endif /* KMP_FTN_PLAIN */
|
||||||
|
|
@ -141,117 +141,117 @@
|
||||||
|
|
||||||
#if KMP_FTN_ENTRIES == KMP_FTN_APPEND
|
#if KMP_FTN_ENTRIES == KMP_FTN_APPEND
|
||||||
|
|
||||||
#define FTN_SET_STACKSIZE kmp_set_stacksize_
|
#define FTN_SET_STACKSIZE kmp_set_stacksize_
|
||||||
#define FTN_SET_STACKSIZE_S kmp_set_stacksize_s_
|
#define FTN_SET_STACKSIZE_S kmp_set_stacksize_s_
|
||||||
#define FTN_GET_STACKSIZE kmp_get_stacksize_
|
#define FTN_GET_STACKSIZE kmp_get_stacksize_
|
||||||
#define FTN_GET_STACKSIZE_S kmp_get_stacksize_s_
|
#define FTN_GET_STACKSIZE_S kmp_get_stacksize_s_
|
||||||
#define FTN_SET_BLOCKTIME kmp_set_blocktime_
|
#define FTN_SET_BLOCKTIME kmp_set_blocktime_
|
||||||
#define FTN_GET_BLOCKTIME kmp_get_blocktime_
|
#define FTN_GET_BLOCKTIME kmp_get_blocktime_
|
||||||
#define FTN_SET_LIBRARY_SERIAL kmp_set_library_serial_
|
#define FTN_SET_LIBRARY_SERIAL kmp_set_library_serial_
|
||||||
#define FTN_SET_LIBRARY_TURNAROUND kmp_set_library_turnaround_
|
#define FTN_SET_LIBRARY_TURNAROUND kmp_set_library_turnaround_
|
||||||
#define FTN_SET_LIBRARY_THROUGHPUT kmp_set_library_throughput_
|
#define FTN_SET_LIBRARY_THROUGHPUT kmp_set_library_throughput_
|
||||||
#define FTN_SET_LIBRARY kmp_set_library_
|
#define FTN_SET_LIBRARY kmp_set_library_
|
||||||
#define FTN_GET_LIBRARY kmp_get_library_
|
#define FTN_GET_LIBRARY kmp_get_library_
|
||||||
#define FTN_SET_DEFAULTS kmp_set_defaults_
|
#define FTN_SET_DEFAULTS kmp_set_defaults_
|
||||||
#define FTN_SET_DISP_NUM_BUFFERS kmp_set_disp_num_buffers_
|
#define FTN_SET_DISP_NUM_BUFFERS kmp_set_disp_num_buffers_
|
||||||
#define FTN_SET_AFFINITY kmp_set_affinity_
|
#define FTN_SET_AFFINITY kmp_set_affinity_
|
||||||
#define FTN_GET_AFFINITY kmp_get_affinity_
|
#define FTN_GET_AFFINITY kmp_get_affinity_
|
||||||
#define FTN_GET_AFFINITY_MAX_PROC kmp_get_affinity_max_proc_
|
#define FTN_GET_AFFINITY_MAX_PROC kmp_get_affinity_max_proc_
|
||||||
#define FTN_CREATE_AFFINITY_MASK kmp_create_affinity_mask_
|
#define FTN_CREATE_AFFINITY_MASK kmp_create_affinity_mask_
|
||||||
#define FTN_DESTROY_AFFINITY_MASK kmp_destroy_affinity_mask_
|
#define FTN_DESTROY_AFFINITY_MASK kmp_destroy_affinity_mask_
|
||||||
#define FTN_SET_AFFINITY_MASK_PROC kmp_set_affinity_mask_proc_
|
#define FTN_SET_AFFINITY_MASK_PROC kmp_set_affinity_mask_proc_
|
||||||
#define FTN_UNSET_AFFINITY_MASK_PROC kmp_unset_affinity_mask_proc_
|
#define FTN_UNSET_AFFINITY_MASK_PROC kmp_unset_affinity_mask_proc_
|
||||||
#define FTN_GET_AFFINITY_MASK_PROC kmp_get_affinity_mask_proc_
|
#define FTN_GET_AFFINITY_MASK_PROC kmp_get_affinity_mask_proc_
|
||||||
|
|
||||||
#define FTN_MALLOC kmp_malloc_
|
#define FTN_MALLOC kmp_malloc_
|
||||||
#define FTN_ALIGNED_MALLOC kmp_aligned_malloc_
|
#define FTN_ALIGNED_MALLOC kmp_aligned_malloc_
|
||||||
#define FTN_CALLOC kmp_calloc_
|
#define FTN_CALLOC kmp_calloc_
|
||||||
#define FTN_REALLOC kmp_realloc_
|
#define FTN_REALLOC kmp_realloc_
|
||||||
#define FTN_FREE kmp_free_
|
#define FTN_FREE kmp_free_
|
||||||
|
|
||||||
#define FTN_GET_NUM_KNOWN_THREADS kmp_get_num_known_threads_
|
#define FTN_GET_NUM_KNOWN_THREADS kmp_get_num_known_threads_
|
||||||
|
|
||||||
#define FTN_SET_NUM_THREADS omp_set_num_threads_
|
#define FTN_SET_NUM_THREADS omp_set_num_threads_
|
||||||
#define FTN_GET_NUM_THREADS omp_get_num_threads_
|
#define FTN_GET_NUM_THREADS omp_get_num_threads_
|
||||||
#define FTN_GET_MAX_THREADS omp_get_max_threads_
|
#define FTN_GET_MAX_THREADS omp_get_max_threads_
|
||||||
#define FTN_GET_THREAD_NUM omp_get_thread_num_
|
#define FTN_GET_THREAD_NUM omp_get_thread_num_
|
||||||
#define FTN_GET_NUM_PROCS omp_get_num_procs_
|
#define FTN_GET_NUM_PROCS omp_get_num_procs_
|
||||||
#define FTN_SET_DYNAMIC omp_set_dynamic_
|
#define FTN_SET_DYNAMIC omp_set_dynamic_
|
||||||
#define FTN_GET_DYNAMIC omp_get_dynamic_
|
#define FTN_GET_DYNAMIC omp_get_dynamic_
|
||||||
#define FTN_SET_NESTED omp_set_nested_
|
#define FTN_SET_NESTED omp_set_nested_
|
||||||
#define FTN_GET_NESTED omp_get_nested_
|
#define FTN_GET_NESTED omp_get_nested_
|
||||||
#define FTN_IN_PARALLEL omp_in_parallel_
|
#define FTN_IN_PARALLEL omp_in_parallel_
|
||||||
#define FTN_GET_THREAD_LIMIT omp_get_thread_limit_
|
#define FTN_GET_THREAD_LIMIT omp_get_thread_limit_
|
||||||
#define FTN_SET_SCHEDULE omp_set_schedule_
|
#define FTN_SET_SCHEDULE omp_set_schedule_
|
||||||
#define FTN_GET_SCHEDULE omp_get_schedule_
|
#define FTN_GET_SCHEDULE omp_get_schedule_
|
||||||
#define FTN_SET_MAX_ACTIVE_LEVELS omp_set_max_active_levels_
|
#define FTN_SET_MAX_ACTIVE_LEVELS omp_set_max_active_levels_
|
||||||
#define FTN_GET_MAX_ACTIVE_LEVELS omp_get_max_active_levels_
|
#define FTN_GET_MAX_ACTIVE_LEVELS omp_get_max_active_levels_
|
||||||
#define FTN_GET_ACTIVE_LEVEL omp_get_active_level_
|
#define FTN_GET_ACTIVE_LEVEL omp_get_active_level_
|
||||||
#define FTN_GET_LEVEL omp_get_level_
|
#define FTN_GET_LEVEL omp_get_level_
|
||||||
#define FTN_GET_ANCESTOR_THREAD_NUM omp_get_ancestor_thread_num_
|
#define FTN_GET_ANCESTOR_THREAD_NUM omp_get_ancestor_thread_num_
|
||||||
#define FTN_GET_TEAM_SIZE omp_get_team_size_
|
#define FTN_GET_TEAM_SIZE omp_get_team_size_
|
||||||
#define FTN_IN_FINAL omp_in_final_
|
#define FTN_IN_FINAL omp_in_final_
|
||||||
// #define FTN_SET_PROC_BIND omp_set_proc_bind_
|
// #define FTN_SET_PROC_BIND omp_set_proc_bind_
|
||||||
#define FTN_GET_PROC_BIND omp_get_proc_bind_
|
#define FTN_GET_PROC_BIND omp_get_proc_bind_
|
||||||
// #define FTN_CURR_PROC_BIND omp_curr_proc_bind_
|
// #define FTN_CURR_PROC_BIND omp_curr_proc_bind_
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
#define FTN_GET_NUM_TEAMS omp_get_num_teams_
|
#define FTN_GET_NUM_TEAMS omp_get_num_teams_
|
||||||
#define FTN_GET_TEAM_NUM omp_get_team_num_
|
#define FTN_GET_TEAM_NUM omp_get_team_num_
|
||||||
#endif
|
#endif
|
||||||
#define FTN_INIT_LOCK omp_init_lock_
|
#define FTN_INIT_LOCK omp_init_lock_
|
||||||
#if KMP_USE_DYNAMIC_LOCK
|
#if KMP_USE_DYNAMIC_LOCK
|
||||||
#define FTN_INIT_LOCK_WITH_HINT omp_init_lock_with_hint_
|
#define FTN_INIT_LOCK_WITH_HINT omp_init_lock_with_hint_
|
||||||
#define FTN_INIT_NEST_LOCK_WITH_HINT omp_init_nest_lock_with_hint_
|
#define FTN_INIT_NEST_LOCK_WITH_HINT omp_init_nest_lock_with_hint_
|
||||||
#endif
|
#endif
|
||||||
#define FTN_DESTROY_LOCK omp_destroy_lock_
|
#define FTN_DESTROY_LOCK omp_destroy_lock_
|
||||||
#define FTN_SET_LOCK omp_set_lock_
|
#define FTN_SET_LOCK omp_set_lock_
|
||||||
#define FTN_UNSET_LOCK omp_unset_lock_
|
#define FTN_UNSET_LOCK omp_unset_lock_
|
||||||
#define FTN_TEST_LOCK omp_test_lock_
|
#define FTN_TEST_LOCK omp_test_lock_
|
||||||
#define FTN_INIT_NEST_LOCK omp_init_nest_lock_
|
#define FTN_INIT_NEST_LOCK omp_init_nest_lock_
|
||||||
#define FTN_DESTROY_NEST_LOCK omp_destroy_nest_lock_
|
#define FTN_DESTROY_NEST_LOCK omp_destroy_nest_lock_
|
||||||
#define FTN_SET_NEST_LOCK omp_set_nest_lock_
|
#define FTN_SET_NEST_LOCK omp_set_nest_lock_
|
||||||
#define FTN_UNSET_NEST_LOCK omp_unset_nest_lock_
|
#define FTN_UNSET_NEST_LOCK omp_unset_nest_lock_
|
||||||
#define FTN_TEST_NEST_LOCK omp_test_nest_lock_
|
#define FTN_TEST_NEST_LOCK omp_test_nest_lock_
|
||||||
|
|
||||||
#define FTN_SET_WARNINGS_ON kmp_set_warnings_on_
|
#define FTN_SET_WARNINGS_ON kmp_set_warnings_on_
|
||||||
#define FTN_SET_WARNINGS_OFF kmp_set_warnings_off_
|
#define FTN_SET_WARNINGS_OFF kmp_set_warnings_off_
|
||||||
|
|
||||||
#define FTN_GET_WTIME omp_get_wtime_
|
#define FTN_GET_WTIME omp_get_wtime_
|
||||||
#define FTN_GET_WTICK omp_get_wtick_
|
#define FTN_GET_WTICK omp_get_wtick_
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
|
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
|
||||||
#define FTN_GET_NUM_DEVICES omp_get_num_devices_
|
#define FTN_GET_NUM_DEVICES omp_get_num_devices_
|
||||||
#endif
|
#endif
|
||||||
#define FTN_GET_DEFAULT_DEVICE omp_get_default_device_
|
#define FTN_GET_DEFAULT_DEVICE omp_get_default_device_
|
||||||
#define FTN_SET_DEFAULT_DEVICE omp_set_default_device_
|
#define FTN_SET_DEFAULT_DEVICE omp_set_default_device_
|
||||||
#define FTN_IS_INITIAL_DEVICE omp_is_initial_device_
|
#define FTN_IS_INITIAL_DEVICE omp_is_initial_device_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
#define FTN_GET_CANCELLATION omp_get_cancellation_
|
#define FTN_GET_CANCELLATION omp_get_cancellation_
|
||||||
#define FTN_GET_CANCELLATION_STATUS kmp_get_cancellation_status_
|
#define FTN_GET_CANCELLATION_STATUS kmp_get_cancellation_status_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OMP_45_ENABLED
|
#if OMP_45_ENABLED
|
||||||
#define FTN_GET_MAX_TASK_PRIORITY omp_get_max_task_priority_
|
#define FTN_GET_MAX_TASK_PRIORITY omp_get_max_task_priority_
|
||||||
#define FTN_GET_NUM_PLACES omp_get_num_places_
|
#define FTN_GET_NUM_PLACES omp_get_num_places_
|
||||||
#define FTN_GET_PLACE_NUM_PROCS omp_get_place_num_procs_
|
#define FTN_GET_PLACE_NUM_PROCS omp_get_place_num_procs_
|
||||||
#define FTN_GET_PLACE_PROC_IDS omp_get_place_proc_ids_
|
#define FTN_GET_PLACE_PROC_IDS omp_get_place_proc_ids_
|
||||||
#define FTN_GET_PLACE_NUM omp_get_place_num_
|
#define FTN_GET_PLACE_NUM omp_get_place_num_
|
||||||
#define FTN_GET_PARTITION_NUM_PLACES omp_get_partition_num_places_
|
#define FTN_GET_PARTITION_NUM_PLACES omp_get_partition_num_places_
|
||||||
#define FTN_GET_PARTITION_PLACE_NUMS omp_get_partition_place_nums_
|
#define FTN_GET_PARTITION_PLACE_NUMS omp_get_partition_place_nums_
|
||||||
# ifdef KMP_STUB
|
#ifdef KMP_STUB
|
||||||
#define FTN_GET_INITIAL_DEVICE omp_get_initial_device_
|
#define FTN_GET_INITIAL_DEVICE omp_get_initial_device_
|
||||||
#define FTN_TARGET_ALLOC omp_target_alloc_
|
#define FTN_TARGET_ALLOC omp_target_alloc_
|
||||||
#define FTN_TARGET_FREE omp_target_free_
|
#define FTN_TARGET_FREE omp_target_free_
|
||||||
#define FTN_TARGET_IS_PRESENT omp_target_is_present_
|
#define FTN_TARGET_IS_PRESENT omp_target_is_present_
|
||||||
#define FTN_TARGET_MEMCPY omp_target_memcpy_
|
#define FTN_TARGET_MEMCPY omp_target_memcpy_
|
||||||
#define FTN_TARGET_MEMCPY_RECT omp_target_memcpy_rect_
|
#define FTN_TARGET_MEMCPY_RECT omp_target_memcpy_rect_
|
||||||
#define FTN_TARGET_ASSOCIATE_PTR omp_target_associate_ptr_
|
#define FTN_TARGET_ASSOCIATE_PTR omp_target_associate_ptr_
|
||||||
#define FTN_TARGET_DISASSOCIATE_PTR omp_target_disassociate_ptr_
|
#define FTN_TARGET_DISASSOCIATE_PTR omp_target_disassociate_ptr_
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* KMP_FTN_APPEND */
|
#endif /* KMP_FTN_APPEND */
|
||||||
|
|
@ -260,117 +260,117 @@
|
||||||
|
|
||||||
#if KMP_FTN_ENTRIES == KMP_FTN_UPPER
|
#if KMP_FTN_ENTRIES == KMP_FTN_UPPER
|
||||||
|
|
||||||
#define FTN_SET_STACKSIZE KMP_SET_STACKSIZE
|
#define FTN_SET_STACKSIZE KMP_SET_STACKSIZE
|
||||||
#define FTN_SET_STACKSIZE_S KMP_SET_STACKSIZE_S
|
#define FTN_SET_STACKSIZE_S KMP_SET_STACKSIZE_S
|
||||||
#define FTN_GET_STACKSIZE KMP_GET_STACKSIZE
|
#define FTN_GET_STACKSIZE KMP_GET_STACKSIZE
|
||||||
#define FTN_GET_STACKSIZE_S KMP_GET_STACKSIZE_S
|
#define FTN_GET_STACKSIZE_S KMP_GET_STACKSIZE_S
|
||||||
#define FTN_SET_BLOCKTIME KMP_SET_BLOCKTIME
|
#define FTN_SET_BLOCKTIME KMP_SET_BLOCKTIME
|
||||||
#define FTN_GET_BLOCKTIME KMP_GET_BLOCKTIME
|
#define FTN_GET_BLOCKTIME KMP_GET_BLOCKTIME
|
||||||
#define FTN_SET_LIBRARY_SERIAL KMP_SET_LIBRARY_SERIAL
|
#define FTN_SET_LIBRARY_SERIAL KMP_SET_LIBRARY_SERIAL
|
||||||
#define FTN_SET_LIBRARY_TURNAROUND KMP_SET_LIBRARY_TURNAROUND
|
#define FTN_SET_LIBRARY_TURNAROUND KMP_SET_LIBRARY_TURNAROUND
|
||||||
#define FTN_SET_LIBRARY_THROUGHPUT KMP_SET_LIBRARY_THROUGHPUT
|
#define FTN_SET_LIBRARY_THROUGHPUT KMP_SET_LIBRARY_THROUGHPUT
|
||||||
#define FTN_SET_LIBRARY KMP_SET_LIBRARY
|
#define FTN_SET_LIBRARY KMP_SET_LIBRARY
|
||||||
#define FTN_GET_LIBRARY KMP_GET_LIBRARY
|
#define FTN_GET_LIBRARY KMP_GET_LIBRARY
|
||||||
#define FTN_SET_DEFAULTS KMP_SET_DEFAULTS
|
#define FTN_SET_DEFAULTS KMP_SET_DEFAULTS
|
||||||
#define FTN_SET_DISP_NUM_BUFFERS KMP_SET_DISP_NUM_BUFFERS
|
#define FTN_SET_DISP_NUM_BUFFERS KMP_SET_DISP_NUM_BUFFERS
|
||||||
#define FTN_SET_AFFINITY KMP_SET_AFFINITY
|
#define FTN_SET_AFFINITY KMP_SET_AFFINITY
|
||||||
#define FTN_GET_AFFINITY KMP_GET_AFFINITY
|
#define FTN_GET_AFFINITY KMP_GET_AFFINITY
|
||||||
#define FTN_GET_AFFINITY_MAX_PROC KMP_GET_AFFINITY_MAX_PROC
|
#define FTN_GET_AFFINITY_MAX_PROC KMP_GET_AFFINITY_MAX_PROC
|
||||||
#define FTN_CREATE_AFFINITY_MASK KMP_CREATE_AFFINITY_MASK
|
#define FTN_CREATE_AFFINITY_MASK KMP_CREATE_AFFINITY_MASK
|
||||||
#define FTN_DESTROY_AFFINITY_MASK KMP_DESTROY_AFFINITY_MASK
|
#define FTN_DESTROY_AFFINITY_MASK KMP_DESTROY_AFFINITY_MASK
|
||||||
#define FTN_SET_AFFINITY_MASK_PROC KMP_SET_AFFINITY_MASK_PROC
|
#define FTN_SET_AFFINITY_MASK_PROC KMP_SET_AFFINITY_MASK_PROC
|
||||||
#define FTN_UNSET_AFFINITY_MASK_PROC KMP_UNSET_AFFINITY_MASK_PROC
|
#define FTN_UNSET_AFFINITY_MASK_PROC KMP_UNSET_AFFINITY_MASK_PROC
|
||||||
#define FTN_GET_AFFINITY_MASK_PROC KMP_GET_AFFINITY_MASK_PROC
|
#define FTN_GET_AFFINITY_MASK_PROC KMP_GET_AFFINITY_MASK_PROC
|
||||||
|
|
||||||
#define FTN_MALLOC KMP_MALLOC
|
#define FTN_MALLOC KMP_MALLOC
|
||||||
#define FTN_ALIGNED_MALLOC KMP_ALIGNED_MALLOC
|
#define FTN_ALIGNED_MALLOC KMP_ALIGNED_MALLOC
|
||||||
#define FTN_CALLOC KMP_CALLOC
|
#define FTN_CALLOC KMP_CALLOC
|
||||||
#define FTN_REALLOC KMP_REALLOC
|
#define FTN_REALLOC KMP_REALLOC
|
||||||
#define FTN_FREE KMP_FREE
|
#define FTN_FREE KMP_FREE
|
||||||
|
|
||||||
#define FTN_GET_NUM_KNOWN_THREADS KMP_GET_NUM_KNOWN_THREADS
|
#define FTN_GET_NUM_KNOWN_THREADS KMP_GET_NUM_KNOWN_THREADS
|
||||||
|
|
||||||
#define FTN_SET_NUM_THREADS OMP_SET_NUM_THREADS
|
#define FTN_SET_NUM_THREADS OMP_SET_NUM_THREADS
|
||||||
#define FTN_GET_NUM_THREADS OMP_GET_NUM_THREADS
|
#define FTN_GET_NUM_THREADS OMP_GET_NUM_THREADS
|
||||||
#define FTN_GET_MAX_THREADS OMP_GET_MAX_THREADS
|
#define FTN_GET_MAX_THREADS OMP_GET_MAX_THREADS
|
||||||
#define FTN_GET_THREAD_NUM OMP_GET_THREAD_NUM
|
#define FTN_GET_THREAD_NUM OMP_GET_THREAD_NUM
|
||||||
#define FTN_GET_NUM_PROCS OMP_GET_NUM_PROCS
|
#define FTN_GET_NUM_PROCS OMP_GET_NUM_PROCS
|
||||||
#define FTN_SET_DYNAMIC OMP_SET_DYNAMIC
|
#define FTN_SET_DYNAMIC OMP_SET_DYNAMIC
|
||||||
#define FTN_GET_DYNAMIC OMP_GET_DYNAMIC
|
#define FTN_GET_DYNAMIC OMP_GET_DYNAMIC
|
||||||
#define FTN_SET_NESTED OMP_SET_NESTED
|
#define FTN_SET_NESTED OMP_SET_NESTED
|
||||||
#define FTN_GET_NESTED OMP_GET_NESTED
|
#define FTN_GET_NESTED OMP_GET_NESTED
|
||||||
#define FTN_IN_PARALLEL OMP_IN_PARALLEL
|
#define FTN_IN_PARALLEL OMP_IN_PARALLEL
|
||||||
#define FTN_GET_THREAD_LIMIT OMP_GET_THREAD_LIMIT
|
#define FTN_GET_THREAD_LIMIT OMP_GET_THREAD_LIMIT
|
||||||
#define FTN_SET_SCHEDULE OMP_SET_SCHEDULE
|
#define FTN_SET_SCHEDULE OMP_SET_SCHEDULE
|
||||||
#define FTN_GET_SCHEDULE OMP_GET_SCHEDULE
|
#define FTN_GET_SCHEDULE OMP_GET_SCHEDULE
|
||||||
#define FTN_SET_MAX_ACTIVE_LEVELS OMP_SET_MAX_ACTIVE_LEVELS
|
#define FTN_SET_MAX_ACTIVE_LEVELS OMP_SET_MAX_ACTIVE_LEVELS
|
||||||
#define FTN_GET_MAX_ACTIVE_LEVELS OMP_GET_MAX_ACTIVE_LEVELS
|
#define FTN_GET_MAX_ACTIVE_LEVELS OMP_GET_MAX_ACTIVE_LEVELS
|
||||||
#define FTN_GET_ACTIVE_LEVEL OMP_GET_ACTIVE_LEVEL
|
#define FTN_GET_ACTIVE_LEVEL OMP_GET_ACTIVE_LEVEL
|
||||||
#define FTN_GET_LEVEL OMP_GET_LEVEL
|
#define FTN_GET_LEVEL OMP_GET_LEVEL
|
||||||
#define FTN_GET_ANCESTOR_THREAD_NUM OMP_GET_ANCESTOR_THREAD_NUM
|
#define FTN_GET_ANCESTOR_THREAD_NUM OMP_GET_ANCESTOR_THREAD_NUM
|
||||||
#define FTN_GET_TEAM_SIZE OMP_GET_TEAM_SIZE
|
#define FTN_GET_TEAM_SIZE OMP_GET_TEAM_SIZE
|
||||||
#define FTN_IN_FINAL OMP_IN_FINAL
|
#define FTN_IN_FINAL OMP_IN_FINAL
|
||||||
// #define FTN_SET_PROC_BIND OMP_SET_PROC_BIND
|
// #define FTN_SET_PROC_BIND OMP_SET_PROC_BIND
|
||||||
#define FTN_GET_PROC_BIND OMP_GET_PROC_BIND
|
#define FTN_GET_PROC_BIND OMP_GET_PROC_BIND
|
||||||
// #define FTN_CURR_PROC_BIND OMP_CURR_PROC_BIND
|
// #define FTN_CURR_PROC_BIND OMP_CURR_PROC_BIND
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
#define FTN_GET_NUM_TEAMS OMP_GET_NUM_TEAMS
|
#define FTN_GET_NUM_TEAMS OMP_GET_NUM_TEAMS
|
||||||
#define FTN_GET_TEAM_NUM OMP_GET_TEAM_NUM
|
#define FTN_GET_TEAM_NUM OMP_GET_TEAM_NUM
|
||||||
#endif
|
#endif
|
||||||
#define FTN_INIT_LOCK OMP_INIT_LOCK
|
#define FTN_INIT_LOCK OMP_INIT_LOCK
|
||||||
#if KMP_USE_DYNAMIC_LOCK
|
#if KMP_USE_DYNAMIC_LOCK
|
||||||
#define FTN_INIT_LOCK_WITH_HINT OMP_INIT_LOCK_WITH_HINT
|
#define FTN_INIT_LOCK_WITH_HINT OMP_INIT_LOCK_WITH_HINT
|
||||||
#define FTN_INIT_NEST_LOCK_WITH_HINT OMP_INIT_NEST_LOCK_WITH_HINT
|
#define FTN_INIT_NEST_LOCK_WITH_HINT OMP_INIT_NEST_LOCK_WITH_HINT
|
||||||
#endif
|
#endif
|
||||||
#define FTN_DESTROY_LOCK OMP_DESTROY_LOCK
|
#define FTN_DESTROY_LOCK OMP_DESTROY_LOCK
|
||||||
#define FTN_SET_LOCK OMP_SET_LOCK
|
#define FTN_SET_LOCK OMP_SET_LOCK
|
||||||
#define FTN_UNSET_LOCK OMP_UNSET_LOCK
|
#define FTN_UNSET_LOCK OMP_UNSET_LOCK
|
||||||
#define FTN_TEST_LOCK OMP_TEST_LOCK
|
#define FTN_TEST_LOCK OMP_TEST_LOCK
|
||||||
#define FTN_INIT_NEST_LOCK OMP_INIT_NEST_LOCK
|
#define FTN_INIT_NEST_LOCK OMP_INIT_NEST_LOCK
|
||||||
#define FTN_DESTROY_NEST_LOCK OMP_DESTROY_NEST_LOCK
|
#define FTN_DESTROY_NEST_LOCK OMP_DESTROY_NEST_LOCK
|
||||||
#define FTN_SET_NEST_LOCK OMP_SET_NEST_LOCK
|
#define FTN_SET_NEST_LOCK OMP_SET_NEST_LOCK
|
||||||
#define FTN_UNSET_NEST_LOCK OMP_UNSET_NEST_LOCK
|
#define FTN_UNSET_NEST_LOCK OMP_UNSET_NEST_LOCK
|
||||||
#define FTN_TEST_NEST_LOCK OMP_TEST_NEST_LOCK
|
#define FTN_TEST_NEST_LOCK OMP_TEST_NEST_LOCK
|
||||||
|
|
||||||
#define FTN_SET_WARNINGS_ON KMP_SET_WARNINGS_ON
|
#define FTN_SET_WARNINGS_ON KMP_SET_WARNINGS_ON
|
||||||
#define FTN_SET_WARNINGS_OFF KMP_SET_WARNINGS_OFF
|
#define FTN_SET_WARNINGS_OFF KMP_SET_WARNINGS_OFF
|
||||||
|
|
||||||
#define FTN_GET_WTIME OMP_GET_WTIME
|
#define FTN_GET_WTIME OMP_GET_WTIME
|
||||||
#define FTN_GET_WTICK OMP_GET_WTICK
|
#define FTN_GET_WTICK OMP_GET_WTICK
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
|
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
|
||||||
#define FTN_GET_NUM_DEVICES OMP_GET_NUM_DEVICES
|
#define FTN_GET_NUM_DEVICES OMP_GET_NUM_DEVICES
|
||||||
#endif
|
#endif
|
||||||
#define FTN_GET_DEFAULT_DEVICE OMP_GET_DEFAULT_DEVICE
|
#define FTN_GET_DEFAULT_DEVICE OMP_GET_DEFAULT_DEVICE
|
||||||
#define FTN_SET_DEFAULT_DEVICE OMP_SET_DEFAULT_DEVICE
|
#define FTN_SET_DEFAULT_DEVICE OMP_SET_DEFAULT_DEVICE
|
||||||
#define FTN_IS_INITIAL_DEVICE OMP_IS_INITIAL_DEVICE
|
#define FTN_IS_INITIAL_DEVICE OMP_IS_INITIAL_DEVICE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
#define FTN_GET_CANCELLATION OMP_GET_CANCELLATION
|
#define FTN_GET_CANCELLATION OMP_GET_CANCELLATION
|
||||||
#define FTN_GET_CANCELLATION_STATUS KMP_GET_CANCELLATION_STATUS
|
#define FTN_GET_CANCELLATION_STATUS KMP_GET_CANCELLATION_STATUS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OMP_45_ENABLED
|
#if OMP_45_ENABLED
|
||||||
#define FTN_GET_MAX_TASK_PRIORITY OMP_GET_MAX_TASK_PRIORITY
|
#define FTN_GET_MAX_TASK_PRIORITY OMP_GET_MAX_TASK_PRIORITY
|
||||||
#define FTN_GET_NUM_PLACES OMP_GET_NUM_PLACES
|
#define FTN_GET_NUM_PLACES OMP_GET_NUM_PLACES
|
||||||
#define FTN_GET_PLACE_NUM_PROCS OMP_GET_PLACE_NUM_PROCS
|
#define FTN_GET_PLACE_NUM_PROCS OMP_GET_PLACE_NUM_PROCS
|
||||||
#define FTN_GET_PLACE_PROC_IDS OMP_GET_PLACE_PROC_IDS
|
#define FTN_GET_PLACE_PROC_IDS OMP_GET_PLACE_PROC_IDS
|
||||||
#define FTN_GET_PLACE_NUM OMP_GET_PLACE_NUM
|
#define FTN_GET_PLACE_NUM OMP_GET_PLACE_NUM
|
||||||
#define FTN_GET_PARTITION_NUM_PLACES OMP_GET_PARTITION_NUM_PLACES
|
#define FTN_GET_PARTITION_NUM_PLACES OMP_GET_PARTITION_NUM_PLACES
|
||||||
#define FTN_GET_PARTITION_PLACE_NUMS OMP_GET_PARTITION_PLACE_NUMS
|
#define FTN_GET_PARTITION_PLACE_NUMS OMP_GET_PARTITION_PLACE_NUMS
|
||||||
# ifdef KMP_STUB
|
#ifdef KMP_STUB
|
||||||
#define FTN_GET_INITIAL_DEVICE OMP_GET_INITIAL_DEVICE
|
#define FTN_GET_INITIAL_DEVICE OMP_GET_INITIAL_DEVICE
|
||||||
#define FTN_TARGET_ALLOC OMP_TARGET_ALLOC
|
#define FTN_TARGET_ALLOC OMP_TARGET_ALLOC
|
||||||
#define FTN_TARGET_FREE OMP_TARGET_FREE
|
#define FTN_TARGET_FREE OMP_TARGET_FREE
|
||||||
#define FTN_TARGET_IS_PRESENT OMP_TARGET_IS_PRESENT
|
#define FTN_TARGET_IS_PRESENT OMP_TARGET_IS_PRESENT
|
||||||
#define FTN_TARGET_MEMCPY OMP_TARGET_MEMCPY
|
#define FTN_TARGET_MEMCPY OMP_TARGET_MEMCPY
|
||||||
#define FTN_TARGET_MEMCPY_RECT OMP_TARGET_MEMCPY_RECT
|
#define FTN_TARGET_MEMCPY_RECT OMP_TARGET_MEMCPY_RECT
|
||||||
#define FTN_TARGET_ASSOCIATE_PTR OMP_TARGET_ASSOCIATE_PTR
|
#define FTN_TARGET_ASSOCIATE_PTR OMP_TARGET_ASSOCIATE_PTR
|
||||||
#define FTN_TARGET_DISASSOCIATE_PTR OMP_TARGET_DISASSOCIATE_PTR
|
#define FTN_TARGET_DISASSOCIATE_PTR OMP_TARGET_DISASSOCIATE_PTR
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* KMP_FTN_UPPER */
|
#endif /* KMP_FTN_UPPER */
|
||||||
|
|
@ -379,122 +379,121 @@
|
||||||
|
|
||||||
#if KMP_FTN_ENTRIES == KMP_FTN_UAPPEND
|
#if KMP_FTN_ENTRIES == KMP_FTN_UAPPEND
|
||||||
|
|
||||||
#define FTN_SET_STACKSIZE KMP_SET_STACKSIZE_
|
#define FTN_SET_STACKSIZE KMP_SET_STACKSIZE_
|
||||||
#define FTN_SET_STACKSIZE_S KMP_SET_STACKSIZE_S_
|
#define FTN_SET_STACKSIZE_S KMP_SET_STACKSIZE_S_
|
||||||
#define FTN_GET_STACKSIZE KMP_GET_STACKSIZE_
|
#define FTN_GET_STACKSIZE KMP_GET_STACKSIZE_
|
||||||
#define FTN_GET_STACKSIZE_S KMP_GET_STACKSIZE_S_
|
#define FTN_GET_STACKSIZE_S KMP_GET_STACKSIZE_S_
|
||||||
#define FTN_SET_BLOCKTIME KMP_SET_BLOCKTIME_
|
#define FTN_SET_BLOCKTIME KMP_SET_BLOCKTIME_
|
||||||
#define FTN_GET_BLOCKTIME KMP_GET_BLOCKTIME_
|
#define FTN_GET_BLOCKTIME KMP_GET_BLOCKTIME_
|
||||||
#define FTN_SET_LIBRARY_SERIAL KMP_SET_LIBRARY_SERIAL_
|
#define FTN_SET_LIBRARY_SERIAL KMP_SET_LIBRARY_SERIAL_
|
||||||
#define FTN_SET_LIBRARY_TURNAROUND KMP_SET_LIBRARY_TURNAROUND_
|
#define FTN_SET_LIBRARY_TURNAROUND KMP_SET_LIBRARY_TURNAROUND_
|
||||||
#define FTN_SET_LIBRARY_THROUGHPUT KMP_SET_LIBRARY_THROUGHPUT_
|
#define FTN_SET_LIBRARY_THROUGHPUT KMP_SET_LIBRARY_THROUGHPUT_
|
||||||
#define FTN_SET_LIBRARY KMP_SET_LIBRARY_
|
#define FTN_SET_LIBRARY KMP_SET_LIBRARY_
|
||||||
#define FTN_GET_LIBRARY KMP_GET_LIBRARY_
|
#define FTN_GET_LIBRARY KMP_GET_LIBRARY_
|
||||||
#define FTN_SET_DEFAULTS KMP_SET_DEFAULTS_
|
#define FTN_SET_DEFAULTS KMP_SET_DEFAULTS_
|
||||||
#define FTN_SET_DISP_NUM_BUFFERS KMP_SET_DISP_NUM_BUFFERS_
|
#define FTN_SET_DISP_NUM_BUFFERS KMP_SET_DISP_NUM_BUFFERS_
|
||||||
#define FTN_SET_AFFINITY KMP_SET_AFFINITY_
|
#define FTN_SET_AFFINITY KMP_SET_AFFINITY_
|
||||||
#define FTN_GET_AFFINITY KMP_GET_AFFINITY_
|
#define FTN_GET_AFFINITY KMP_GET_AFFINITY_
|
||||||
#define FTN_GET_AFFINITY_MAX_PROC KMP_GET_AFFINITY_MAX_PROC_
|
#define FTN_GET_AFFINITY_MAX_PROC KMP_GET_AFFINITY_MAX_PROC_
|
||||||
#define FTN_CREATE_AFFINITY_MASK KMP_CREATE_AFFINITY_MASK_
|
#define FTN_CREATE_AFFINITY_MASK KMP_CREATE_AFFINITY_MASK_
|
||||||
#define FTN_DESTROY_AFFINITY_MASK KMP_DESTROY_AFFINITY_MASK_
|
#define FTN_DESTROY_AFFINITY_MASK KMP_DESTROY_AFFINITY_MASK_
|
||||||
#define FTN_SET_AFFINITY_MASK_PROC KMP_SET_AFFINITY_MASK_PROC_
|
#define FTN_SET_AFFINITY_MASK_PROC KMP_SET_AFFINITY_MASK_PROC_
|
||||||
#define FTN_UNSET_AFFINITY_MASK_PROC KMP_UNSET_AFFINITY_MASK_PROC_
|
#define FTN_UNSET_AFFINITY_MASK_PROC KMP_UNSET_AFFINITY_MASK_PROC_
|
||||||
#define FTN_GET_AFFINITY_MASK_PROC KMP_GET_AFFINITY_MASK_PROC_
|
#define FTN_GET_AFFINITY_MASK_PROC KMP_GET_AFFINITY_MASK_PROC_
|
||||||
|
|
||||||
#define FTN_MALLOC KMP_MALLOC_
|
#define FTN_MALLOC KMP_MALLOC_
|
||||||
#define FTN_ALIGNED_MALLOC KMP_ALIGNED_MALLOC_
|
#define FTN_ALIGNED_MALLOC KMP_ALIGNED_MALLOC_
|
||||||
#define FTN_CALLOC KMP_CALLOC_
|
#define FTN_CALLOC KMP_CALLOC_
|
||||||
#define FTN_REALLOC KMP_REALLOC_
|
#define FTN_REALLOC KMP_REALLOC_
|
||||||
#define FTN_FREE KMP_FREE_
|
#define FTN_FREE KMP_FREE_
|
||||||
|
|
||||||
#define FTN_GET_NUM_KNOWN_THREADS KMP_GET_NUM_KNOWN_THREADS_
|
#define FTN_GET_NUM_KNOWN_THREADS KMP_GET_NUM_KNOWN_THREADS_
|
||||||
|
|
||||||
#define FTN_SET_NUM_THREADS OMP_SET_NUM_THREADS_
|
#define FTN_SET_NUM_THREADS OMP_SET_NUM_THREADS_
|
||||||
#define FTN_GET_NUM_THREADS OMP_GET_NUM_THREADS_
|
#define FTN_GET_NUM_THREADS OMP_GET_NUM_THREADS_
|
||||||
#define FTN_GET_MAX_THREADS OMP_GET_MAX_THREADS_
|
#define FTN_GET_MAX_THREADS OMP_GET_MAX_THREADS_
|
||||||
#define FTN_GET_THREAD_NUM OMP_GET_THREAD_NUM_
|
#define FTN_GET_THREAD_NUM OMP_GET_THREAD_NUM_
|
||||||
#define FTN_GET_NUM_PROCS OMP_GET_NUM_PROCS_
|
#define FTN_GET_NUM_PROCS OMP_GET_NUM_PROCS_
|
||||||
#define FTN_SET_DYNAMIC OMP_SET_DYNAMIC_
|
#define FTN_SET_DYNAMIC OMP_SET_DYNAMIC_
|
||||||
#define FTN_GET_DYNAMIC OMP_GET_DYNAMIC_
|
#define FTN_GET_DYNAMIC OMP_GET_DYNAMIC_
|
||||||
#define FTN_SET_NESTED OMP_SET_NESTED_
|
#define FTN_SET_NESTED OMP_SET_NESTED_
|
||||||
#define FTN_GET_NESTED OMP_GET_NESTED_
|
#define FTN_GET_NESTED OMP_GET_NESTED_
|
||||||
#define FTN_IN_PARALLEL OMP_IN_PARALLEL_
|
#define FTN_IN_PARALLEL OMP_IN_PARALLEL_
|
||||||
#define FTN_GET_THREAD_LIMIT OMP_GET_THREAD_LIMIT_
|
#define FTN_GET_THREAD_LIMIT OMP_GET_THREAD_LIMIT_
|
||||||
#define FTN_SET_SCHEDULE OMP_SET_SCHEDULE_
|
#define FTN_SET_SCHEDULE OMP_SET_SCHEDULE_
|
||||||
#define FTN_GET_SCHEDULE OMP_GET_SCHEDULE_
|
#define FTN_GET_SCHEDULE OMP_GET_SCHEDULE_
|
||||||
#define FTN_SET_MAX_ACTIVE_LEVELS OMP_SET_MAX_ACTIVE_LEVELS_
|
#define FTN_SET_MAX_ACTIVE_LEVELS OMP_SET_MAX_ACTIVE_LEVELS_
|
||||||
#define FTN_GET_MAX_ACTIVE_LEVELS OMP_GET_MAX_ACTIVE_LEVELS_
|
#define FTN_GET_MAX_ACTIVE_LEVELS OMP_GET_MAX_ACTIVE_LEVELS_
|
||||||
#define FTN_GET_ACTIVE_LEVEL OMP_GET_ACTIVE_LEVEL_
|
#define FTN_GET_ACTIVE_LEVEL OMP_GET_ACTIVE_LEVEL_
|
||||||
#define FTN_GET_LEVEL OMP_GET_LEVEL_
|
#define FTN_GET_LEVEL OMP_GET_LEVEL_
|
||||||
#define FTN_GET_ANCESTOR_THREAD_NUM OMP_GET_ANCESTOR_THREAD_NUM_
|
#define FTN_GET_ANCESTOR_THREAD_NUM OMP_GET_ANCESTOR_THREAD_NUM_
|
||||||
#define FTN_GET_TEAM_SIZE OMP_GET_TEAM_SIZE_
|
#define FTN_GET_TEAM_SIZE OMP_GET_TEAM_SIZE_
|
||||||
#define FTN_IN_FINAL OMP_IN_FINAL_
|
#define FTN_IN_FINAL OMP_IN_FINAL_
|
||||||
// #define FTN_SET_PROC_BIND OMP_SET_PROC_BIND_
|
// #define FTN_SET_PROC_BIND OMP_SET_PROC_BIND_
|
||||||
#define FTN_GET_PROC_BIND OMP_GET_PROC_BIND_
|
#define FTN_GET_PROC_BIND OMP_GET_PROC_BIND_
|
||||||
// #define FTN_CURR_PROC_BIND OMP_CURR_PROC_BIND_
|
// #define FTN_CURR_PROC_BIND OMP_CURR_PROC_BIND_
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
#define FTN_GET_NUM_TEAMS OMP_GET_NUM_TEAMS_
|
#define FTN_GET_NUM_TEAMS OMP_GET_NUM_TEAMS_
|
||||||
#define FTN_GET_TEAM_NUM OMP_GET_TEAM_NUM_
|
#define FTN_GET_TEAM_NUM OMP_GET_TEAM_NUM_
|
||||||
#endif
|
#endif
|
||||||
#define FTN_INIT_LOCK OMP_INIT_LOCK_
|
#define FTN_INIT_LOCK OMP_INIT_LOCK_
|
||||||
#if KMP_USE_DYNAMIC_LOCK
|
#if KMP_USE_DYNAMIC_LOCK
|
||||||
#define FTN_INIT_LOCK_WITH_HINT OMP_INIT_LOCK_WITH_HINT_
|
#define FTN_INIT_LOCK_WITH_HINT OMP_INIT_LOCK_WITH_HINT_
|
||||||
#define FTN_INIT_NEST_LOCK_WITH_HINT OMP_INIT_NEST_LOCK_WITH_HINT_
|
#define FTN_INIT_NEST_LOCK_WITH_HINT OMP_INIT_NEST_LOCK_WITH_HINT_
|
||||||
#endif
|
#endif
|
||||||
#define FTN_DESTROY_LOCK OMP_DESTROY_LOCK_
|
#define FTN_DESTROY_LOCK OMP_DESTROY_LOCK_
|
||||||
#define FTN_SET_LOCK OMP_SET_LOCK_
|
#define FTN_SET_LOCK OMP_SET_LOCK_
|
||||||
#define FTN_UNSET_LOCK OMP_UNSET_LOCK_
|
#define FTN_UNSET_LOCK OMP_UNSET_LOCK_
|
||||||
#define FTN_TEST_LOCK OMP_TEST_LOCK_
|
#define FTN_TEST_LOCK OMP_TEST_LOCK_
|
||||||
#define FTN_INIT_NEST_LOCK OMP_INIT_NEST_LOCK_
|
#define FTN_INIT_NEST_LOCK OMP_INIT_NEST_LOCK_
|
||||||
#define FTN_DESTROY_NEST_LOCK OMP_DESTROY_NEST_LOCK_
|
#define FTN_DESTROY_NEST_LOCK OMP_DESTROY_NEST_LOCK_
|
||||||
#define FTN_SET_NEST_LOCK OMP_SET_NEST_LOCK_
|
#define FTN_SET_NEST_LOCK OMP_SET_NEST_LOCK_
|
||||||
#define FTN_UNSET_NEST_LOCK OMP_UNSET_NEST_LOCK_
|
#define FTN_UNSET_NEST_LOCK OMP_UNSET_NEST_LOCK_
|
||||||
#define FTN_TEST_NEST_LOCK OMP_TEST_NEST_LOCK_
|
#define FTN_TEST_NEST_LOCK OMP_TEST_NEST_LOCK_
|
||||||
|
|
||||||
#define FTN_SET_WARNINGS_ON KMP_SET_WARNINGS_ON_
|
#define FTN_SET_WARNINGS_ON KMP_SET_WARNINGS_ON_
|
||||||
#define FTN_SET_WARNINGS_OFF KMP_SET_WARNINGS_OFF_
|
#define FTN_SET_WARNINGS_OFF KMP_SET_WARNINGS_OFF_
|
||||||
|
|
||||||
#define FTN_GET_WTIME OMP_GET_WTIME_
|
#define FTN_GET_WTIME OMP_GET_WTIME_
|
||||||
#define FTN_GET_WTICK OMP_GET_WTICK_
|
#define FTN_GET_WTICK OMP_GET_WTICK_
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
|
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
|
||||||
#define FTN_GET_NUM_DEVICES OMP_GET_NUM_DEVICES_
|
#define FTN_GET_NUM_DEVICES OMP_GET_NUM_DEVICES_
|
||||||
#endif
|
#endif
|
||||||
#define FTN_GET_DEFAULT_DEVICE OMP_GET_DEFAULT_DEVICE_
|
#define FTN_GET_DEFAULT_DEVICE OMP_GET_DEFAULT_DEVICE_
|
||||||
#define FTN_SET_DEFAULT_DEVICE OMP_SET_DEFAULT_DEVICE_
|
#define FTN_SET_DEFAULT_DEVICE OMP_SET_DEFAULT_DEVICE_
|
||||||
#define FTN_IS_INITIAL_DEVICE OMP_IS_INITIAL_DEVICE_
|
#define FTN_IS_INITIAL_DEVICE OMP_IS_INITIAL_DEVICE_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
#define FTN_GET_CANCELLATION OMP_GET_CANCELLATION_
|
#define FTN_GET_CANCELLATION OMP_GET_CANCELLATION_
|
||||||
#define FTN_GET_CANCELLATION_STATUS KMP_GET_CANCELLATION_STATUS_
|
#define FTN_GET_CANCELLATION_STATUS KMP_GET_CANCELLATION_STATUS_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OMP_45_ENABLED
|
#if OMP_45_ENABLED
|
||||||
#define FTN_GET_MAX_TASK_PRIORITY OMP_GET_MAX_TASK_PRIORITY_
|
#define FTN_GET_MAX_TASK_PRIORITY OMP_GET_MAX_TASK_PRIORITY_
|
||||||
#define FTN_GET_NUM_PLACES OMP_GET_NUM_PLACES_
|
#define FTN_GET_NUM_PLACES OMP_GET_NUM_PLACES_
|
||||||
#define FTN_GET_PLACE_NUM_PROCS OMP_GET_PLACE_NUM_PROCS_
|
#define FTN_GET_PLACE_NUM_PROCS OMP_GET_PLACE_NUM_PROCS_
|
||||||
#define FTN_GET_PLACE_PROC_IDS OMP_GET_PLACE_PROC_IDS_
|
#define FTN_GET_PLACE_PROC_IDS OMP_GET_PLACE_PROC_IDS_
|
||||||
#define FTN_GET_PLACE_NUM OMP_GET_PLACE_NUM_
|
#define FTN_GET_PLACE_NUM OMP_GET_PLACE_NUM_
|
||||||
#define FTN_GET_PARTITION_NUM_PLACES OMP_GET_PARTITION_NUM_PLACES_
|
#define FTN_GET_PARTITION_NUM_PLACES OMP_GET_PARTITION_NUM_PLACES_
|
||||||
#define FTN_GET_PARTITION_PLACE_NUMS OMP_GET_PARTITION_PLACE_NUMS_
|
#define FTN_GET_PARTITION_PLACE_NUMS OMP_GET_PARTITION_PLACE_NUMS_
|
||||||
# ifdef KMP_STUB
|
#ifdef KMP_STUB
|
||||||
#define FTN_GET_INITIAL_DEVICE OMP_GET_INITIAL_DEVICE_
|
#define FTN_GET_INITIAL_DEVICE OMP_GET_INITIAL_DEVICE_
|
||||||
#define FTN_TARGET_ALLOC OMP_TARGET_ALLOC_
|
#define FTN_TARGET_ALLOC OMP_TARGET_ALLOC_
|
||||||
#define FTN_TARGET_FREE OMP_TARGET_FREE_
|
#define FTN_TARGET_FREE OMP_TARGET_FREE_
|
||||||
#define FTN_TARGET_IS_PRESENT OMP_TARGET_IS_PRESENT_
|
#define FTN_TARGET_IS_PRESENT OMP_TARGET_IS_PRESENT_
|
||||||
#define FTN_TARGET_MEMCPY OMP_TARGET_MEMCPY_
|
#define FTN_TARGET_MEMCPY OMP_TARGET_MEMCPY_
|
||||||
#define FTN_TARGET_MEMCPY_RECT OMP_TARGET_MEMCPY_RECT_
|
#define FTN_TARGET_MEMCPY_RECT OMP_TARGET_MEMCPY_RECT_
|
||||||
#define FTN_TARGET_ASSOCIATE_PTR OMP_TARGET_ASSOCIATE_PTR_
|
#define FTN_TARGET_ASSOCIATE_PTR OMP_TARGET_ASSOCIATE_PTR_
|
||||||
#define FTN_TARGET_DISASSOCIATE_PTR OMP_TARGET_DISASSOCIATE_PTR_
|
#define FTN_TARGET_DISASSOCIATE_PTR OMP_TARGET_DISASSOCIATE_PTR_
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* KMP_FTN_UAPPEND */
|
#endif /* KMP_FTN_UAPPEND */
|
||||||
|
|
||||||
/* ------------------------------------------------------------------ */
|
|
||||||
/* -------------------------- GOMP API NAMES ------------------------ */
|
/* -------------------------- GOMP API NAMES ------------------------ */
|
||||||
// All GOMP_1.0 symbols
|
// All GOMP_1.0 symbols
|
||||||
#define KMP_API_NAME_GOMP_ATOMIC_END GOMP_atomic_end
|
#define KMP_API_NAME_GOMP_ATOMIC_END GOMP_atomic_end
|
||||||
|
|
@ -510,14 +509,20 @@
|
||||||
#define KMP_API_NAME_GOMP_LOOP_END_NOWAIT GOMP_loop_end_nowait
|
#define KMP_API_NAME_GOMP_LOOP_END_NOWAIT GOMP_loop_end_nowait
|
||||||
#define KMP_API_NAME_GOMP_LOOP_GUIDED_NEXT GOMP_loop_guided_next
|
#define KMP_API_NAME_GOMP_LOOP_GUIDED_NEXT GOMP_loop_guided_next
|
||||||
#define KMP_API_NAME_GOMP_LOOP_GUIDED_START GOMP_loop_guided_start
|
#define KMP_API_NAME_GOMP_LOOP_GUIDED_START GOMP_loop_guided_start
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_NEXT GOMP_loop_ordered_dynamic_next
|
#define KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_NEXT \
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_START GOMP_loop_ordered_dynamic_start
|
GOMP_loop_ordered_dynamic_next
|
||||||
|
#define KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_START \
|
||||||
|
GOMP_loop_ordered_dynamic_start
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_NEXT GOMP_loop_ordered_guided_next
|
#define KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_NEXT GOMP_loop_ordered_guided_next
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_START GOMP_loop_ordered_guided_start
|
#define KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_START \
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_NEXT GOMP_loop_ordered_runtime_next
|
GOMP_loop_ordered_guided_start
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_START GOMP_loop_ordered_runtime_start
|
#define KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_NEXT \
|
||||||
|
GOMP_loop_ordered_runtime_next
|
||||||
|
#define KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_START \
|
||||||
|
GOMP_loop_ordered_runtime_start
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_NEXT GOMP_loop_ordered_static_next
|
#define KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_NEXT GOMP_loop_ordered_static_next
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_START GOMP_loop_ordered_static_start
|
#define KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_START \
|
||||||
|
GOMP_loop_ordered_static_start
|
||||||
#define KMP_API_NAME_GOMP_LOOP_RUNTIME_NEXT GOMP_loop_runtime_next
|
#define KMP_API_NAME_GOMP_LOOP_RUNTIME_NEXT GOMP_loop_runtime_next
|
||||||
#define KMP_API_NAME_GOMP_LOOP_RUNTIME_START GOMP_loop_runtime_start
|
#define KMP_API_NAME_GOMP_LOOP_RUNTIME_START GOMP_loop_runtime_start
|
||||||
#define KMP_API_NAME_GOMP_LOOP_STATIC_NEXT GOMP_loop_static_next
|
#define KMP_API_NAME_GOMP_LOOP_STATIC_NEXT GOMP_loop_static_next
|
||||||
|
|
@ -525,10 +530,14 @@
|
||||||
#define KMP_API_NAME_GOMP_ORDERED_END GOMP_ordered_end
|
#define KMP_API_NAME_GOMP_ORDERED_END GOMP_ordered_end
|
||||||
#define KMP_API_NAME_GOMP_ORDERED_START GOMP_ordered_start
|
#define KMP_API_NAME_GOMP_ORDERED_START GOMP_ordered_start
|
||||||
#define KMP_API_NAME_GOMP_PARALLEL_END GOMP_parallel_end
|
#define KMP_API_NAME_GOMP_PARALLEL_END GOMP_parallel_end
|
||||||
#define KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START GOMP_parallel_loop_dynamic_start
|
#define KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START \
|
||||||
#define KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START GOMP_parallel_loop_guided_start
|
GOMP_parallel_loop_dynamic_start
|
||||||
#define KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START GOMP_parallel_loop_runtime_start
|
#define KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START \
|
||||||
#define KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START GOMP_parallel_loop_static_start
|
GOMP_parallel_loop_guided_start
|
||||||
|
#define KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START \
|
||||||
|
GOMP_parallel_loop_runtime_start
|
||||||
|
#define KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START \
|
||||||
|
GOMP_parallel_loop_static_start
|
||||||
#define KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START GOMP_parallel_sections_start
|
#define KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START GOMP_parallel_sections_start
|
||||||
#define KMP_API_NAME_GOMP_PARALLEL_START GOMP_parallel_start
|
#define KMP_API_NAME_GOMP_PARALLEL_START GOMP_parallel_start
|
||||||
#define KMP_API_NAME_GOMP_SECTIONS_END GOMP_sections_end
|
#define KMP_API_NAME_GOMP_SECTIONS_END GOMP_sections_end
|
||||||
|
|
@ -546,14 +555,22 @@
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START GOMP_loop_ull_dynamic_start
|
#define KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START GOMP_loop_ull_dynamic_start
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT GOMP_loop_ull_guided_next
|
#define KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT GOMP_loop_ull_guided_next
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START GOMP_loop_ull_guided_start
|
#define KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START GOMP_loop_ull_guided_start
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT GOMP_loop_ull_ordered_dynamic_next
|
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT \
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START GOMP_loop_ull_ordered_dynamic_start
|
GOMP_loop_ull_ordered_dynamic_next
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT GOMP_loop_ull_ordered_guided_next
|
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START \
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_START GOMP_loop_ull_ordered_guided_start
|
GOMP_loop_ull_ordered_dynamic_start
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT GOMP_loop_ull_ordered_runtime_next
|
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT \
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_START GOMP_loop_ull_ordered_runtime_start
|
GOMP_loop_ull_ordered_guided_next
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT GOMP_loop_ull_ordered_static_next
|
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_START \
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_START GOMP_loop_ull_ordered_static_start
|
GOMP_loop_ull_ordered_guided_start
|
||||||
|
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT \
|
||||||
|
GOMP_loop_ull_ordered_runtime_next
|
||||||
|
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_START \
|
||||||
|
GOMP_loop_ull_ordered_runtime_start
|
||||||
|
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT \
|
||||||
|
GOMP_loop_ull_ordered_static_next
|
||||||
|
#define KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_START \
|
||||||
|
GOMP_loop_ull_ordered_static_start
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_NEXT GOMP_loop_ull_runtime_next
|
#define KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_NEXT GOMP_loop_ull_runtime_next
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START GOMP_loop_ull_runtime_start
|
#define KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START GOMP_loop_ull_runtime_start
|
||||||
#define KMP_API_NAME_GOMP_LOOP_ULL_STATIC_NEXT GOMP_loop_ull_static_next
|
#define KMP_API_NAME_GOMP_LOOP_ULL_STATIC_NEXT GOMP_loop_ull_static_next
|
||||||
|
|
@ -563,7 +580,8 @@
|
||||||
#define KMP_API_NAME_GOMP_TASKYIELD GOMP_taskyield
|
#define KMP_API_NAME_GOMP_TASKYIELD GOMP_taskyield
|
||||||
|
|
||||||
// All GOMP_4.0 symbols
|
// All GOMP_4.0 symbols
|
||||||
// TODO: As of 2013-10-14, none of the GOMP_4.0 functions are implemented in libomp
|
// TODO: As of 2013-10-14, none of the GOMP_4.0 functions are implemented in
|
||||||
|
// libomp
|
||||||
#define KMP_API_NAME_GOMP_BARRIER_CANCEL GOMP_barrier_cancel
|
#define KMP_API_NAME_GOMP_BARRIER_CANCEL GOMP_barrier_cancel
|
||||||
#define KMP_API_NAME_GOMP_CANCEL GOMP_cancel
|
#define KMP_API_NAME_GOMP_CANCEL GOMP_cancel
|
||||||
#define KMP_API_NAME_GOMP_CANCELLATION_POINT GOMP_cancellation_point
|
#define KMP_API_NAME_GOMP_CANCELLATION_POINT GOMP_cancellation_point
|
||||||
|
|
@ -585,36 +603,42 @@
|
||||||
#define KMP_API_NAME_GOMP_TEAMS GOMP_teams
|
#define KMP_API_NAME_GOMP_TEAMS GOMP_teams
|
||||||
|
|
||||||
#ifdef KMP_USE_VERSION_SYMBOLS
|
#ifdef KMP_USE_VERSION_SYMBOLS
|
||||||
#define xstr(x) str(x)
|
#define xstr(x) str(x)
|
||||||
#define str(x) #x
|
#define str(x) #x
|
||||||
|
|
||||||
// If Linux, xexpand prepends __kmp_api_ to the real API name
|
// If Linux, xexpand prepends __kmp_api_ to the real API name
|
||||||
#define xexpand(api_name) expand(api_name)
|
#define xexpand(api_name) expand(api_name)
|
||||||
#define expand(api_name) __kmp_api_##api_name
|
#define expand(api_name) __kmp_api_##api_name
|
||||||
|
|
||||||
#define xaliasify(api_name,ver) aliasify(api_name,ver)
|
#define xaliasify(api_name, ver) aliasify(api_name, ver)
|
||||||
#define aliasify(api_name,ver) __typeof__(__kmp_api_##api_name) __kmp_api_##api_name##_##ver##_alias __attribute__((alias(xstr(__kmp_api_##api_name))))
|
#define aliasify(api_name, ver) \
|
||||||
|
__typeof__(__kmp_api_##api_name) __kmp_api_##api_name##_##ver##_alias \
|
||||||
|
__attribute__((alias(xstr(__kmp_api_##api_name))))
|
||||||
|
|
||||||
#define xversionify(api_name, version_num, version_str) versionify(api_name, version_num, version_str, "VERSION")
|
#define xversionify(api_name, version_num, version_str) \
|
||||||
#define versionify(api_name, version_num, version_str, default_ver) \
|
versionify(api_name, version_num, version_str, "VERSION")
|
||||||
__asm__(".symver " xstr(__kmp_api_##api_name##_##version_num##_alias) "," xstr(api_name) "@" version_str "\n\t"); \
|
#define versionify(api_name, version_num, version_str, default_ver) \
|
||||||
__asm__(".symver " xstr(__kmp_api_##api_name) "," xstr(api_name) "@@" default_ver "\n\t")
|
__asm__( \
|
||||||
|
".symver " xstr(__kmp_api_##api_name##_##version_num##_alias) "," xstr( \
|
||||||
|
api_name) "@" version_str "\n\t"); \
|
||||||
|
__asm__(".symver " xstr(__kmp_api_##api_name) "," xstr( \
|
||||||
|
api_name) "@@" default_ver "\n\t")
|
||||||
|
|
||||||
#else // KMP_USE_VERSION_SYMBOLS
|
#else // KMP_USE_VERSION_SYMBOLS
|
||||||
#define xstr(x) /* Nothing */
|
#define xstr(x) /* Nothing */
|
||||||
#define str(x) /* Nothing */
|
#define str(x) /* Nothing */
|
||||||
|
|
||||||
// if Windows or Mac, xexpand does no name transformation
|
// if Windows or Mac, xexpand does no name transformation
|
||||||
#define xexpand(api_name) expand(api_name)
|
#define xexpand(api_name) expand(api_name)
|
||||||
#define expand(api_name) api_name
|
#define expand(api_name) api_name
|
||||||
|
|
||||||
#define xaliasify(api_name,ver) /* Nothing */
|
#define xaliasify(api_name, ver) /* Nothing */
|
||||||
#define aliasify(api_name,ver) /* Nothing */
|
#define aliasify(api_name, ver) /* Nothing */
|
||||||
|
|
||||||
#define xversionify(api_name, version_num, version_str) /* Nothing */
|
#define xversionify(api_name, version_num, version_str) /* Nothing */
|
||||||
#define versionify(api_name, version_num, version_str, default_ver) /* Nothing */
|
#define versionify(api_name, version_num, version_str, \
|
||||||
|
default_ver) /* Nothing */
|
||||||
|
|
||||||
#endif // KMP_USE_VERSION_SYMBOLS
|
#endif // KMP_USE_VERSION_SYMBOLS
|
||||||
|
|
||||||
#endif /* KMP_FTN_OS_H */
|
#endif /* KMP_FTN_OS_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@
|
||||||
#include "kmp.h"
|
#include "kmp.h"
|
||||||
|
|
||||||
// Note: This string is not printed when KMP_VERSION=1.
|
// Note: This string is not printed when KMP_VERSION=1.
|
||||||
char const __kmp_version_ftnstdcall[] = KMP_VERSION_PREFIX "Fortran __stdcall OMP support: "
|
char const __kmp_version_ftnstdcall[] =
|
||||||
|
KMP_VERSION_PREFIX "Fortran __stdcall OMP support: "
|
||||||
#ifdef USE_FTN_STDCALL
|
#ifdef USE_FTN_STDCALL
|
||||||
"yes";
|
"yes";
|
||||||
#else
|
#else
|
||||||
|
|
@ -28,8 +29,7 @@ char const __kmp_version_ftnstdcall[] = KMP_VERSION_PREFIX "Fortran __stdcall OM
|
||||||
#define FTN_STDCALL KMP_STDCALL
|
#define FTN_STDCALL KMP_STDCALL
|
||||||
#define KMP_FTN_ENTRIES USE_FTN_STDCALL
|
#define KMP_FTN_ENTRIES USE_FTN_STDCALL
|
||||||
|
|
||||||
#include "kmp_ftn_os.h"
|
|
||||||
#include "kmp_ftn_entry.h"
|
#include "kmp_ftn_entry.h"
|
||||||
|
#include "kmp_ftn_os.h"
|
||||||
|
|
||||||
#endif /* USE_FTN_STDCALL */
|
#endif /* USE_FTN_STDCALL */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
kmp_key_t __kmp_gtid_threadprivate_key;
|
kmp_key_t __kmp_gtid_threadprivate_key;
|
||||||
|
|
||||||
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
||||||
kmp_cpuinfo_t __kmp_cpuinfo = { 0 }; // Not initialized
|
kmp_cpuinfo_t __kmp_cpuinfo = {0}; // Not initialized
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if KMP_STATS_ENABLED
|
#if KMP_STATS_ENABLED
|
||||||
|
|
@ -27,11 +27,12 @@ kmp_cpuinfo_t __kmp_cpuinfo = { 0 }; // Not initialized
|
||||||
// lock for modifying the global __kmp_stats_list
|
// lock for modifying the global __kmp_stats_list
|
||||||
kmp_tas_lock_t __kmp_stats_lock;
|
kmp_tas_lock_t __kmp_stats_lock;
|
||||||
|
|
||||||
// global list of per thread stats, the head is a sentinel node which accumulates all stats produced before __kmp_create_worker is called.
|
// global list of per thread stats, the head is a sentinel node which
|
||||||
kmp_stats_list* __kmp_stats_list;
|
// accumulates all stats produced before __kmp_create_worker is called.
|
||||||
|
kmp_stats_list *__kmp_stats_list;
|
||||||
|
|
||||||
// thread local pointer to stats node within list
|
// thread local pointer to stats node within list
|
||||||
__thread kmp_stats_list* __kmp_stats_thread_ptr = NULL;
|
__thread kmp_stats_list *__kmp_stats_thread_ptr = NULL;
|
||||||
|
|
||||||
// gives reference tick for all events (considered the 0 tick)
|
// gives reference tick for all events (considered the 0 tick)
|
||||||
tsc_tick_count __kmp_stats_start_time;
|
tsc_tick_count __kmp_stats_start_time;
|
||||||
|
|
@ -46,7 +47,8 @@ volatile int __kmp_init_common = FALSE;
|
||||||
volatile int __kmp_init_middle = FALSE;
|
volatile int __kmp_init_middle = FALSE;
|
||||||
volatile int __kmp_init_parallel = FALSE;
|
volatile int __kmp_init_parallel = FALSE;
|
||||||
#if KMP_USE_MONITOR
|
#if KMP_USE_MONITOR
|
||||||
volatile int __kmp_init_monitor = 0; /* 1 - launched, 2 - actually started (Windows* OS only) */
|
volatile int __kmp_init_monitor =
|
||||||
|
0; /* 1 - launched, 2 - actually started (Windows* OS only) */
|
||||||
#endif
|
#endif
|
||||||
volatile int __kmp_init_user_locks = FALSE;
|
volatile int __kmp_init_user_locks = FALSE;
|
||||||
|
|
||||||
|
|
@ -60,8 +62,10 @@ int __kmp_version = 0;
|
||||||
volatile kmp_uint32 __kmp_team_counter = 0;
|
volatile kmp_uint32 __kmp_team_counter = 0;
|
||||||
volatile kmp_uint32 __kmp_task_counter = 0;
|
volatile kmp_uint32 __kmp_task_counter = 0;
|
||||||
|
|
||||||
unsigned int __kmp_init_wait = KMP_DEFAULT_INIT_WAIT; /* initial number of spin-tests */
|
unsigned int __kmp_init_wait =
|
||||||
unsigned int __kmp_next_wait = KMP_DEFAULT_NEXT_WAIT; /* susequent number of spin-tests */
|
KMP_DEFAULT_INIT_WAIT; /* initial number of spin-tests */
|
||||||
|
unsigned int __kmp_next_wait =
|
||||||
|
KMP_DEFAULT_NEXT_WAIT; /* susequent number of spin-tests */
|
||||||
|
|
||||||
size_t __kmp_stksize = KMP_DEFAULT_STKSIZE;
|
size_t __kmp_stksize = KMP_DEFAULT_STKSIZE;
|
||||||
#if KMP_USE_MONITOR
|
#if KMP_USE_MONITOR
|
||||||
|
|
@ -72,45 +76,53 @@ int __kmp_stkpadding = KMP_MIN_STKPADDING;
|
||||||
|
|
||||||
size_t __kmp_malloc_pool_incr = KMP_DEFAULT_MALLOC_POOL_INCR;
|
size_t __kmp_malloc_pool_incr = KMP_DEFAULT_MALLOC_POOL_INCR;
|
||||||
|
|
||||||
/* Barrier method defaults, settings, and strings */
|
// Barrier method defaults, settings, and strings.
|
||||||
/* branch factor = 2^branch_bits (only relevant for tree and hyper barrier types) */
|
// branch factor = 2^branch_bits (only relevant for tree & hyper barrier types)
|
||||||
#if KMP_ARCH_X86_64
|
#if KMP_ARCH_X86_64
|
||||||
kmp_uint32 __kmp_barrier_gather_bb_dflt = 2; /* branch_factor = 4 */ /* hyper2: C78980 */
|
kmp_uint32 __kmp_barrier_gather_bb_dflt = 2;
|
||||||
kmp_uint32 __kmp_barrier_release_bb_dflt = 2; /* branch_factor = 4 */ /* hyper2: C78980 */
|
/* branch_factor = 4 */ /* hyper2: C78980 */
|
||||||
|
kmp_uint32 __kmp_barrier_release_bb_dflt = 2;
|
||||||
|
/* branch_factor = 4 */ /* hyper2: C78980 */
|
||||||
#else
|
#else
|
||||||
kmp_uint32 __kmp_barrier_gather_bb_dflt = 2; /* branch_factor = 4 */ /* communication in core for MIC */
|
kmp_uint32 __kmp_barrier_gather_bb_dflt = 2;
|
||||||
kmp_uint32 __kmp_barrier_release_bb_dflt = 2; /* branch_factor = 4 */ /* communication in core for MIC */
|
/* branch_factor = 4 */ /* communication in core for MIC */
|
||||||
|
kmp_uint32 __kmp_barrier_release_bb_dflt = 2;
|
||||||
|
/* branch_factor = 4 */ /* communication in core for MIC */
|
||||||
#endif // KMP_ARCH_X86_64
|
#endif // KMP_ARCH_X86_64
|
||||||
#if KMP_ARCH_X86_64
|
#if KMP_ARCH_X86_64
|
||||||
kmp_bar_pat_e __kmp_barrier_gather_pat_dflt = bp_hyper_bar; /* hyper2: C78980 */
|
kmp_bar_pat_e __kmp_barrier_gather_pat_dflt = bp_hyper_bar; /* hyper2: C78980 */
|
||||||
kmp_bar_pat_e __kmp_barrier_release_pat_dflt = bp_hyper_bar; /* hyper2: C78980 */
|
kmp_bar_pat_e __kmp_barrier_release_pat_dflt =
|
||||||
|
bp_hyper_bar; /* hyper2: C78980 */
|
||||||
#else
|
#else
|
||||||
kmp_bar_pat_e __kmp_barrier_gather_pat_dflt = bp_linear_bar;
|
kmp_bar_pat_e __kmp_barrier_gather_pat_dflt = bp_linear_bar;
|
||||||
kmp_bar_pat_e __kmp_barrier_release_pat_dflt = bp_linear_bar;
|
kmp_bar_pat_e __kmp_barrier_release_pat_dflt = bp_linear_bar;
|
||||||
#endif
|
#endif
|
||||||
kmp_uint32 __kmp_barrier_gather_branch_bits [ bs_last_barrier ] = { 0 };
|
kmp_uint32 __kmp_barrier_gather_branch_bits[bs_last_barrier] = {0};
|
||||||
kmp_uint32 __kmp_barrier_release_branch_bits [ bs_last_barrier ] = { 0 };
|
kmp_uint32 __kmp_barrier_release_branch_bits[bs_last_barrier] = {0};
|
||||||
kmp_bar_pat_e __kmp_barrier_gather_pattern [ bs_last_barrier ] = { bp_linear_bar };
|
kmp_bar_pat_e __kmp_barrier_gather_pattern[bs_last_barrier] = {bp_linear_bar};
|
||||||
kmp_bar_pat_e __kmp_barrier_release_pattern [ bs_last_barrier ] = { bp_linear_bar };
|
kmp_bar_pat_e __kmp_barrier_release_pattern[bs_last_barrier] = {bp_linear_bar};
|
||||||
char const *__kmp_barrier_branch_bit_env_name [ bs_last_barrier ] =
|
char const *__kmp_barrier_branch_bit_env_name[bs_last_barrier] = {
|
||||||
{ "KMP_PLAIN_BARRIER", "KMP_FORKJOIN_BARRIER"
|
"KMP_PLAIN_BARRIER", "KMP_FORKJOIN_BARRIER"
|
||||||
#if KMP_FAST_REDUCTION_BARRIER
|
#if KMP_FAST_REDUCTION_BARRIER
|
||||||
, "KMP_REDUCTION_BARRIER"
|
,
|
||||||
#endif // KMP_FAST_REDUCTION_BARRIER
|
"KMP_REDUCTION_BARRIER"
|
||||||
};
|
#endif // KMP_FAST_REDUCTION_BARRIER
|
||||||
char const *__kmp_barrier_pattern_env_name [ bs_last_barrier ] =
|
};
|
||||||
{ "KMP_PLAIN_BARRIER_PATTERN", "KMP_FORKJOIN_BARRIER_PATTERN"
|
char const *__kmp_barrier_pattern_env_name[bs_last_barrier] = {
|
||||||
#if KMP_FAST_REDUCTION_BARRIER
|
"KMP_PLAIN_BARRIER_PATTERN", "KMP_FORKJOIN_BARRIER_PATTERN"
|
||||||
, "KMP_REDUCTION_BARRIER_PATTERN"
|
#if KMP_FAST_REDUCTION_BARRIER
|
||||||
#endif // KMP_FAST_REDUCTION_BARRIER
|
,
|
||||||
};
|
"KMP_REDUCTION_BARRIER_PATTERN"
|
||||||
char const *__kmp_barrier_type_name [ bs_last_barrier ] =
|
#endif // KMP_FAST_REDUCTION_BARRIER
|
||||||
{ "plain", "forkjoin"
|
};
|
||||||
#if KMP_FAST_REDUCTION_BARRIER
|
char const *__kmp_barrier_type_name[bs_last_barrier] = {"plain", "forkjoin"
|
||||||
, "reduction"
|
#if KMP_FAST_REDUCTION_BARRIER
|
||||||
#endif // KMP_FAST_REDUCTION_BARRIER
|
,
|
||||||
};
|
"reduction"
|
||||||
char const *__kmp_barrier_pattern_name[bp_last_bar] = {"linear","tree","hyper","hierarchical"};
|
#endif // KMP_FAST_REDUCTION_BARRIER
|
||||||
|
};
|
||||||
|
char const *__kmp_barrier_pattern_name[bp_last_bar] = {"linear", "tree",
|
||||||
|
"hyper", "hierarchical"};
|
||||||
|
|
||||||
int __kmp_allThreadsSpecified = 0;
|
int __kmp_allThreadsSpecified = 0;
|
||||||
size_t __kmp_align_alloc = CACHE_LINE;
|
size_t __kmp_align_alloc = CACHE_LINE;
|
||||||
|
|
@ -130,21 +142,27 @@ int __kmp_tp_capacity = 0;
|
||||||
int __kmp_tp_cached = 0;
|
int __kmp_tp_cached = 0;
|
||||||
int __kmp_dflt_nested = FALSE;
|
int __kmp_dflt_nested = FALSE;
|
||||||
int __kmp_dispatch_num_buffers = KMP_DFLT_DISP_NUM_BUFF;
|
int __kmp_dispatch_num_buffers = KMP_DFLT_DISP_NUM_BUFF;
|
||||||
int __kmp_dflt_max_active_levels = KMP_MAX_ACTIVE_LEVELS_LIMIT; /* max_active_levels limit */
|
int __kmp_dflt_max_active_levels =
|
||||||
|
KMP_MAX_ACTIVE_LEVELS_LIMIT; /* max_active_levels limit */
|
||||||
#if KMP_NESTED_HOT_TEAMS
|
#if KMP_NESTED_HOT_TEAMS
|
||||||
int __kmp_hot_teams_mode = 0; /* 0 - free extra threads when reduced */
|
int __kmp_hot_teams_mode = 0; /* 0 - free extra threads when reduced */
|
||||||
/* 1 - keep extra threads when reduced */
|
/* 1 - keep extra threads when reduced */
|
||||||
int __kmp_hot_teams_max_level = 1; /* nesting level of hot teams */
|
int __kmp_hot_teams_max_level = 1; /* nesting level of hot teams */
|
||||||
#endif
|
#endif
|
||||||
enum library_type __kmp_library = library_none;
|
enum library_type __kmp_library = library_none;
|
||||||
enum sched_type __kmp_sched = kmp_sch_default; /* scheduling method for runtime scheduling */
|
enum sched_type __kmp_sched =
|
||||||
enum sched_type __kmp_static = kmp_sch_static_greedy; /* default static scheduling method */
|
kmp_sch_default; /* scheduling method for runtime scheduling */
|
||||||
enum sched_type __kmp_guided = kmp_sch_guided_iterative_chunked; /* default guided scheduling method */
|
enum sched_type __kmp_static =
|
||||||
enum sched_type __kmp_auto = kmp_sch_guided_analytical_chunked; /* default auto scheduling method */
|
kmp_sch_static_greedy; /* default static scheduling method */
|
||||||
|
enum sched_type __kmp_guided =
|
||||||
|
kmp_sch_guided_iterative_chunked; /* default guided scheduling method */
|
||||||
|
enum sched_type __kmp_auto =
|
||||||
|
kmp_sch_guided_analytical_chunked; /* default auto scheduling method */
|
||||||
int __kmp_dflt_blocktime = KMP_DEFAULT_BLOCKTIME;
|
int __kmp_dflt_blocktime = KMP_DEFAULT_BLOCKTIME;
|
||||||
#if KMP_USE_MONITOR
|
#if KMP_USE_MONITOR
|
||||||
int __kmp_monitor_wakeups = KMP_MIN_MONITOR_WAKEUPS;
|
int __kmp_monitor_wakeups = KMP_MIN_MONITOR_WAKEUPS;
|
||||||
int __kmp_bt_intervals = KMP_INTERVALS_FROM_BLOCKTIME( KMP_DEFAULT_BLOCKTIME, KMP_MIN_MONITOR_WAKEUPS );
|
int __kmp_bt_intervals = KMP_INTERVALS_FROM_BLOCKTIME(KMP_DEFAULT_BLOCKTIME,
|
||||||
|
KMP_MIN_MONITOR_WAKEUPS);
|
||||||
#endif
|
#endif
|
||||||
#ifdef KMP_ADJUST_BLOCKTIME
|
#ifdef KMP_ADJUST_BLOCKTIME
|
||||||
int __kmp_zero_bt = FALSE;
|
int __kmp_zero_bt = FALSE;
|
||||||
|
|
@ -169,7 +187,8 @@ int __kmp_adjust_gtid_mode = TRUE;
|
||||||
__declspec(thread) int __kmp_gtid = KMP_GTID_DNE;
|
__declspec(thread) int __kmp_gtid = KMP_GTID_DNE;
|
||||||
#else
|
#else
|
||||||
__thread int __kmp_gtid = KMP_GTID_DNE;
|
__thread int __kmp_gtid = KMP_GTID_DNE;
|
||||||
#endif /* KMP_OS_WINDOWS - workaround because Intel(R) Many Integrated Core compiler 20110316 doesn't accept __declspec */
|
#endif /* KMP_OS_WINDOWS - workaround because Intel(R) Many Integrated Core \
|
||||||
|
compiler 20110316 doesn't accept __declspec */
|
||||||
#endif /* KMP_TDATA_GTID */
|
#endif /* KMP_TDATA_GTID */
|
||||||
int __kmp_tls_gtid_min = INT_MAX;
|
int __kmp_tls_gtid_min = INT_MAX;
|
||||||
int __kmp_foreign_tp = TRUE;
|
int __kmp_foreign_tp = TRUE;
|
||||||
|
|
@ -183,14 +202,15 @@ kmp_uint32 __kmp_init_mxcsr = 0;
|
||||||
double __kmp_load_balance_interval = 1.0;
|
double __kmp_load_balance_interval = 1.0;
|
||||||
#endif /* USE_LOAD_BALANCE */
|
#endif /* USE_LOAD_BALANCE */
|
||||||
|
|
||||||
kmp_nested_nthreads_t __kmp_nested_nth = { NULL, 0, 0 };
|
kmp_nested_nthreads_t __kmp_nested_nth = {NULL, 0, 0};
|
||||||
|
|
||||||
#if KMP_USE_ADAPTIVE_LOCKS
|
#if KMP_USE_ADAPTIVE_LOCKS
|
||||||
|
|
||||||
kmp_adaptive_backoff_params_t __kmp_adaptive_backoff_params = { 1, 1024 }; // TODO: tune it!
|
kmp_adaptive_backoff_params_t __kmp_adaptive_backoff_params = {
|
||||||
|
1, 1024}; // TODO: tune it!
|
||||||
|
|
||||||
#if KMP_DEBUG_ADAPTIVE_LOCKS
|
#if KMP_DEBUG_ADAPTIVE_LOCKS
|
||||||
char * __kmp_speculative_statsfile = "-";
|
char *__kmp_speculative_statsfile = "-";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // KMP_USE_ADAPTIVE_LOCKS
|
#endif // KMP_USE_ADAPTIVE_LOCKS
|
||||||
|
|
@ -202,13 +222,14 @@ int __kmp_omp_cancellation = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* map OMP 3.0 schedule types with our internal schedule types */
|
/* map OMP 3.0 schedule types with our internal schedule types */
|
||||||
enum sched_type __kmp_sch_map[ kmp_sched_upper - kmp_sched_lower_ext + kmp_sched_upper_std - kmp_sched_lower - 2 ] = {
|
enum sched_type __kmp_sch_map[kmp_sched_upper - kmp_sched_lower_ext +
|
||||||
|
kmp_sched_upper_std - kmp_sched_lower - 2] = {
|
||||||
kmp_sch_static_chunked, // ==> kmp_sched_static = 1
|
kmp_sch_static_chunked, // ==> kmp_sched_static = 1
|
||||||
kmp_sch_dynamic_chunked, // ==> kmp_sched_dynamic = 2
|
kmp_sch_dynamic_chunked, // ==> kmp_sched_dynamic = 2
|
||||||
kmp_sch_guided_chunked, // ==> kmp_sched_guided = 3
|
kmp_sch_guided_chunked, // ==> kmp_sched_guided = 3
|
||||||
kmp_sch_auto, // ==> kmp_sched_auto = 4
|
kmp_sch_auto, // ==> kmp_sched_auto = 4
|
||||||
kmp_sch_trapezoidal // ==> kmp_sched_trapezoidal = 101
|
kmp_sch_trapezoidal // ==> kmp_sched_trapezoidal = 101
|
||||||
// will likely not used, introduced here just to debug the code
|
// will likely not be used, introduced here just to debug the code
|
||||||
// of public intel extension schedules
|
// of public intel extension schedules
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -223,44 +244,45 @@ enum mic_type __kmp_mic_type = non_mic;
|
||||||
|
|
||||||
#if KMP_AFFINITY_SUPPORTED
|
#if KMP_AFFINITY_SUPPORTED
|
||||||
|
|
||||||
KMPAffinity* __kmp_affinity_dispatch = NULL;
|
KMPAffinity *__kmp_affinity_dispatch = NULL;
|
||||||
|
|
||||||
# if KMP_USE_HWLOC
|
#if KMP_USE_HWLOC
|
||||||
int __kmp_hwloc_error = FALSE;
|
int __kmp_hwloc_error = FALSE;
|
||||||
hwloc_topology_t __kmp_hwloc_topology = NULL;
|
hwloc_topology_t __kmp_hwloc_topology = NULL;
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
# if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
# if KMP_GROUP_AFFINITY
|
#if KMP_GROUP_AFFINITY
|
||||||
int __kmp_num_proc_groups = 1;
|
int __kmp_num_proc_groups = 1;
|
||||||
# endif /* KMP_GROUP_AFFINITY */
|
#endif /* KMP_GROUP_AFFINITY */
|
||||||
kmp_GetActiveProcessorCount_t __kmp_GetActiveProcessorCount = NULL;
|
kmp_GetActiveProcessorCount_t __kmp_GetActiveProcessorCount = NULL;
|
||||||
kmp_GetActiveProcessorGroupCount_t __kmp_GetActiveProcessorGroupCount = NULL;
|
kmp_GetActiveProcessorGroupCount_t __kmp_GetActiveProcessorGroupCount = NULL;
|
||||||
kmp_GetThreadGroupAffinity_t __kmp_GetThreadGroupAffinity = NULL;
|
kmp_GetThreadGroupAffinity_t __kmp_GetThreadGroupAffinity = NULL;
|
||||||
kmp_SetThreadGroupAffinity_t __kmp_SetThreadGroupAffinity = NULL;
|
kmp_SetThreadGroupAffinity_t __kmp_SetThreadGroupAffinity = NULL;
|
||||||
# endif /* KMP_OS_WINDOWS */
|
#endif /* KMP_OS_WINDOWS */
|
||||||
|
|
||||||
size_t __kmp_affin_mask_size = 0;
|
size_t __kmp_affin_mask_size = 0;
|
||||||
enum affinity_type __kmp_affinity_type = affinity_default;
|
enum affinity_type __kmp_affinity_type = affinity_default;
|
||||||
enum affinity_gran __kmp_affinity_gran = affinity_gran_default;
|
enum affinity_gran __kmp_affinity_gran = affinity_gran_default;
|
||||||
int __kmp_affinity_gran_levels = -1;
|
int __kmp_affinity_gran_levels = -1;
|
||||||
int __kmp_affinity_dups = TRUE;
|
int __kmp_affinity_dups = TRUE;
|
||||||
enum affinity_top_method __kmp_affinity_top_method = affinity_top_method_default;
|
enum affinity_top_method __kmp_affinity_top_method =
|
||||||
|
affinity_top_method_default;
|
||||||
int __kmp_affinity_compact = 0;
|
int __kmp_affinity_compact = 0;
|
||||||
int __kmp_affinity_offset = 0;
|
int __kmp_affinity_offset = 0;
|
||||||
int __kmp_affinity_verbose = FALSE;
|
int __kmp_affinity_verbose = FALSE;
|
||||||
int __kmp_affinity_warnings = TRUE;
|
int __kmp_affinity_warnings = TRUE;
|
||||||
int __kmp_affinity_respect_mask = affinity_respect_mask_default;
|
int __kmp_affinity_respect_mask = affinity_respect_mask_default;
|
||||||
char * __kmp_affinity_proclist = NULL;
|
char *__kmp_affinity_proclist = NULL;
|
||||||
kmp_affin_mask_t *__kmp_affinity_masks = NULL;
|
kmp_affin_mask_t *__kmp_affinity_masks = NULL;
|
||||||
unsigned __kmp_affinity_num_masks = 0;
|
unsigned __kmp_affinity_num_masks = 0;
|
||||||
|
|
||||||
char const * __kmp_cpuinfo_file = NULL;
|
char const *__kmp_cpuinfo_file = NULL;
|
||||||
|
|
||||||
#endif /* KMP_AFFINITY_SUPPORTED */
|
#endif /* KMP_AFFINITY_SUPPORTED */
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
kmp_nested_proc_bind_t __kmp_nested_proc_bind = { NULL, 0, 0 };
|
kmp_nested_proc_bind_t __kmp_nested_proc_bind = {NULL, 0, 0};
|
||||||
int __kmp_affinity_num_places = 0;
|
int __kmp_affinity_num_places = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -281,15 +303,15 @@ kmp_tasking_mode_t __kmp_tasking_mode = tskm_task_teams;
|
||||||
kmp_int32 __kmp_max_task_priority = 0;
|
kmp_int32 __kmp_max_task_priority = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This check ensures that the compiler is passing the correct data type
|
/* This check ensures that the compiler is passing the correct data type for the
|
||||||
* for the flags formal parameter of the function kmpc_omp_task_alloc().
|
flags formal parameter of the function kmpc_omp_task_alloc(). If the type is
|
||||||
* If the type is not a 4-byte type, then give an error message about
|
not a 4-byte type, then give an error message about a non-positive length
|
||||||
* a non-positive length array pointing here. If that happens, the
|
array pointing here. If that happens, the kmp_tasking_flags_t structure must
|
||||||
* kmp_tasking_flags_t structure must be redefined to have exactly 32 bits.
|
be redefined to have exactly 32 bits. */
|
||||||
*/
|
KMP_BUILD_ASSERT(sizeof(kmp_tasking_flags_t) == 4);
|
||||||
KMP_BUILD_ASSERT( sizeof(kmp_tasking_flags_t) == 4 );
|
|
||||||
|
|
||||||
kmp_int32 __kmp_task_stealing_constraint = 1; /* Constrain task stealing by default */
|
kmp_int32 __kmp_task_stealing_constraint =
|
||||||
|
1; /* Constrain task stealing by default */
|
||||||
|
|
||||||
#ifdef DEBUG_SUSPEND
|
#ifdef DEBUG_SUSPEND
|
||||||
int __kmp_suspend_count = 0;
|
int __kmp_suspend_count = 0;
|
||||||
|
|
@ -301,7 +323,8 @@ int __kmp_duplicate_library_ok = 0;
|
||||||
int __kmp_forkjoin_frames = 1;
|
int __kmp_forkjoin_frames = 1;
|
||||||
int __kmp_forkjoin_frames_mode = 3;
|
int __kmp_forkjoin_frames_mode = 3;
|
||||||
#endif
|
#endif
|
||||||
PACKED_REDUCTION_METHOD_T __kmp_force_reduction_method = reduction_method_not_defined;
|
PACKED_REDUCTION_METHOD_T __kmp_force_reduction_method =
|
||||||
|
reduction_method_not_defined;
|
||||||
int __kmp_determ_red = FALSE;
|
int __kmp_determ_red = FALSE;
|
||||||
|
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
|
|
@ -315,38 +338,49 @@ int kmp_diag = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* For debug information logging using rotating buffer */
|
/* For debug information logging using rotating buffer */
|
||||||
int __kmp_debug_buf = FALSE; /* TRUE means use buffer, FALSE means print to stderr */
|
int __kmp_debug_buf =
|
||||||
int __kmp_debug_buf_lines = KMP_DEBUG_BUF_LINES_INIT; /* Lines of debug stored in buffer */
|
FALSE; /* TRUE means use buffer, FALSE means print to stderr */
|
||||||
int __kmp_debug_buf_chars = KMP_DEBUG_BUF_CHARS_INIT; /* Characters allowed per line in buffer */
|
int __kmp_debug_buf_lines =
|
||||||
int __kmp_debug_buf_atomic = FALSE; /* TRUE means use atomic update of buffer entry pointer */
|
KMP_DEBUG_BUF_LINES_INIT; /* Lines of debug stored in buffer */
|
||||||
|
int __kmp_debug_buf_chars =
|
||||||
|
KMP_DEBUG_BUF_CHARS_INIT; /* Characters allowed per line in buffer */
|
||||||
|
int __kmp_debug_buf_atomic =
|
||||||
|
FALSE; /* TRUE means use atomic update of buffer entry pointer */
|
||||||
|
|
||||||
char *__kmp_debug_buffer = NULL; /* Debug buffer itself */
|
char *__kmp_debug_buffer = NULL; /* Debug buffer itself */
|
||||||
int __kmp_debug_count = 0; /* Counter for number of lines printed in buffer so far */
|
int __kmp_debug_count =
|
||||||
int __kmp_debug_buf_warn_chars = 0; /* Keep track of char increase recommended in warnings */
|
0; /* Counter for number of lines printed in buffer so far */
|
||||||
|
int __kmp_debug_buf_warn_chars =
|
||||||
|
0; /* Keep track of char increase recommended in warnings */
|
||||||
/* end rotating debug buffer */
|
/* end rotating debug buffer */
|
||||||
|
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
int __kmp_par_range; /* +1 => only go par for constructs in range */
|
int __kmp_par_range; /* +1 => only go par for constructs in range */
|
||||||
/* -1 => only go par for constructs outside range */
|
/* -1 => only go par for constructs outside range */
|
||||||
char __kmp_par_range_routine[KMP_PAR_RANGE_ROUTINE_LEN] = { '\0' };
|
char __kmp_par_range_routine[KMP_PAR_RANGE_ROUTINE_LEN] = {'\0'};
|
||||||
char __kmp_par_range_filename[KMP_PAR_RANGE_FILENAME_LEN] = { '\0' };
|
char __kmp_par_range_filename[KMP_PAR_RANGE_FILENAME_LEN] = {'\0'};
|
||||||
int __kmp_par_range_lb = 0;
|
int __kmp_par_range_lb = 0;
|
||||||
int __kmp_par_range_ub = INT_MAX;
|
int __kmp_par_range_ub = INT_MAX;
|
||||||
#endif /* KMP_DEBUG */
|
#endif /* KMP_DEBUG */
|
||||||
|
|
||||||
/* For printing out dynamic storage map for threads and teams */
|
/* For printing out dynamic storage map for threads and teams */
|
||||||
int __kmp_storage_map = FALSE; /* True means print storage map for threads and teams */
|
int __kmp_storage_map =
|
||||||
int __kmp_storage_map_verbose = FALSE; /* True means storage map includes placement info */
|
FALSE; /* True means print storage map for threads and teams */
|
||||||
|
int __kmp_storage_map_verbose =
|
||||||
|
FALSE; /* True means storage map includes placement info */
|
||||||
int __kmp_storage_map_verbose_specified = FALSE;
|
int __kmp_storage_map_verbose_specified = FALSE;
|
||||||
/* Initialize the library data structures when we fork a child process, defaults to TRUE */
|
/* Initialize the library data structures when we fork a child process, defaults
|
||||||
int __kmp_need_register_atfork = TRUE; /* At initialization, call pthread_atfork to install fork handler */
|
* to TRUE */
|
||||||
|
int __kmp_need_register_atfork =
|
||||||
|
TRUE; /* At initialization, call pthread_atfork to install fork handler */
|
||||||
int __kmp_need_register_atfork_specified = TRUE;
|
int __kmp_need_register_atfork_specified = TRUE;
|
||||||
|
|
||||||
int __kmp_env_chunk = FALSE; /* KMP_CHUNK specified? */
|
int __kmp_env_chunk = FALSE; /* KMP_CHUNK specified? */
|
||||||
int __kmp_env_stksize = FALSE; /* KMP_STACKSIZE specified? */
|
int __kmp_env_stksize = FALSE; /* KMP_STACKSIZE specified? */
|
||||||
int __kmp_env_omp_stksize = FALSE; /* OMP_STACKSIZE specified? */
|
int __kmp_env_omp_stksize = FALSE; /* OMP_STACKSIZE specified? */
|
||||||
int __kmp_env_all_threads = FALSE;/* KMP_ALL_THREADS or KMP_MAX_THREADS specified? */
|
int __kmp_env_all_threads =
|
||||||
int __kmp_env_omp_all_threads = FALSE;/* OMP_THREAD_LIMIT specified? */
|
FALSE; /* KMP_ALL_THREADS or KMP_MAX_THREADS specified? */
|
||||||
|
int __kmp_env_omp_all_threads = FALSE; /* OMP_THREAD_LIMIT specified? */
|
||||||
int __kmp_env_blocktime = FALSE; /* KMP_BLOCKTIME specified? */
|
int __kmp_env_blocktime = FALSE; /* KMP_BLOCKTIME specified? */
|
||||||
int __kmp_env_checks = FALSE; /* KMP_CHECKS specified? */
|
int __kmp_env_checks = FALSE; /* KMP_CHECKS specified? */
|
||||||
int __kmp_env_consistency_check = FALSE; /* KMP_CONSISTENCY_CHECK specified? */
|
int __kmp_env_consistency_check = FALSE; /* KMP_CONSISTENCY_CHECK specified? */
|
||||||
|
|
@ -362,24 +396,20 @@ kmp_uint32 __kmp_yield_cycle = 0;
|
||||||
#else
|
#else
|
||||||
kmp_uint32 __kmp_yield_cycle = 1; /* Yield-cycle is on by default */
|
kmp_uint32 __kmp_yield_cycle = 1; /* Yield-cycle is on by default */
|
||||||
#endif
|
#endif
|
||||||
kmp_int32 __kmp_yield_on_count = 10; /* By default, yielding is on for 10 monitor periods. */
|
kmp_int32 __kmp_yield_on_count =
|
||||||
kmp_int32 __kmp_yield_off_count = 1; /* By default, yielding is off for 1 monitor periods. */
|
10; /* By default, yielding is on for 10 monitor periods. */
|
||||||
/* ----------------------------------------------------- */
|
kmp_int32 __kmp_yield_off_count =
|
||||||
|
1; /* By default, yielding is off for 1 monitor periods. */
|
||||||
|
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
/* STATE mostly syncronized with global lock */
|
/* STATE mostly syncronized with global lock */
|
||||||
/* data written to rarely by masters, read often by workers */
|
/* data written to rarely by masters, read often by workers */
|
||||||
/*
|
/* TODO: None of this global padding stuff works consistently because the order
|
||||||
* SHALL WE EDIT THE COMMENT BELOW IN SOME WAY?
|
of declaration is not necessarily correlated to storage order. To fix this,
|
||||||
* TODO: None of this global padding stuff works consistently because
|
all the important globals must be put in a big structure instead. */
|
||||||
* the order of declaration is not necessarily correlated to storage order.
|
|
||||||
* To fix this, all the important globals must be put in a big structure
|
|
||||||
* instead.
|
|
||||||
*/
|
|
||||||
KMP_ALIGN_CACHE
|
KMP_ALIGN_CACHE
|
||||||
kmp_info_t **__kmp_threads = NULL;
|
kmp_info_t **__kmp_threads = NULL;
|
||||||
kmp_root_t **__kmp_root = NULL;
|
kmp_root_t **__kmp_root = NULL;
|
||||||
|
|
||||||
/* data read/written to often by masters */
|
/* data read/written to often by masters */
|
||||||
KMP_ALIGN_CACHE
|
KMP_ALIGN_CACHE
|
||||||
|
|
@ -395,7 +425,7 @@ volatile int __kmp_thread_pool_active_nth = 0;
|
||||||
/* -------------------------------------------------
|
/* -------------------------------------------------
|
||||||
* GLOBAL/ROOT STATE */
|
* GLOBAL/ROOT STATE */
|
||||||
KMP_ALIGN_CACHE
|
KMP_ALIGN_CACHE
|
||||||
kmp_global_t __kmp_global = {{ 0 }};
|
kmp_global_t __kmp_global = {{0}};
|
||||||
|
|
||||||
/* ----------------------------------------------- */
|
/* ----------------------------------------------- */
|
||||||
/* GLOBAL SYNCHRONIZATION LOCKS */
|
/* GLOBAL SYNCHRONIZATION LOCKS */
|
||||||
|
|
@ -406,7 +436,8 @@ kmp_global_t __kmp_global = {{ 0 }};
|
||||||
* false sharing if the alignment is not large enough for these locks */
|
* false sharing if the alignment is not large enough for these locks */
|
||||||
KMP_ALIGN_CACHE_INTERNODE
|
KMP_ALIGN_CACHE_INTERNODE
|
||||||
|
|
||||||
kmp_bootstrap_lock_t __kmp_initz_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_initz_lock ); /* Control initializations */
|
kmp_bootstrap_lock_t __kmp_initz_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER(
|
||||||
|
__kmp_initz_lock); /* Control initializations */
|
||||||
KMP_ALIGN_CACHE_INTERNODE
|
KMP_ALIGN_CACHE_INTERNODE
|
||||||
kmp_bootstrap_lock_t __kmp_forkjoin_lock; /* control fork/join access */
|
kmp_bootstrap_lock_t __kmp_forkjoin_lock; /* control fork/join access */
|
||||||
KMP_ALIGN_CACHE_INTERNODE
|
KMP_ALIGN_CACHE_INTERNODE
|
||||||
|
|
@ -415,8 +446,10 @@ kmp_bootstrap_lock_t __kmp_exit_lock; /* exit() is not always thread-safe */
|
||||||
KMP_ALIGN_CACHE_INTERNODE
|
KMP_ALIGN_CACHE_INTERNODE
|
||||||
kmp_bootstrap_lock_t __kmp_monitor_lock; /* control monitor thread creation */
|
kmp_bootstrap_lock_t __kmp_monitor_lock; /* control monitor thread creation */
|
||||||
#endif
|
#endif
|
||||||
|
/* used for the hack to allow threadprivate cache and __kmp_threads expansion
|
||||||
|
to co-exist */
|
||||||
KMP_ALIGN_CACHE_INTERNODE
|
KMP_ALIGN_CACHE_INTERNODE
|
||||||
kmp_bootstrap_lock_t __kmp_tp_cached_lock; /* used for the hack to allow threadprivate cache and __kmp_threads expansion to co-exist */
|
kmp_bootstrap_lock_t __kmp_tp_cached_lock;
|
||||||
|
|
||||||
KMP_ALIGN_CACHE_INTERNODE
|
KMP_ALIGN_CACHE_INTERNODE
|
||||||
kmp_lock_t __kmp_global_lock; /* Control OS/global access */
|
kmp_lock_t __kmp_global_lock; /* Control OS/global access */
|
||||||
|
|
@ -427,13 +460,16 @@ kmp_lock_t __kmp_debug_lock; /* Control I/O access for KMP_DEBUG */
|
||||||
#else
|
#else
|
||||||
KMP_ALIGN_CACHE
|
KMP_ALIGN_CACHE
|
||||||
|
|
||||||
kmp_bootstrap_lock_t __kmp_initz_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_initz_lock ); /* Control initializations */
|
kmp_bootstrap_lock_t __kmp_initz_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER(
|
||||||
|
__kmp_initz_lock); /* Control initializations */
|
||||||
kmp_bootstrap_lock_t __kmp_forkjoin_lock; /* control fork/join access */
|
kmp_bootstrap_lock_t __kmp_forkjoin_lock; /* control fork/join access */
|
||||||
kmp_bootstrap_lock_t __kmp_exit_lock; /* exit() is not always thread-safe */
|
kmp_bootstrap_lock_t __kmp_exit_lock; /* exit() is not always thread-safe */
|
||||||
#if KMP_USE_MONITOR
|
#if KMP_USE_MONITOR
|
||||||
kmp_bootstrap_lock_t __kmp_monitor_lock; /* control monitor thread creation */
|
kmp_bootstrap_lock_t __kmp_monitor_lock; /* control monitor thread creation */
|
||||||
#endif
|
#endif
|
||||||
kmp_bootstrap_lock_t __kmp_tp_cached_lock; /* used for the hack to allow threadprivate cache and __kmp_threads expansion to co-exist */
|
/* used for the hack to allow threadprivate cache and __kmp_threads expansion
|
||||||
|
to co-exist */
|
||||||
|
kmp_bootstrap_lock_t __kmp_tp_cached_lock;
|
||||||
|
|
||||||
KMP_ALIGN(128)
|
KMP_ALIGN(128)
|
||||||
kmp_lock_t __kmp_global_lock; /* Control OS/global access */
|
kmp_lock_t __kmp_global_lock; /* Control OS/global access */
|
||||||
|
|
@ -446,26 +482,26 @@ kmp_lock_t __kmp_debug_lock; /* Control I/O access for KMP_DEBUG */
|
||||||
/* ----------------------------------------------- */
|
/* ----------------------------------------------- */
|
||||||
|
|
||||||
#if KMP_HANDLE_SIGNALS
|
#if KMP_HANDLE_SIGNALS
|
||||||
/*
|
/* Signal handling is disabled by default, because it confuses users: In case of
|
||||||
Signal handling is disabled by default, because it confuses users: In case of sigsegv
|
sigsegv (or other trouble) in user code signal handler catches the signal,
|
||||||
(or other trouble) in user code signal handler catches the signal, which then "appears" in
|
which then "appears" in the monitor thread (when the monitor executes raise()
|
||||||
the monitor thread (when the monitor executes raise() function). Users see signal in the
|
function). Users see signal in the monitor thread and blame OpenMP RTL.
|
||||||
monitor thread and blame OpenMP RTL.
|
|
||||||
|
|
||||||
Grant said signal handling required on some older OSes (Irix?) supported by KAI, because
|
Grant said signal handling required on some older OSes (Irix?) supported by
|
||||||
bad applications hung but not aborted. Currently it is not a problem for Linux* OS, OS X* and
|
KAI, because bad applications hung but not aborted. Currently it is not a
|
||||||
Windows* OS.
|
problem for Linux* OS, OS X* and Windows* OS.
|
||||||
|
|
||||||
Grant: Found new hangs for EL4, EL5, and a Fedora Core machine. So I'm putting
|
Grant: Found new hangs for EL4, EL5, and a Fedora Core machine. So I'm
|
||||||
the default back for now to see if that fixes hangs on those machines.
|
putting the default back for now to see if that fixes hangs on those
|
||||||
|
machines.
|
||||||
|
|
||||||
2010-04013 Lev: It was a bug in Fortran RTL. Fortran RTL prints a kind of stack backtrace
|
2010-04013 Lev: It was a bug in Fortran RTL. Fortran RTL prints a kind of
|
||||||
when program is aborting, but the code is not signal-safe. When multiple signals raised at
|
stack backtrace when program is aborting, but the code is not signal-safe.
|
||||||
the same time (which occurs in dynamic negative tests because all the worker threads detects
|
When multiple signals raised at the same time (which occurs in dynamic
|
||||||
the same error), Fortran RTL may hang. The bug finally fixed in Fortran RTL library provided
|
negative tests because all the worker threads detects the same error),
|
||||||
by Steve R., and will be available soon.
|
Fortran RTL may hang. The bug finally fixed in Fortran RTL library provided
|
||||||
*/
|
by Steve R., and will be available soon. */
|
||||||
int __kmp_handle_signals = FALSE;
|
int __kmp_handle_signals = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ----------------------------------------------- */
|
/* ----------------------------------------------- */
|
||||||
|
|
@ -473,27 +509,22 @@ kmp_lock_t __kmp_debug_lock; /* Control I/O access for KMP_DEBUG */
|
||||||
kmp_key_t __kmp_tv_key = 0;
|
kmp_key_t __kmp_tv_key = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
#ifdef DEBUG_SUSPEND
|
#ifdef DEBUG_SUSPEND
|
||||||
int
|
int get_suspend_count_(void) {
|
||||||
get_suspend_count_( void ) {
|
|
||||||
int count = __kmp_suspend_count;
|
int count = __kmp_suspend_count;
|
||||||
__kmp_suspend_count = 0;
|
__kmp_suspend_count = 0;
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
void
|
void set_suspend_count_(int *value) { __kmp_suspend_count = *value; }
|
||||||
set_suspend_count_( int * value ) {
|
|
||||||
__kmp_suspend_count = *value;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Symbols for MS mutual detection.
|
// Symbols for MS mutual detection.
|
||||||
int _You_must_link_with_exactly_one_OpenMP_library = 1;
|
int _You_must_link_with_exactly_one_OpenMP_library = 1;
|
||||||
int _You_must_link_with_Intel_OpenMP_library = 1;
|
int _You_must_link_with_Intel_OpenMP_library = 1;
|
||||||
#if KMP_OS_WINDOWS && ( KMP_VERSION_MAJOR > 4 )
|
#if KMP_OS_WINDOWS && (KMP_VERSION_MAJOR > 4)
|
||||||
int _You_must_link_with_Microsoft_OpenMP_library = 1;
|
int _You_must_link_with_Microsoft_OpenMP_library = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// end of file //
|
// end of file //
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -19,26 +19,24 @@
|
||||||
#include "kmp_str.h"
|
#include "kmp_str.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
/*
|
/* kmp_i18n_id.inc defines kmp_i18n_id_t type. It is an enumeration with
|
||||||
kmp_i18n_id.inc defines kmp_i18n_id_t type. It is an enumeration with identifiers of all the
|
identifiers of all the messages in the catalog. There is one special
|
||||||
messages in the catalog. There is one special identifier: kmp_i18n_null, which denotes absence
|
identifier: kmp_i18n_null, which denotes absence of message. */
|
||||||
of message.
|
|
||||||
*/
|
|
||||||
#include "kmp_i18n_id.inc" // Generated file. Do not edit it manually.
|
#include "kmp_i18n_id.inc" // Generated file. Do not edit it manually.
|
||||||
|
|
||||||
/*
|
/* Low-level functions handling message catalog. __kmp_i18n_open() opens message
|
||||||
Low-level functions handling message catalog. __kmp_i18n_open() opens message catalog,
|
catalog, __kmp_i18n_closes() it. Explicit opening is not required: if message
|
||||||
__kmp_i18n_closes() it. Explicit opening is not required: if message catalog is not yet open,
|
catalog is not yet open, __kmp_i18n_catgets() will open it implicitly.
|
||||||
__kmp_i18n_catgets() will open it implicitly. However, catalog should be explicitly closed,
|
However, catalog should be explicitly closed, otherwise resources (mamory,
|
||||||
otherwise resources (mamory, handles) may leak.
|
handles) may leak.
|
||||||
|
|
||||||
__kmp_i18n_catgets() returns read-only string. It should not be freed.
|
__kmp_i18n_catgets() returns read-only string. It should not be freed.
|
||||||
|
|
||||||
KMP_I18N_STR macro simplifies acces to strings in message catalog a bit. Following two lines are
|
KMP_I18N_STR macro simplifies acces to strings in message catalog a bit.
|
||||||
equivalent:
|
Following two lines are equivalent:
|
||||||
|
|
||||||
__kmp_i18n_catgets( kmp_i18n_str_Warning )
|
__kmp_i18n_catgets( kmp_i18n_str_Warning )
|
||||||
KMP_I18N_STR( Warning )
|
KMP_I18N_STR( Warning )
|
||||||
|
|
@ -46,37 +44,29 @@
|
||||||
|
|
||||||
void __kmp_i18n_catopen();
|
void __kmp_i18n_catopen();
|
||||||
void __kmp_i18n_catclose();
|
void __kmp_i18n_catclose();
|
||||||
char const * __kmp_i18n_catgets( kmp_i18n_id_t id );
|
char const *__kmp_i18n_catgets(kmp_i18n_id_t id);
|
||||||
|
|
||||||
#define KMP_I18N_STR( id ) __kmp_i18n_catgets( kmp_i18n_str_ ## id )
|
#define KMP_I18N_STR(id) __kmp_i18n_catgets(kmp_i18n_str_##id)
|
||||||
|
|
||||||
|
/* High-level interface for printing strings targeted to the user.
|
||||||
/*
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
High-level interface for printing strings targeted to the user.
|
|
||||||
|
|
||||||
All the strings are divided into 3 types:
|
All the strings are divided into 3 types:
|
||||||
|
|
||||||
* messages,
|
* messages,
|
||||||
* hints,
|
* hints,
|
||||||
* system errors.
|
* system errors.
|
||||||
|
|
||||||
There are 3 kind of message severities:
|
There are 3 kind of message severities:
|
||||||
|
|
||||||
* informational messages,
|
* informational messages,
|
||||||
* warnings (non-fatal errors),
|
* warnings (non-fatal errors),
|
||||||
* fatal errors.
|
* fatal errors.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
OMP: Warning #2: Cannot open message catalog "libguide.cat": (1)
|
OMP: Warning #2: Cannot open message catalog "libguide.cat": (1)
|
||||||
OMP: System error #2: No such file or directory (2)
|
OMP: System error #2: No such file or directory (2)
|
||||||
OMP: Hint: Please check NLSPATH environment variable. (3)
|
OMP: Hint: Please check NLSPATH environment variable. (3)
|
||||||
OMP: Info #3: Default messages will be used. (4)
|
OMP: Info #3: Default messages will be used. (4)
|
||||||
|
|
||||||
where
|
where
|
||||||
|
|
||||||
(1) is a message of warning severity,
|
(1) is a message of warning severity,
|
||||||
(2) is a system error caused the previous warning,
|
(2) is a system error caused the previous warning,
|
||||||
(3) is a hint for the user how to fix the problem,
|
(3) is a hint for the user how to fix the problem,
|
||||||
|
|
@ -84,7 +74,8 @@ char const * __kmp_i18n_catgets( kmp_i18n_id_t id );
|
||||||
|
|
||||||
Usage in complex cases (message is accompanied with hints and system errors):
|
Usage in complex cases (message is accompanied with hints and system errors):
|
||||||
|
|
||||||
int error = errno; // We need save errno immediately, because it may be changed.
|
int error = errno; // We need save errno immediately, because it may
|
||||||
|
// be changed.
|
||||||
__kmp_msg(
|
__kmp_msg(
|
||||||
kmp_ms_warning, // Severity
|
kmp_ms_warning, // Severity
|
||||||
KMP_MSG( CantOpenMessageCatalog, name ), // Primary message
|
KMP_MSG( CantOpenMessageCatalog, name ), // Primary message
|
||||||
|
|
@ -94,20 +85,18 @@ char const * __kmp_i18n_catgets( kmp_i18n_id_t id );
|
||||||
);
|
);
|
||||||
|
|
||||||
Usage in simple cases (just a message, no system errors or hints):
|
Usage in simple cases (just a message, no system errors or hints):
|
||||||
|
|
||||||
KMP_INFORM( WillUseDefaultMessages );
|
KMP_INFORM( WillUseDefaultMessages );
|
||||||
KMP_WARNING( CantOpenMessageCatalog, name );
|
KMP_WARNING( CantOpenMessageCatalog, name );
|
||||||
KMP_FATAL( StackOverlap );
|
KMP_FATAL( StackOverlap );
|
||||||
KMP_SYSFAIL( "pthread_create", status );
|
KMP_SYSFAIL( "pthread_create", status );
|
||||||
KMP_CHECK_SYSFAIL( "pthread_create", status );
|
KMP_CHECK_SYSFAIL( "pthread_create", status );
|
||||||
KMP_CHECK_SYSFAIL_ERRNO( "gettimeofday", status );
|
KMP_CHECK_SYSFAIL_ERRNO( "gettimeofday", status );
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum kmp_msg_type {
|
enum kmp_msg_type {
|
||||||
kmp_mt_dummy = 0, // Special type for internal purposes.
|
kmp_mt_dummy = 0, // Special type for internal purposes.
|
||||||
kmp_mt_mesg = 4, // Primary OpenMP message, could be information, warning, or fatal.
|
kmp_mt_mesg =
|
||||||
|
4, // Primary OpenMP message, could be information, warning, or fatal.
|
||||||
kmp_mt_hint = 5, // Hint to the user.
|
kmp_mt_hint = 5, // Hint to the user.
|
||||||
kmp_mt_syserr = -1 // System error message.
|
kmp_mt_syserr = -1 // System error message.
|
||||||
}; // enum kmp_msg_type
|
}; // enum kmp_msg_type
|
||||||
|
|
@ -116,27 +105,29 @@ typedef enum kmp_msg_type kmp_msg_type_t;
|
||||||
struct kmp_msg {
|
struct kmp_msg {
|
||||||
kmp_msg_type_t type;
|
kmp_msg_type_t type;
|
||||||
int num;
|
int num;
|
||||||
char const * str;
|
char const *str;
|
||||||
int len;
|
int len;
|
||||||
}; // struct kmp_message
|
}; // struct kmp_message
|
||||||
typedef struct kmp_msg kmp_msg_t;
|
typedef struct kmp_msg kmp_msg_t;
|
||||||
|
|
||||||
// Two special messages.
|
// Two special messages.
|
||||||
extern kmp_msg_t __kmp_msg_empty; // Can be used in place where message is required syntactically.
|
extern kmp_msg_t __kmp_msg_empty; // Can be used in place where message is
|
||||||
extern kmp_msg_t __kmp_msg_null; // Denotes the end of variadic list of arguments.
|
// required syntactically.
|
||||||
|
extern kmp_msg_t
|
||||||
|
__kmp_msg_null; // Denotes the end of variadic list of arguments.
|
||||||
|
|
||||||
// Helper functions. Creates messages either from message catalog or from system. Note: these
|
// Helper functions. Creates messages either from message catalog or from
|
||||||
// functions allocate memory. You should pass created messages to __kmp_msg() function, it will
|
// system. Note: these functions allocate memory. You should pass created
|
||||||
// print messages and destroy them.
|
// messages to __kmp_msg() function, it will print messages and destroy them.
|
||||||
kmp_msg_t __kmp_msg_format( unsigned id_arg, ... );
|
kmp_msg_t __kmp_msg_format(unsigned id_arg, ...);
|
||||||
kmp_msg_t __kmp_msg_error_code( int code );
|
kmp_msg_t __kmp_msg_error_code(int code);
|
||||||
kmp_msg_t __kmp_msg_error_mesg( char const * mesg );
|
kmp_msg_t __kmp_msg_error_mesg(char const *mesg);
|
||||||
|
|
||||||
// Helper macros to make calls shorter.
|
// Helper macros to make calls shorter.
|
||||||
#define KMP_MSG( ... ) __kmp_msg_format( kmp_i18n_msg_ ## __VA_ARGS__ )
|
#define KMP_MSG(...) __kmp_msg_format(kmp_i18n_msg_##__VA_ARGS__)
|
||||||
#define KMP_HNT( ... ) __kmp_msg_format( kmp_i18n_hnt_ ## __VA_ARGS__ )
|
#define KMP_HNT(...) __kmp_msg_format(kmp_i18n_hnt_##__VA_ARGS__)
|
||||||
#define KMP_SYSERRCODE( code ) __kmp_msg_error_code( code )
|
#define KMP_SYSERRCODE(code) __kmp_msg_error_code(code)
|
||||||
#define KMP_SYSERRMESG( mesg ) __kmp_msg_error_mesg( mesg )
|
#define KMP_SYSERRMESG(mesg) __kmp_msg_error_mesg(mesg)
|
||||||
#define KMP_ERR KMP_SYSERRCODE
|
#define KMP_ERR KMP_SYSERRCODE
|
||||||
|
|
||||||
// Message severity.
|
// Message severity.
|
||||||
|
|
@ -147,45 +138,45 @@ enum kmp_msg_severity {
|
||||||
}; // enum kmp_msg_severity
|
}; // enum kmp_msg_severity
|
||||||
typedef enum kmp_msg_severity kmp_msg_severity_t;
|
typedef enum kmp_msg_severity kmp_msg_severity_t;
|
||||||
|
|
||||||
// Primary function for printing messages for the user. The first message is mandatory. Any number
|
// Primary function for printing messages for the user. The first message is
|
||||||
// of system errors and hints may be specified. Argument list must be finished with __kmp_msg_null.
|
// mandatory. Any number of system errors and hints may be specified. Argument
|
||||||
void __kmp_msg( kmp_msg_severity_t severity, kmp_msg_t message, ... );
|
// list must be finished with __kmp_msg_null.
|
||||||
|
void __kmp_msg(kmp_msg_severity_t severity, kmp_msg_t message, ...);
|
||||||
|
|
||||||
// Helper macros to make calls shorter in simple cases.
|
// Helper macros to make calls shorter in simple cases.
|
||||||
#define KMP_INFORM( ... ) __kmp_msg( kmp_ms_inform, KMP_MSG( __VA_ARGS__ ), __kmp_msg_null )
|
#define KMP_INFORM(...) \
|
||||||
#define KMP_WARNING( ... ) __kmp_msg( kmp_ms_warning, KMP_MSG( __VA_ARGS__ ), __kmp_msg_null )
|
__kmp_msg(kmp_ms_inform, KMP_MSG(__VA_ARGS__), __kmp_msg_null)
|
||||||
#define KMP_FATAL( ... ) __kmp_msg( kmp_ms_fatal, KMP_MSG( __VA_ARGS__ ), __kmp_msg_null )
|
#define KMP_WARNING(...) \
|
||||||
#define KMP_SYSFAIL( func, error ) \
|
__kmp_msg(kmp_ms_warning, KMP_MSG(__VA_ARGS__), __kmp_msg_null)
|
||||||
__kmp_msg( \
|
#define KMP_FATAL(...) \
|
||||||
kmp_ms_fatal, \
|
__kmp_msg(kmp_ms_fatal, KMP_MSG(__VA_ARGS__), __kmp_msg_null)
|
||||||
KMP_MSG( FunctionError, func ), \
|
#define KMP_SYSFAIL(func, error) \
|
||||||
KMP_SYSERRCODE( error ), \
|
__kmp_msg(kmp_ms_fatal, KMP_MSG(FunctionError, func), KMP_SYSERRCODE(error), \
|
||||||
__kmp_msg_null \
|
__kmp_msg_null)
|
||||||
)
|
|
||||||
|
|
||||||
// Check error, if not zero, generate fatal error message.
|
// Check error, if not zero, generate fatal error message.
|
||||||
#define KMP_CHECK_SYSFAIL( func, error ) \
|
#define KMP_CHECK_SYSFAIL(func, error) \
|
||||||
{ \
|
{ \
|
||||||
if ( error ) { \
|
if (error) { \
|
||||||
KMP_SYSFAIL( func, error ); \
|
KMP_SYSFAIL(func, error); \
|
||||||
}; \
|
}; \
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check status, if not zero, generate fatal error message using errno.
|
// Check status, if not zero, generate fatal error message using errno.
|
||||||
#define KMP_CHECK_SYSFAIL_ERRNO( func, status ) \
|
#define KMP_CHECK_SYSFAIL_ERRNO(func, status) \
|
||||||
{ \
|
{ \
|
||||||
if ( status != 0 ) { \
|
if (status != 0) { \
|
||||||
int error = errno; \
|
int error = errno; \
|
||||||
KMP_SYSFAIL( func, error ); \
|
KMP_SYSFAIL(func, error); \
|
||||||
}; \
|
}; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
void __kmp_i18n_dump_catalog( kmp_str_buf_t * buffer );
|
void __kmp_i18n_dump_catalog(kmp_str_buf_t *buffer);
|
||||||
#endif // KMP_DEBUG
|
#endif // KMP_DEBUG
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}; // extern "C"
|
}; // extern "C"
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif // KMP_I18N_H
|
#endif // KMP_I18N_H
|
||||||
|
|
|
||||||
|
|
@ -13,23 +13,17 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Object generated from this source file is linked to Windows* OS DLL import
|
||||||
------------------------------------------------------------------------------------------------
|
library (libompmd.lib) only! It is not a part of regular static or dynamic
|
||||||
Object generated from this source file is linked to Windows* OS DLL import library (libompmd.lib)
|
OpenMP RTL. Any code that just needs to go in the libompmd.lib (but not in
|
||||||
only! It is not a part of regular static or dynamic OpenMP RTL. Any code that just needs to go
|
libompmt.lib and libompmd.dll) should be placed in this file. */
|
||||||
in the libompmd.lib (but not in libompmt.lib and libompmd.dll) should be placed in this
|
|
||||||
file.
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*These symbols are required for mutual exclusion with Microsoft OpenMP RTL
|
||||||
These symbols are required for mutual exclusion with Microsoft OpenMP RTL (and compatibility
|
(and compatibility with MS Compiler). */
|
||||||
with MS Compiler).
|
|
||||||
*/
|
|
||||||
|
|
||||||
int _You_must_link_with_exactly_one_OpenMP_library = 1;
|
int _You_must_link_with_exactly_one_OpenMP_library = 1;
|
||||||
int _You_must_link_with_Intel_OpenMP_library = 1;
|
int _You_must_link_with_Intel_OpenMP_library = 1;
|
||||||
|
|
|
||||||
|
|
@ -13,105 +13,100 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifndef __ABSOFT_WIN
|
#ifndef __ABSOFT_WIN
|
||||||
# include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "kmp_os.h"
|
|
||||||
#include "kmp_lock.h"
|
|
||||||
#include "kmp_str.h"
|
|
||||||
#include "kmp_io.h"
|
|
||||||
#include "kmp.h" // KMP_GTID_DNE, __kmp_debug_buf, etc
|
#include "kmp.h" // KMP_GTID_DNE, __kmp_debug_buf, etc
|
||||||
|
#include "kmp_io.h"
|
||||||
|
#include "kmp_lock.h"
|
||||||
|
#include "kmp_os.h"
|
||||||
|
#include "kmp_str.h"
|
||||||
|
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
# pragma warning( push )
|
#pragma warning(push)
|
||||||
# pragma warning( disable: 271 310 )
|
#pragma warning(disable : 271 310)
|
||||||
# include <windows.h>
|
#include <windows.h>
|
||||||
# pragma warning( pop )
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
kmp_bootstrap_lock_t __kmp_stdio_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_stdio_lock ); /* Control stdio functions */
|
kmp_bootstrap_lock_t __kmp_stdio_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER(
|
||||||
kmp_bootstrap_lock_t __kmp_console_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_console_lock ); /* Control console initialization */
|
__kmp_stdio_lock); /* Control stdio functions */
|
||||||
|
kmp_bootstrap_lock_t __kmp_console_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER(
|
||||||
|
__kmp_console_lock); /* Control console initialization */
|
||||||
|
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
|
|
||||||
# ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
/* __kmp_stdout is used only for dev build */
|
/* __kmp_stdout is used only for dev build */
|
||||||
static HANDLE __kmp_stdout = NULL;
|
static HANDLE __kmp_stdout = NULL;
|
||||||
# endif
|
#endif
|
||||||
static HANDLE __kmp_stderr = NULL;
|
static HANDLE __kmp_stderr = NULL;
|
||||||
static int __kmp_console_exists = FALSE;
|
static int __kmp_console_exists = FALSE;
|
||||||
static kmp_str_buf_t __kmp_console_buf;
|
static kmp_str_buf_t __kmp_console_buf;
|
||||||
|
|
||||||
static int
|
static int is_console(void) {
|
||||||
is_console( void )
|
char buffer[128];
|
||||||
{
|
|
||||||
char buffer[ 128 ];
|
|
||||||
DWORD rc = 0;
|
DWORD rc = 0;
|
||||||
DWORD err = 0;
|
DWORD err = 0;
|
||||||
// Try to get console title.
|
// Try to get console title.
|
||||||
SetLastError( 0 );
|
SetLastError(0);
|
||||||
// GetConsoleTitle does not reset last error in case of success or short buffer,
|
// GetConsoleTitle does not reset last error in case of success or short
|
||||||
// so we need to clear it explicitly.
|
// buffer, so we need to clear it explicitly.
|
||||||
rc = GetConsoleTitle( buffer, sizeof( buffer ) );
|
rc = GetConsoleTitle(buffer, sizeof(buffer));
|
||||||
if ( rc == 0 ) {
|
if (rc == 0) {
|
||||||
// rc == 0 means getting console title failed. Let us find out why.
|
// rc == 0 means getting console title failed. Let us find out why.
|
||||||
err = GetLastError();
|
err = GetLastError();
|
||||||
// err == 0 means buffer too short (we suppose console exists).
|
// err == 0 means buffer too short (we suppose console exists).
|
||||||
// In Window applications we usually have err == 6 (invalid handle).
|
// In Window applications we usually have err == 6 (invalid handle).
|
||||||
}; // if
|
}; // if
|
||||||
return rc > 0 || err == 0;
|
return rc > 0 || err == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void __kmp_close_console(void) {
|
||||||
__kmp_close_console( void )
|
|
||||||
{
|
|
||||||
/* wait until user presses return before closing window */
|
/* wait until user presses return before closing window */
|
||||||
/* TODO only close if a window was opened */
|
/* TODO only close if a window was opened */
|
||||||
if( __kmp_console_exists ) {
|
if (__kmp_console_exists) {
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
/* standard out is used only in dev build */
|
/* standard out is used only in dev build */
|
||||||
__kmp_stdout = NULL;
|
__kmp_stdout = NULL;
|
||||||
#endif
|
#endif
|
||||||
__kmp_stderr = NULL;
|
__kmp_stderr = NULL;
|
||||||
__kmp_str_buf_free( &__kmp_console_buf );
|
__kmp_str_buf_free(&__kmp_console_buf);
|
||||||
__kmp_console_exists = FALSE;
|
__kmp_console_exists = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For windows, call this before stdout, stderr, or stdin are used.
|
/* For windows, call this before stdout, stderr, or stdin are used.
|
||||||
* It opens a console window and starts processing */
|
It opens a console window and starts processing */
|
||||||
static void
|
static void __kmp_redirect_output(void) {
|
||||||
__kmp_redirect_output( void )
|
__kmp_acquire_bootstrap_lock(&__kmp_console_lock);
|
||||||
{
|
|
||||||
__kmp_acquire_bootstrap_lock( &__kmp_console_lock );
|
|
||||||
|
|
||||||
if( ! __kmp_console_exists ) {
|
if (!__kmp_console_exists) {
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
/* standard out is used only in dev build */
|
/* standard out is used only in dev build */
|
||||||
HANDLE ho;
|
HANDLE ho;
|
||||||
#endif
|
#endif
|
||||||
HANDLE he;
|
HANDLE he;
|
||||||
|
|
||||||
__kmp_str_buf_init( &__kmp_console_buf );
|
__kmp_str_buf_init(&__kmp_console_buf);
|
||||||
|
|
||||||
AllocConsole();
|
AllocConsole();
|
||||||
// We do not check the result of AllocConsole because
|
// We do not check the result of AllocConsole because
|
||||||
// 1. the call is harmless
|
// 1. the call is harmless
|
||||||
// 2. it is not clear how to communicate failue
|
// 2. it is not clear how to communicate failue
|
||||||
// 3. we will detect failure later when we get handle(s)
|
// 3. we will detect failure later when we get handle(s)
|
||||||
|
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
ho = GetStdHandle( STD_OUTPUT_HANDLE );
|
ho = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
if ( ho == INVALID_HANDLE_VALUE || ho == NULL ) {
|
if (ho == INVALID_HANDLE_VALUE || ho == NULL) {
|
||||||
|
|
||||||
DWORD err = GetLastError();
|
DWORD err = GetLastError();
|
||||||
// TODO: output error somehow (maybe message box)
|
// TODO: output error somehow (maybe message box)
|
||||||
|
|
@ -120,11 +115,10 @@ kmp_bootstrap_lock_t __kmp_console_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
__kmp_stdout = ho; // temporary code, need new global for ho
|
__kmp_stdout = ho; // temporary code, need new global for ho
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
he = GetStdHandle( STD_ERROR_HANDLE );
|
he = GetStdHandle(STD_ERROR_HANDLE);
|
||||||
if ( he == INVALID_HANDLE_VALUE || he == NULL ) {
|
if (he == INVALID_HANDLE_VALUE || he == NULL) {
|
||||||
|
|
||||||
DWORD err = GetLastError();
|
DWORD err = GetLastError();
|
||||||
// TODO: output error somehow (maybe message box)
|
// TODO: output error somehow (maybe message box)
|
||||||
|
|
@ -136,113 +130,101 @@ kmp_bootstrap_lock_t __kmp_console_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_
|
||||||
}
|
}
|
||||||
__kmp_console_exists = TRUE;
|
__kmp_console_exists = TRUE;
|
||||||
}
|
}
|
||||||
__kmp_release_bootstrap_lock( &__kmp_console_lock );
|
__kmp_release_bootstrap_lock(&__kmp_console_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define __kmp_stderr (stderr)
|
#define __kmp_stderr (stderr)
|
||||||
#endif /* KMP_OS_WINDOWS */
|
#endif /* KMP_OS_WINDOWS */
|
||||||
|
|
||||||
void
|
void __kmp_vprintf(enum kmp_io __kmp_io, char const *format, va_list ap) {
|
||||||
__kmp_vprintf( enum kmp_io __kmp_io, char const * format, va_list ap )
|
#if KMP_OS_WINDOWS
|
||||||
{
|
if (!__kmp_console_exists) {
|
||||||
#if KMP_OS_WINDOWS
|
|
||||||
if( !__kmp_console_exists ) {
|
|
||||||
__kmp_redirect_output();
|
__kmp_redirect_output();
|
||||||
}
|
}
|
||||||
if( ! __kmp_stderr && __kmp_io == kmp_err ) {
|
if (!__kmp_stderr && __kmp_io == kmp_err) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
if( ! __kmp_stdout && __kmp_io == kmp_out ) {
|
if (!__kmp_stdout && __kmp_io == kmp_out) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* KMP_OS_WINDOWS */
|
#endif /* KMP_OS_WINDOWS */
|
||||||
|
|
||||||
if ( __kmp_debug_buf && __kmp_debug_buffer != NULL ) {
|
if (__kmp_debug_buf && __kmp_debug_buffer != NULL) {
|
||||||
|
|
||||||
int dc = ( __kmp_debug_buf_atomic ?
|
int dc = (__kmp_debug_buf_atomic ? KMP_TEST_THEN_INC32(&__kmp_debug_count)
|
||||||
KMP_TEST_THEN_INC32( & __kmp_debug_count) : __kmp_debug_count++ )
|
: __kmp_debug_count++) %
|
||||||
% __kmp_debug_buf_lines;
|
__kmp_debug_buf_lines;
|
||||||
char *db = & __kmp_debug_buffer[ dc * __kmp_debug_buf_chars ];
|
char *db = &__kmp_debug_buffer[dc * __kmp_debug_buf_chars];
|
||||||
int chars = 0;
|
int chars = 0;
|
||||||
|
|
||||||
#ifdef KMP_DEBUG_PIDS
|
#ifdef KMP_DEBUG_PIDS
|
||||||
chars = KMP_SNPRINTF( db, __kmp_debug_buf_chars, "pid=%d: ", (kmp_int32)getpid() );
|
chars = KMP_SNPRINTF(db, __kmp_debug_buf_chars, "pid=%d: ",
|
||||||
#endif
|
(kmp_int32)getpid());
|
||||||
chars += KMP_VSNPRINTF( db, __kmp_debug_buf_chars, format, ap );
|
#endif
|
||||||
|
chars += KMP_VSNPRINTF(db, __kmp_debug_buf_chars, format, ap);
|
||||||
|
|
||||||
if ( chars + 1 > __kmp_debug_buf_chars ) {
|
if (chars + 1 > __kmp_debug_buf_chars) {
|
||||||
if ( chars + 1 > __kmp_debug_buf_warn_chars ) {
|
if (chars + 1 > __kmp_debug_buf_warn_chars) {
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
DWORD count;
|
DWORD count;
|
||||||
__kmp_str_buf_print( &__kmp_console_buf,
|
__kmp_str_buf_print(&__kmp_console_buf, "OMP warning: Debugging buffer "
|
||||||
"OMP warning: Debugging buffer overflow; increase KMP_DEBUG_BUF_CHARS to %d\n",
|
"overflow; increase "
|
||||||
chars + 1 );
|
"KMP_DEBUG_BUF_CHARS to %d\n",
|
||||||
WriteFile( __kmp_stderr, __kmp_console_buf.str, __kmp_console_buf.used, &count, NULL );
|
chars + 1);
|
||||||
__kmp_str_buf_clear( &__kmp_console_buf );
|
WriteFile(__kmp_stderr, __kmp_console_buf.str, __kmp_console_buf.used,
|
||||||
#else
|
&count, NULL);
|
||||||
fprintf( __kmp_stderr,
|
__kmp_str_buf_clear(&__kmp_console_buf);
|
||||||
"OMP warning: Debugging buffer overflow; increase KMP_DEBUG_BUF_CHARS to %d\n",
|
#else
|
||||||
chars + 1 );
|
fprintf(__kmp_stderr, "OMP warning: Debugging buffer overflow; "
|
||||||
fflush( __kmp_stderr );
|
"increase KMP_DEBUG_BUF_CHARS to %d\n",
|
||||||
#endif
|
chars + 1);
|
||||||
|
fflush(__kmp_stderr);
|
||||||
|
#endif
|
||||||
__kmp_debug_buf_warn_chars = chars + 1;
|
__kmp_debug_buf_warn_chars = chars + 1;
|
||||||
}
|
}
|
||||||
/* terminate string if overflow occurred */
|
/* terminate string if overflow occurred */
|
||||||
db[ __kmp_debug_buf_chars - 2 ] = '\n';
|
db[__kmp_debug_buf_chars - 2] = '\n';
|
||||||
db[ __kmp_debug_buf_chars - 1 ] = '\0';
|
db[__kmp_debug_buf_chars - 1] = '\0';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
DWORD count;
|
DWORD count;
|
||||||
#ifdef KMP_DEBUG_PIDS
|
#ifdef KMP_DEBUG_PIDS
|
||||||
__kmp_str_buf_print( &__kmp_console_buf, "pid=%d: ",
|
__kmp_str_buf_print(&__kmp_console_buf, "pid=%d: ", (kmp_int32)getpid());
|
||||||
(kmp_int32)getpid() );
|
#endif
|
||||||
#endif
|
__kmp_str_buf_vprint(&__kmp_console_buf, format, ap);
|
||||||
__kmp_str_buf_vprint( &__kmp_console_buf, format, ap );
|
WriteFile(__kmp_stderr, __kmp_console_buf.str, __kmp_console_buf.used,
|
||||||
WriteFile(
|
&count, NULL);
|
||||||
__kmp_stderr,
|
__kmp_str_buf_clear(&__kmp_console_buf);
|
||||||
__kmp_console_buf.str,
|
#else
|
||||||
__kmp_console_buf.used,
|
#ifdef KMP_DEBUG_PIDS
|
||||||
&count,
|
fprintf(__kmp_stderr, "pid=%d: ", (kmp_int32)getpid());
|
||||||
NULL
|
#endif
|
||||||
);
|
vfprintf(__kmp_stderr, format, ap);
|
||||||
__kmp_str_buf_clear( &__kmp_console_buf );
|
fflush(__kmp_stderr);
|
||||||
#else
|
#endif
|
||||||
#ifdef KMP_DEBUG_PIDS
|
|
||||||
fprintf( __kmp_stderr, "pid=%d: ", (kmp_int32)getpid() );
|
|
||||||
#endif
|
|
||||||
vfprintf( __kmp_stderr, format, ap );
|
|
||||||
fflush( __kmp_stderr );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void __kmp_printf(char const *format, ...) {
|
||||||
__kmp_printf( char const * format, ... )
|
|
||||||
{
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start( ap, format );
|
va_start(ap, format);
|
||||||
|
|
||||||
__kmp_acquire_bootstrap_lock( & __kmp_stdio_lock );
|
__kmp_acquire_bootstrap_lock(&__kmp_stdio_lock);
|
||||||
__kmp_vprintf( kmp_err, format, ap );
|
__kmp_vprintf(kmp_err, format, ap);
|
||||||
__kmp_release_bootstrap_lock( & __kmp_stdio_lock );
|
__kmp_release_bootstrap_lock(&__kmp_stdio_lock);
|
||||||
|
|
||||||
va_end( ap );
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void __kmp_printf_no_lock(char const *format, ...) {
|
||||||
__kmp_printf_no_lock( char const * format, ... )
|
|
||||||
{
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start( ap, format );
|
va_start(ap, format);
|
||||||
|
|
||||||
__kmp_vprintf( kmp_err, format, ap );
|
__kmp_vprintf(kmp_err, format, ap);
|
||||||
|
|
||||||
va_end( ap );
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
|
|
|
||||||
|
|
@ -20,25 +20,21 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
enum kmp_io {
|
enum kmp_io { kmp_out = 0, kmp_err };
|
||||||
kmp_out = 0,
|
|
||||||
kmp_err
|
|
||||||
};
|
|
||||||
|
|
||||||
extern kmp_bootstrap_lock_t __kmp_stdio_lock; /* Control stdio functions */
|
extern kmp_bootstrap_lock_t __kmp_stdio_lock; /* Control stdio functions */
|
||||||
extern kmp_bootstrap_lock_t __kmp_console_lock; /* Control console initialization */
|
extern kmp_bootstrap_lock_t
|
||||||
|
__kmp_console_lock; /* Control console initialization */
|
||||||
|
|
||||||
extern void __kmp_vprintf( enum kmp_io __kmp_io, char const * format, va_list ap );
|
extern void __kmp_vprintf(enum kmp_io __kmp_io, char const *format, va_list ap);
|
||||||
extern void __kmp_printf( char const * format, ... );
|
extern void __kmp_printf(char const *format, ...);
|
||||||
extern void __kmp_printf_no_lock( char const * format, ... );
|
extern void __kmp_printf_no_lock(char const *format, ...);
|
||||||
extern void __kmp_close_console( void );
|
extern void __kmp_close_console(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* KMP_IO_H */
|
#endif /* KMP_IO_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,145 +19,133 @@
|
||||||
#include "kmp_itt.h"
|
#include "kmp_itt.h"
|
||||||
|
|
||||||
#if KMP_DEBUG
|
#if KMP_DEBUG
|
||||||
#include "kmp_itt.inl"
|
#include "kmp_itt.inl"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if USE_ITT_NOTIFY
|
#if USE_ITT_NOTIFY
|
||||||
|
|
||||||
kmp_int32 __kmp_barrier_domain_count;
|
kmp_int32 __kmp_barrier_domain_count;
|
||||||
kmp_int32 __kmp_region_domain_count;
|
kmp_int32 __kmp_region_domain_count;
|
||||||
__itt_domain* __kmp_itt_barrier_domains[KMP_MAX_FRAME_DOMAINS];
|
__itt_domain *__kmp_itt_barrier_domains[KMP_MAX_FRAME_DOMAINS];
|
||||||
__itt_domain* __kmp_itt_region_domains[KMP_MAX_FRAME_DOMAINS];
|
__itt_domain *__kmp_itt_region_domains[KMP_MAX_FRAME_DOMAINS];
|
||||||
__itt_domain* __kmp_itt_imbalance_domains[KMP_MAX_FRAME_DOMAINS];
|
__itt_domain *__kmp_itt_imbalance_domains[KMP_MAX_FRAME_DOMAINS];
|
||||||
kmp_int32 __kmp_itt_region_team_size[KMP_MAX_FRAME_DOMAINS];
|
kmp_int32 __kmp_itt_region_team_size[KMP_MAX_FRAME_DOMAINS];
|
||||||
__itt_domain * metadata_domain = NULL;
|
__itt_domain *metadata_domain = NULL;
|
||||||
__itt_string_handle * string_handle_imbl = NULL;
|
__itt_string_handle *string_handle_imbl = NULL;
|
||||||
__itt_string_handle * string_handle_loop = NULL;
|
__itt_string_handle *string_handle_loop = NULL;
|
||||||
__itt_string_handle * string_handle_sngl = NULL;
|
__itt_string_handle *string_handle_sngl = NULL;
|
||||||
|
|
||||||
#include "kmp_version.h"
|
#include "kmp_i18n.h"
|
||||||
#include "kmp_i18n.h"
|
#include "kmp_str.h"
|
||||||
#include "kmp_str.h"
|
#include "kmp_version.h"
|
||||||
|
|
||||||
KMP_BUILD_ASSERT( sizeof( kmp_itt_mark_t ) == sizeof( __itt_mark_type ) );
|
KMP_BUILD_ASSERT(sizeof(kmp_itt_mark_t) == sizeof(__itt_mark_type));
|
||||||
|
|
||||||
/*
|
/* Previously used warnings:
|
||||||
Previously used warnings:
|
|
||||||
|
|
||||||
KMP_WARNING( IttAllNotifDisabled );
|
KMP_WARNING( IttAllNotifDisabled );
|
||||||
KMP_WARNING( IttObjNotifDisabled );
|
KMP_WARNING( IttObjNotifDisabled );
|
||||||
KMP_WARNING( IttMarkNotifDisabled );
|
KMP_WARNING( IttMarkNotifDisabled );
|
||||||
KMP_WARNING( IttUnloadLibFailed, libittnotify );
|
KMP_WARNING( IttUnloadLibFailed, libittnotify );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
kmp_int32 __kmp_itt_prepare_delay = 0;
|
||||||
kmp_int32 __kmp_itt_prepare_delay = 0;
|
kmp_bootstrap_lock_t __kmp_itt_debug_lock =
|
||||||
kmp_bootstrap_lock_t __kmp_itt_debug_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_itt_debug_lock );
|
KMP_BOOTSTRAP_LOCK_INITIALIZER(__kmp_itt_debug_lock);
|
||||||
|
|
||||||
#endif // USE_ITT_NOTIFY
|
#endif // USE_ITT_NOTIFY
|
||||||
|
|
||||||
void __kmp_itt_initialize() {
|
void __kmp_itt_initialize() {
|
||||||
|
|
||||||
// ITTNotify library is loaded and initialized at first call to any ittnotify function,
|
// ITTNotify library is loaded and initialized at first call to any ittnotify
|
||||||
// so we do not need to explicitly load it any more.
|
// function, so we do not need to explicitly load it any more. Just report OMP
|
||||||
// Jusr report OMP RTL version to ITTNotify.
|
// RTL version to ITTNotify.
|
||||||
|
|
||||||
#if USE_ITT_NOTIFY
|
#if USE_ITT_NOTIFY
|
||||||
// Report OpenMP RTL version.
|
// Report OpenMP RTL version.
|
||||||
kmp_str_buf_t buf;
|
kmp_str_buf_t buf;
|
||||||
__itt_mark_type version;
|
__itt_mark_type version;
|
||||||
__kmp_str_buf_init( & buf );
|
__kmp_str_buf_init(&buf);
|
||||||
__kmp_str_buf_print(
|
__kmp_str_buf_print(&buf, "OMP RTL Version %d.%d.%d", __kmp_version_major,
|
||||||
& buf,
|
__kmp_version_minor, __kmp_version_build);
|
||||||
"OMP RTL Version %d.%d.%d",
|
if (__itt_api_version_ptr != NULL) {
|
||||||
__kmp_version_major,
|
__kmp_str_buf_print(&buf, ":%s", __itt_api_version());
|
||||||
__kmp_version_minor,
|
|
||||||
__kmp_version_build
|
|
||||||
);
|
|
||||||
if ( __itt_api_version_ptr != NULL ) {
|
|
||||||
__kmp_str_buf_print( & buf, ":%s", __itt_api_version() );
|
|
||||||
}; // if
|
}; // if
|
||||||
version = __itt_mark_create( buf.str );
|
version = __itt_mark_create(buf.str);
|
||||||
__itt_mark( version, NULL );
|
__itt_mark(version, NULL);
|
||||||
__kmp_str_buf_free( & buf );
|
__kmp_str_buf_free(&buf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // __kmp_itt_initialize
|
} // __kmp_itt_initialize
|
||||||
|
|
||||||
|
|
||||||
void __kmp_itt_destroy() {
|
void __kmp_itt_destroy() {
|
||||||
#if USE_ITT_NOTIFY
|
#if USE_ITT_NOTIFY
|
||||||
__kmp_itt_fini_ittlib();
|
__kmp_itt_fini_ittlib();
|
||||||
#endif
|
#endif
|
||||||
} // __kmp_itt_destroy
|
} // __kmp_itt_destroy
|
||||||
|
|
||||||
|
extern "C" void __itt_error_handler(__itt_error_code err, va_list args) {
|
||||||
|
|
||||||
extern "C"
|
switch (err) {
|
||||||
void
|
case __itt_error_no_module: {
|
||||||
__itt_error_handler(
|
char const *library = va_arg(args, char const *);
|
||||||
__itt_error_code err,
|
|
||||||
va_list args
|
|
||||||
) {
|
|
||||||
|
|
||||||
switch ( err ) {
|
|
||||||
case __itt_error_no_module : {
|
|
||||||
char const * library = va_arg( args, char const * );
|
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
int sys_err = va_arg( args, int );
|
int sys_err = va_arg(args, int);
|
||||||
kmp_msg_t err_code = KMP_SYSERRCODE( sys_err );
|
kmp_msg_t err_code = KMP_SYSERRCODE(sys_err);
|
||||||
__kmp_msg( kmp_ms_warning, KMP_MSG( IttLoadLibFailed, library ), err_code, __kmp_msg_null );
|
__kmp_msg(kmp_ms_warning, KMP_MSG(IttLoadLibFailed, library), err_code,
|
||||||
|
__kmp_msg_null);
|
||||||
if (__kmp_generate_warnings == kmp_warnings_off) {
|
if (__kmp_generate_warnings == kmp_warnings_off) {
|
||||||
__kmp_str_free(&err_code.str);
|
__kmp_str_free(&err_code.str);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
char const * sys_err = va_arg( args, char const * );
|
char const *sys_err = va_arg(args, char const *);
|
||||||
kmp_msg_t err_code = KMP_SYSERRMESG( sys_err );
|
kmp_msg_t err_code = KMP_SYSERRMESG(sys_err);
|
||||||
__kmp_msg( kmp_ms_warning, KMP_MSG( IttLoadLibFailed, library ), err_code, __kmp_msg_null );
|
__kmp_msg(kmp_ms_warning, KMP_MSG(IttLoadLibFailed, library), err_code,
|
||||||
|
__kmp_msg_null);
|
||||||
if (__kmp_generate_warnings == kmp_warnings_off) {
|
if (__kmp_generate_warnings == kmp_warnings_off) {
|
||||||
__kmp_str_free(&err_code.str);
|
__kmp_str_free(&err_code.str);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} break;
|
} break;
|
||||||
case __itt_error_no_symbol : {
|
case __itt_error_no_symbol: {
|
||||||
char const * library = va_arg( args, char const * );
|
char const *library = va_arg(args, char const *);
|
||||||
char const * symbol = va_arg( args, char const * );
|
char const *symbol = va_arg(args, char const *);
|
||||||
KMP_WARNING( IttLookupFailed, symbol, library );
|
KMP_WARNING(IttLookupFailed, symbol, library);
|
||||||
} break;
|
} break;
|
||||||
case __itt_error_unknown_group : {
|
case __itt_error_unknown_group: {
|
||||||
char const * var = va_arg( args, char const * );
|
char const *var = va_arg(args, char const *);
|
||||||
char const * group = va_arg( args, char const * );
|
char const *group = va_arg(args, char const *);
|
||||||
KMP_WARNING( IttUnknownGroup, var, group );
|
KMP_WARNING(IttUnknownGroup, var, group);
|
||||||
} break;
|
} break;
|
||||||
case __itt_error_env_too_long : {
|
case __itt_error_env_too_long: {
|
||||||
char const * var = va_arg( args, char const * );
|
char const *var = va_arg(args, char const *);
|
||||||
size_t act_len = va_arg( args, size_t );
|
size_t act_len = va_arg(args, size_t);
|
||||||
size_t max_len = va_arg( args, size_t );
|
size_t max_len = va_arg(args, size_t);
|
||||||
KMP_WARNING( IttEnvVarTooLong, var, (unsigned long) act_len, (unsigned long) max_len );
|
KMP_WARNING(IttEnvVarTooLong, var, (unsigned long)act_len,
|
||||||
|
(unsigned long)max_len);
|
||||||
} break;
|
} break;
|
||||||
case __itt_error_cant_read_env : {
|
case __itt_error_cant_read_env: {
|
||||||
char const * var = va_arg( args, char const * );
|
char const *var = va_arg(args, char const *);
|
||||||
int sys_err = va_arg( args, int );
|
int sys_err = va_arg(args, int);
|
||||||
kmp_msg_t err_code = KMP_ERR( sys_err );
|
kmp_msg_t err_code = KMP_ERR(sys_err);
|
||||||
__kmp_msg( kmp_ms_warning, KMP_MSG( CantGetEnvVar, var ), err_code, __kmp_msg_null );
|
__kmp_msg(kmp_ms_warning, KMP_MSG(CantGetEnvVar, var), err_code,
|
||||||
|
__kmp_msg_null);
|
||||||
if (__kmp_generate_warnings == kmp_warnings_off) {
|
if (__kmp_generate_warnings == kmp_warnings_off) {
|
||||||
__kmp_str_free(&err_code.str);
|
__kmp_str_free(&err_code.str);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case __itt_error_system : {
|
case __itt_error_system: {
|
||||||
char const * func = va_arg( args, char const * );
|
char const *func = va_arg(args, char const *);
|
||||||
int sys_err = va_arg( args, int );
|
int sys_err = va_arg(args, int);
|
||||||
kmp_msg_t err_code = KMP_SYSERRCODE( sys_err );
|
kmp_msg_t err_code = KMP_SYSERRCODE(sys_err);
|
||||||
__kmp_msg( kmp_ms_warning, KMP_MSG( IttFunctionError, func ), err_code, __kmp_msg_null );
|
__kmp_msg(kmp_ms_warning, KMP_MSG(IttFunctionError, func), err_code,
|
||||||
|
__kmp_msg_null);
|
||||||
if (__kmp_generate_warnings == kmp_warnings_off) {
|
if (__kmp_generate_warnings == kmp_warnings_off) {
|
||||||
__kmp_str_free(&err_code.str);
|
__kmp_str_free(&err_code.str);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
default : {
|
default: { KMP_WARNING(IttUnknownError, err); };
|
||||||
KMP_WARNING( IttUnknownError, err );
|
|
||||||
};
|
|
||||||
}; // switch
|
}; // switch
|
||||||
|
|
||||||
} // __itt_error_handler
|
} // __itt_error_handler
|
||||||
|
|
||||||
#endif /* USE_ITT_BUILD */
|
#endif /* USE_ITT_BUILD */
|
||||||
|
|
|
||||||
|
|
@ -24,104 +24,121 @@
|
||||||
#include "legacy/ittnotify.h"
|
#include "legacy/ittnotify.h"
|
||||||
|
|
||||||
#if KMP_DEBUG
|
#if KMP_DEBUG
|
||||||
#define __kmp_inline // Turn off inlining in debug mode.
|
#define __kmp_inline // Turn off inlining in debug mode.
|
||||||
#else
|
#else
|
||||||
#define __kmp_inline static inline
|
#define __kmp_inline static inline
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USE_ITT_NOTIFY
|
#if USE_ITT_NOTIFY
|
||||||
extern kmp_int32 __kmp_itt_prepare_delay;
|
extern kmp_int32 __kmp_itt_prepare_delay;
|
||||||
# ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" void __kmp_itt_fini_ittlib(void);
|
extern "C" void __kmp_itt_fini_ittlib(void);
|
||||||
# else
|
#else
|
||||||
extern void __kmp_itt_fini_ittlib(void);
|
extern void __kmp_itt_fini_ittlib(void);
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Simplify the handling of an argument that is only required when USE_ITT_BUILD is enabled.
|
// Simplify the handling of an argument that is only required when USE_ITT_BUILD
|
||||||
#define USE_ITT_BUILD_ARG(x) ,x
|
// is enabled.
|
||||||
|
#define USE_ITT_BUILD_ARG(x) , x
|
||||||
|
|
||||||
void __kmp_itt_initialize();
|
void __kmp_itt_initialize();
|
||||||
void __kmp_itt_destroy();
|
void __kmp_itt_destroy();
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// New stuff for reporting high-level constructs.
|
// New stuff for reporting high-level constructs.
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Note the naming convention:
|
// Note the naming convention:
|
||||||
// __kmp_itt_xxxing() function should be called before action, while
|
// __kmp_itt_xxxing() function should be called before action, while
|
||||||
// __kmp_itt_xxxed() function should be called after action.
|
// __kmp_itt_xxxed() function should be called after action.
|
||||||
|
|
||||||
// --- Parallel region reporting ---
|
// --- Parallel region reporting ---
|
||||||
__kmp_inline void __kmp_itt_region_forking( int gtid, int team_size, int barriers ); // Master only, before forking threads.
|
__kmp_inline void
|
||||||
__kmp_inline void __kmp_itt_region_joined( int gtid ); // Master only, after joining threads.
|
__kmp_itt_region_forking(int gtid, int team_size,
|
||||||
// (*) Note: A thread may execute tasks after this point, though.
|
int barriers); // Master only, before forking threads.
|
||||||
|
__kmp_inline void
|
||||||
|
__kmp_itt_region_joined(int gtid); // Master only, after joining threads.
|
||||||
|
// (*) Note: A thread may execute tasks after this point, though.
|
||||||
|
|
||||||
// --- Frame reporting ---
|
// --- Frame reporting ---
|
||||||
// region = 0 - no regions, region = 1 - parallel, region = 2 - serialized parallel
|
// region=0: no regions, region=1: parallel, region=2: serialized parallel
|
||||||
__kmp_inline void __kmp_itt_frame_submit( int gtid, __itt_timestamp begin, __itt_timestamp end, int imbalance, ident_t *loc, int team_size, int region = 0 );
|
__kmp_inline void __kmp_itt_frame_submit(int gtid, __itt_timestamp begin,
|
||||||
|
__itt_timestamp end, int imbalance,
|
||||||
|
ident_t *loc, int team_size,
|
||||||
|
int region = 0);
|
||||||
|
|
||||||
// --- Metadata reporting ---
|
// --- Metadata reporting ---
|
||||||
// begin/end - begin/end timestamps of a barrier frame, imbalance - aggregated wait time value, reduction -if this is a reduction barrier
|
// begin/end - begin/end timestamps of a barrier frame, imbalance - aggregated
|
||||||
__kmp_inline void __kmp_itt_metadata_imbalance( int gtid, kmp_uint64 begin, kmp_uint64 end, kmp_uint64 imbalance, kmp_uint64 reduction );
|
// wait time value, reduction -if this is a reduction barrier
|
||||||
// sched_type: 0 - static, 1 - dynamic, 2 - guided, 3 - custom (all others); iterations - loop trip count, chunk - chunk size
|
__kmp_inline void __kmp_itt_metadata_imbalance(int gtid, kmp_uint64 begin,
|
||||||
__kmp_inline void __kmp_itt_metadata_loop( ident_t * loc, kmp_uint64 sched_type, kmp_uint64 iterations, kmp_uint64 chunk );
|
kmp_uint64 end,
|
||||||
__kmp_inline void __kmp_itt_metadata_single( ident_t * loc );
|
kmp_uint64 imbalance,
|
||||||
|
kmp_uint64 reduction);
|
||||||
|
// sched_type: 0 - static, 1 - dynamic, 2 - guided, 3 - custom (all others);
|
||||||
|
// iterations - loop trip count, chunk - chunk size
|
||||||
|
__kmp_inline void __kmp_itt_metadata_loop(ident_t *loc, kmp_uint64 sched_type,
|
||||||
|
kmp_uint64 iterations,
|
||||||
|
kmp_uint64 chunk);
|
||||||
|
__kmp_inline void __kmp_itt_metadata_single(ident_t *loc);
|
||||||
|
|
||||||
// --- Barrier reporting ---
|
// --- Barrier reporting ---
|
||||||
__kmp_inline void * __kmp_itt_barrier_object( int gtid, int bt, int set_name = 0, int delta = 0 );
|
__kmp_inline void *__kmp_itt_barrier_object(int gtid, int bt, int set_name = 0,
|
||||||
__kmp_inline void __kmp_itt_barrier_starting( int gtid, void * object );
|
int delta = 0);
|
||||||
__kmp_inline void __kmp_itt_barrier_middle( int gtid, void * object );
|
__kmp_inline void __kmp_itt_barrier_starting(int gtid, void *object);
|
||||||
__kmp_inline void __kmp_itt_barrier_finished( int gtid, void * object );
|
__kmp_inline void __kmp_itt_barrier_middle(int gtid, void *object);
|
||||||
|
__kmp_inline void __kmp_itt_barrier_finished(int gtid, void *object);
|
||||||
|
|
||||||
// --- Taskwait reporting ---
|
// --- Taskwait reporting ---
|
||||||
__kmp_inline void * __kmp_itt_taskwait_object( int gtid );
|
__kmp_inline void *__kmp_itt_taskwait_object(int gtid);
|
||||||
__kmp_inline void __kmp_itt_taskwait_starting( int gtid, void * object );
|
__kmp_inline void __kmp_itt_taskwait_starting(int gtid, void *object);
|
||||||
__kmp_inline void __kmp_itt_taskwait_finished( int gtid, void * object );
|
__kmp_inline void __kmp_itt_taskwait_finished(int gtid, void *object);
|
||||||
|
|
||||||
// --- Task reporting ---
|
// --- Task reporting ---
|
||||||
__kmp_inline void __kmp_itt_task_starting( void * object );
|
__kmp_inline void __kmp_itt_task_starting(void *object);
|
||||||
__kmp_inline void __kmp_itt_task_finished( void * object );
|
__kmp_inline void __kmp_itt_task_finished(void *object);
|
||||||
|
|
||||||
// --- Lock reporting ---
|
// --- Lock reporting ---
|
||||||
#if KMP_USE_DYNAMIC_LOCK
|
#if KMP_USE_DYNAMIC_LOCK
|
||||||
__kmp_inline void __kmp_itt_lock_creating( kmp_user_lock_p lock, const ident_t * );
|
__kmp_inline void __kmp_itt_lock_creating(kmp_user_lock_p lock,
|
||||||
|
const ident_t *);
|
||||||
#else
|
#else
|
||||||
__kmp_inline void __kmp_itt_lock_creating( kmp_user_lock_p lock );
|
__kmp_inline void __kmp_itt_lock_creating(kmp_user_lock_p lock);
|
||||||
#endif
|
#endif
|
||||||
__kmp_inline void __kmp_itt_lock_acquiring( kmp_user_lock_p lock );
|
__kmp_inline void __kmp_itt_lock_acquiring(kmp_user_lock_p lock);
|
||||||
__kmp_inline void __kmp_itt_lock_acquired( kmp_user_lock_p lock );
|
__kmp_inline void __kmp_itt_lock_acquired(kmp_user_lock_p lock);
|
||||||
__kmp_inline void __kmp_itt_lock_releasing( kmp_user_lock_p lock );
|
__kmp_inline void __kmp_itt_lock_releasing(kmp_user_lock_p lock);
|
||||||
__kmp_inline void __kmp_itt_lock_cancelled( kmp_user_lock_p lock );
|
__kmp_inline void __kmp_itt_lock_cancelled(kmp_user_lock_p lock);
|
||||||
__kmp_inline void __kmp_itt_lock_destroyed( kmp_user_lock_p lock );
|
__kmp_inline void __kmp_itt_lock_destroyed(kmp_user_lock_p lock);
|
||||||
|
|
||||||
// --- Critical reporting ---
|
// --- Critical reporting ---
|
||||||
#if KMP_USE_DYNAMIC_LOCK
|
#if KMP_USE_DYNAMIC_LOCK
|
||||||
__kmp_inline void __kmp_itt_critical_creating( kmp_user_lock_p lock, const ident_t * );
|
__kmp_inline void __kmp_itt_critical_creating(kmp_user_lock_p lock,
|
||||||
|
const ident_t *);
|
||||||
#else
|
#else
|
||||||
__kmp_inline void __kmp_itt_critical_creating( kmp_user_lock_p lock );
|
__kmp_inline void __kmp_itt_critical_creating(kmp_user_lock_p lock);
|
||||||
#endif
|
#endif
|
||||||
__kmp_inline void __kmp_itt_critical_acquiring( kmp_user_lock_p lock );
|
__kmp_inline void __kmp_itt_critical_acquiring(kmp_user_lock_p lock);
|
||||||
__kmp_inline void __kmp_itt_critical_acquired( kmp_user_lock_p lock );
|
__kmp_inline void __kmp_itt_critical_acquired(kmp_user_lock_p lock);
|
||||||
__kmp_inline void __kmp_itt_critical_releasing( kmp_user_lock_p lock );
|
__kmp_inline void __kmp_itt_critical_releasing(kmp_user_lock_p lock);
|
||||||
__kmp_inline void __kmp_itt_critical_destroyed( kmp_user_lock_p lock );
|
__kmp_inline void __kmp_itt_critical_destroyed(kmp_user_lock_p lock);
|
||||||
|
|
||||||
// --- Single reporting ---
|
// --- Single reporting ---
|
||||||
__kmp_inline void __kmp_itt_single_start( int gtid );
|
__kmp_inline void __kmp_itt_single_start(int gtid);
|
||||||
__kmp_inline void __kmp_itt_single_end( int gtid );
|
__kmp_inline void __kmp_itt_single_end(int gtid);
|
||||||
|
|
||||||
// --- Ordered reporting ---
|
// --- Ordered reporting ---
|
||||||
__kmp_inline void __kmp_itt_ordered_init( int gtid );
|
__kmp_inline void __kmp_itt_ordered_init(int gtid);
|
||||||
__kmp_inline void __kmp_itt_ordered_prep( int gtid );
|
__kmp_inline void __kmp_itt_ordered_prep(int gtid);
|
||||||
__kmp_inline void __kmp_itt_ordered_start( int gtid );
|
__kmp_inline void __kmp_itt_ordered_start(int gtid);
|
||||||
__kmp_inline void __kmp_itt_ordered_end( int gtid );
|
__kmp_inline void __kmp_itt_ordered_end(int gtid);
|
||||||
|
|
||||||
// --- Threads reporting ---
|
// --- Threads reporting ---
|
||||||
__kmp_inline void __kmp_itt_thread_ignore();
|
__kmp_inline void __kmp_itt_thread_ignore();
|
||||||
__kmp_inline void __kmp_itt_thread_name( int gtid );
|
__kmp_inline void __kmp_itt_thread_name(int gtid);
|
||||||
|
|
||||||
// --- System objects ---
|
// --- System objects ---
|
||||||
__kmp_inline void __kmp_itt_system_object_created( void * object, char const * name );
|
__kmp_inline void __kmp_itt_system_object_created(void *object,
|
||||||
|
char const *name);
|
||||||
|
|
||||||
// --- Stack stitching ---
|
// --- Stack stitching ---
|
||||||
__kmp_inline __itt_caller __kmp_itt_stack_caller_create(void);
|
__kmp_inline __itt_caller __kmp_itt_stack_caller_create(void);
|
||||||
|
|
@ -129,164 +146,166 @@ __kmp_inline void __kmp_itt_stack_caller_destroy(__itt_caller);
|
||||||
__kmp_inline void __kmp_itt_stack_callee_enter(__itt_caller);
|
__kmp_inline void __kmp_itt_stack_callee_enter(__itt_caller);
|
||||||
__kmp_inline void __kmp_itt_stack_callee_leave(__itt_caller);
|
__kmp_inline void __kmp_itt_stack_callee_leave(__itt_caller);
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Old stuff for reporting low-level internal synchronization.
|
// Old stuff for reporting low-level internal synchronization.
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#if USE_ITT_NOTIFY
|
#if USE_ITT_NOTIFY
|
||||||
|
|
||||||
/*
|
/* Support for SSC marks, which are used by SDE
|
||||||
* Support for SSC marks, which are used by SDE
|
http://software.intel.com/en-us/articles/intel-software-development-emulator
|
||||||
* http://software.intel.com/en-us/articles/intel-software-development-emulator
|
to mark points in instruction traces that represent spin-loops and are
|
||||||
* to mark points in instruction traces that represent spin-loops and are
|
therefore uninteresting when collecting traces for architecture simulation.
|
||||||
* therefore uninteresting when collecting traces for architecture simulation.
|
|
||||||
*/
|
*/
|
||||||
#ifndef INCLUDE_SSC_MARKS
|
#ifndef INCLUDE_SSC_MARKS
|
||||||
# define INCLUDE_SSC_MARKS (KMP_OS_LINUX && KMP_ARCH_X86_64)
|
#define INCLUDE_SSC_MARKS (KMP_OS_LINUX && KMP_ARCH_X86_64)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Linux 64 only for now */
|
/* Linux 64 only for now */
|
||||||
#if (INCLUDE_SSC_MARKS && KMP_OS_LINUX && KMP_ARCH_X86_64)
|
#if (INCLUDE_SSC_MARKS && KMP_OS_LINUX && KMP_ARCH_X86_64)
|
||||||
// Portable (at least for gcc and icc) code to insert the necessary instructions
|
// Portable (at least for gcc and icc) code to insert the necessary instructions
|
||||||
// to set %ebx and execute the unlikely no-op.
|
// to set %ebx and execute the unlikely no-op.
|
||||||
#if defined( __INTEL_COMPILER )
|
#if defined(__INTEL_COMPILER)
|
||||||
# define INSERT_SSC_MARK(tag) __SSC_MARK(tag)
|
#define INSERT_SSC_MARK(tag) __SSC_MARK(tag)
|
||||||
#else
|
#else
|
||||||
# define INSERT_SSC_MARK(tag) \
|
#define INSERT_SSC_MARK(tag) \
|
||||||
__asm__ __volatile__ ("movl %0, %%ebx; .byte 0x64, 0x67, 0x90 " ::"i"(tag):"%ebx")
|
__asm__ __volatile__("movl %0, %%ebx; .byte 0x64, 0x67, 0x90 " ::"i"(tag) \
|
||||||
#endif
|
: "%ebx")
|
||||||
#else
|
#endif
|
||||||
# define INSERT_SSC_MARK(tag) ((void)0)
|
#else
|
||||||
#endif
|
#define INSERT_SSC_MARK(tag) ((void)0)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Markers for the start and end of regions that represent polling and
|
/* Markers for the start and end of regions that represent polling and are
|
||||||
* are therefore uninteresting to architectural simulations 0x4376 and
|
therefore uninteresting to architectural simulations 0x4376 and 0x4377 are
|
||||||
* 0x4377 are arbitrary numbers that should be unique in the space of
|
arbitrary numbers that should be unique in the space of SSC tags, but there
|
||||||
* SSC tags, but there is no central issuing authority rather
|
is no central issuing authority rather randomness is expected to work. */
|
||||||
* randomness is expected to work.
|
#define SSC_MARK_SPIN_START() INSERT_SSC_MARK(0x4376)
|
||||||
*/
|
#define SSC_MARK_SPIN_END() INSERT_SSC_MARK(0x4377)
|
||||||
#define SSC_MARK_SPIN_START() INSERT_SSC_MARK(0x4376)
|
|
||||||
#define SSC_MARK_SPIN_END() INSERT_SSC_MARK(0x4377)
|
|
||||||
|
|
||||||
// Markers for architecture simulation.
|
// Markers for architecture simulation.
|
||||||
// FORKING : Before the master thread forks.
|
// FORKING : Before the master thread forks.
|
||||||
// JOINING : At the start of the join.
|
// JOINING : At the start of the join.
|
||||||
// INVOKING : Before the threads invoke microtasks.
|
// INVOKING : Before the threads invoke microtasks.
|
||||||
// DISPATCH_INIT: At the start of dynamically scheduled loop.
|
// DISPATCH_INIT: At the start of dynamically scheduled loop.
|
||||||
// DISPATCH_NEXT: After claming next iteration of dynamically scheduled loop.
|
// DISPATCH_NEXT: After claming next iteration of dynamically scheduled loop.
|
||||||
#define SSC_MARK_FORKING() INSERT_SSC_MARK(0xd693)
|
#define SSC_MARK_FORKING() INSERT_SSC_MARK(0xd693)
|
||||||
#define SSC_MARK_JOINING() INSERT_SSC_MARK(0xd694)
|
#define SSC_MARK_JOINING() INSERT_SSC_MARK(0xd694)
|
||||||
#define SSC_MARK_INVOKING() INSERT_SSC_MARK(0xd695)
|
#define SSC_MARK_INVOKING() INSERT_SSC_MARK(0xd695)
|
||||||
#define SSC_MARK_DISPATCH_INIT() INSERT_SSC_MARK(0xd696)
|
#define SSC_MARK_DISPATCH_INIT() INSERT_SSC_MARK(0xd696)
|
||||||
#define SSC_MARK_DISPATCH_NEXT() INSERT_SSC_MARK(0xd697)
|
#define SSC_MARK_DISPATCH_NEXT() INSERT_SSC_MARK(0xd697)
|
||||||
|
|
||||||
// The object is an address that associates a specific set of the prepare, acquire, release,
|
// The object is an address that associates a specific set of the prepare,
|
||||||
// and cancel operations.
|
// acquire, release, and cancel operations.
|
||||||
|
|
||||||
/* Sync prepare indicates a thread is going to start waiting for another thread
|
/* Sync prepare indicates a thread is going to start waiting for another thread
|
||||||
to send a release event. This operation should be done just before the thread
|
to send a release event. This operation should be done just before the
|
||||||
begins checking for the existence of the release event */
|
thread begins checking for the existence of the release event */
|
||||||
|
|
||||||
/* Sync cancel indicates a thread is cancelling a wait on another thread anc
|
/* Sync cancel indicates a thread is cancelling a wait on another thread and
|
||||||
continuing execution without waiting for the other thread to release it */
|
continuing execution without waiting for the other thread to release it */
|
||||||
|
|
||||||
/* Sync acquired indicates a thread has received a release event from another
|
/* Sync acquired indicates a thread has received a release event from another
|
||||||
thread and has stopped waiting. This operation must occur only after the release
|
thread and has stopped waiting. This operation must occur only after the
|
||||||
event is received. */
|
release event is received. */
|
||||||
|
|
||||||
/* Sync release indicates a thread is going to send a release event to another thread
|
/* Sync release indicates a thread is going to send a release event to another
|
||||||
so it will stop waiting and continue execution. This operation must just happen before
|
thread so it will stop waiting and continue execution. This operation must
|
||||||
the release event. */
|
just happen before the release event. */
|
||||||
|
|
||||||
#define KMP_FSYNC_PREPARE( obj ) __itt_fsync_prepare( (void *)( obj ) )
|
#define KMP_FSYNC_PREPARE(obj) __itt_fsync_prepare((void *)(obj))
|
||||||
#define KMP_FSYNC_CANCEL( obj ) __itt_fsync_cancel( (void *)( obj ) )
|
#define KMP_FSYNC_CANCEL(obj) __itt_fsync_cancel((void *)(obj))
|
||||||
#define KMP_FSYNC_ACQUIRED( obj ) __itt_fsync_acquired( (void *)( obj ) )
|
#define KMP_FSYNC_ACQUIRED(obj) __itt_fsync_acquired((void *)(obj))
|
||||||
#define KMP_FSYNC_RELEASING( obj ) __itt_fsync_releasing( (void *)( obj ) )
|
#define KMP_FSYNC_RELEASING(obj) __itt_fsync_releasing((void *)(obj))
|
||||||
|
|
||||||
/*
|
/* In case of waiting in a spin loop, ITT wants KMP_FSYNC_PREPARE() to be called
|
||||||
In case of waiting in a spin loop, ITT wants KMP_FSYNC_PREPARE() to be called with a delay
|
with a delay (and not called at all if waiting time is small). So, in spin
|
||||||
(and not called at all if waiting time is small). So, in spin loops, do not use
|
loops, do not use KMP_FSYNC_PREPARE(), but use KMP_FSYNC_SPIN_INIT() (before
|
||||||
KMP_FSYNC_PREPARE(), but use KMP_FSYNC_SPIN_INIT() (before spin loop),
|
spin loop), KMP_FSYNC_SPIN_PREPARE() (whithin the spin loop), and
|
||||||
KMP_FSYNC_SPIN_PREPARE() (whithin the spin loop), and KMP_FSYNC_SPIN_ACQUIRED().
|
KMP_FSYNC_SPIN_ACQUIRED(). See KMP_WAIT_YIELD() for example. */
|
||||||
See KMP_WAIT_YIELD() for example.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#undef KMP_FSYNC_SPIN_INIT
|
#undef KMP_FSYNC_SPIN_INIT
|
||||||
#define KMP_FSYNC_SPIN_INIT( obj, spin ) \
|
#define KMP_FSYNC_SPIN_INIT(obj, spin) \
|
||||||
int sync_iters = 0; \
|
int sync_iters = 0; \
|
||||||
if ( __itt_fsync_prepare_ptr ) { \
|
if (__itt_fsync_prepare_ptr) { \
|
||||||
if ( obj == NULL ) { \
|
if (obj == NULL) { \
|
||||||
obj = spin; \
|
obj = spin; \
|
||||||
} /* if */ \
|
} /* if */ \
|
||||||
} /* if */ \
|
} /* if */ \
|
||||||
SSC_MARK_SPIN_START()
|
SSC_MARK_SPIN_START()
|
||||||
|
|
||||||
#undef KMP_FSYNC_SPIN_PREPARE
|
#undef KMP_FSYNC_SPIN_PREPARE
|
||||||
#define KMP_FSYNC_SPIN_PREPARE( obj ) do { \
|
#define KMP_FSYNC_SPIN_PREPARE(obj) \
|
||||||
if ( __itt_fsync_prepare_ptr && sync_iters < __kmp_itt_prepare_delay ) { \
|
do { \
|
||||||
++ sync_iters; \
|
if (__itt_fsync_prepare_ptr && sync_iters < __kmp_itt_prepare_delay) { \
|
||||||
if ( sync_iters >= __kmp_itt_prepare_delay ) { \
|
++sync_iters; \
|
||||||
KMP_FSYNC_PREPARE( (void*) obj ); \
|
if (sync_iters >= __kmp_itt_prepare_delay) { \
|
||||||
|
KMP_FSYNC_PREPARE((void *)obj); \
|
||||||
} /* if */ \
|
} /* if */ \
|
||||||
} /* if */ \
|
} /* if */ \
|
||||||
} while (0)
|
} while (0)
|
||||||
#undef KMP_FSYNC_SPIN_ACQUIRED
|
#undef KMP_FSYNC_SPIN_ACQUIRED
|
||||||
#define KMP_FSYNC_SPIN_ACQUIRED( obj ) do { \
|
#define KMP_FSYNC_SPIN_ACQUIRED(obj) \
|
||||||
|
do { \
|
||||||
SSC_MARK_SPIN_END(); \
|
SSC_MARK_SPIN_END(); \
|
||||||
if ( sync_iters >= __kmp_itt_prepare_delay ) { \
|
if (sync_iters >= __kmp_itt_prepare_delay) { \
|
||||||
KMP_FSYNC_ACQUIRED( (void*) obj ); \
|
KMP_FSYNC_ACQUIRED((void *)obj); \
|
||||||
} /* if */ \
|
} /* if */ \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* ITT will not report objects created within KMP_ITT_IGNORE(), e. g.:
|
/* ITT will not report objects created within KMP_ITT_IGNORE(), e. g.:
|
||||||
KMP_ITT_IGNORE(
|
KMP_ITT_IGNORE(
|
||||||
ptr = malloc( size );
|
ptr = malloc( size );
|
||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
#define KMP_ITT_IGNORE( statement ) do { \
|
#define KMP_ITT_IGNORE(statement) \
|
||||||
|
do { \
|
||||||
__itt_state_t __itt_state_; \
|
__itt_state_t __itt_state_; \
|
||||||
if ( __itt_state_get_ptr ) { \
|
if (__itt_state_get_ptr) { \
|
||||||
__itt_state_ = __itt_state_get(); \
|
__itt_state_ = __itt_state_get(); \
|
||||||
__itt_obj_mode_set( __itt_obj_prop_ignore, __itt_obj_state_set ); \
|
__itt_obj_mode_set(__itt_obj_prop_ignore, __itt_obj_state_set); \
|
||||||
} /* if */ \
|
} /* if */ \
|
||||||
{ statement } \
|
{ statement } \
|
||||||
if ( __itt_state_get_ptr ) { \
|
if (__itt_state_get_ptr) { \
|
||||||
__itt_state_set( __itt_state_ ); \
|
__itt_state_set(__itt_state_); \
|
||||||
} /* if */ \
|
} /* if */ \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
const int KMP_MAX_FRAME_DOMAINS = 512; // Maximum number of frame domains to use (maps to
|
const int KMP_MAX_FRAME_DOMAINS =
|
||||||
// different OpenMP regions in the user source code).
|
512; // Maximum number of frame domains to use (maps to
|
||||||
extern kmp_int32 __kmp_barrier_domain_count;
|
// different OpenMP regions in the user source code).
|
||||||
extern kmp_int32 __kmp_region_domain_count;
|
extern kmp_int32 __kmp_barrier_domain_count;
|
||||||
extern __itt_domain* __kmp_itt_barrier_domains[KMP_MAX_FRAME_DOMAINS];
|
extern kmp_int32 __kmp_region_domain_count;
|
||||||
extern __itt_domain* __kmp_itt_region_domains[KMP_MAX_FRAME_DOMAINS];
|
extern __itt_domain *__kmp_itt_barrier_domains[KMP_MAX_FRAME_DOMAINS];
|
||||||
extern __itt_domain* __kmp_itt_imbalance_domains[KMP_MAX_FRAME_DOMAINS];
|
extern __itt_domain *__kmp_itt_region_domains[KMP_MAX_FRAME_DOMAINS];
|
||||||
extern kmp_int32 __kmp_itt_region_team_size[KMP_MAX_FRAME_DOMAINS];
|
extern __itt_domain *__kmp_itt_imbalance_domains[KMP_MAX_FRAME_DOMAINS];
|
||||||
extern __itt_domain * metadata_domain;
|
extern kmp_int32 __kmp_itt_region_team_size[KMP_MAX_FRAME_DOMAINS];
|
||||||
extern __itt_string_handle * string_handle_imbl;
|
extern __itt_domain *metadata_domain;
|
||||||
extern __itt_string_handle * string_handle_loop;
|
extern __itt_string_handle *string_handle_imbl;
|
||||||
extern __itt_string_handle * string_handle_sngl;
|
extern __itt_string_handle *string_handle_loop;
|
||||||
|
extern __itt_string_handle *string_handle_sngl;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Null definitions of the synchronization tracing functions.
|
// Null definitions of the synchronization tracing functions.
|
||||||
# define KMP_FSYNC_PREPARE( obj ) ((void)0)
|
#define KMP_FSYNC_PREPARE(obj) ((void)0)
|
||||||
# define KMP_FSYNC_CANCEL( obj ) ((void)0)
|
#define KMP_FSYNC_CANCEL(obj) ((void)0)
|
||||||
# define KMP_FSYNC_ACQUIRED( obj ) ((void)0)
|
#define KMP_FSYNC_ACQUIRED(obj) ((void)0)
|
||||||
# define KMP_FSYNC_RELEASING( obj ) ((void)0)
|
#define KMP_FSYNC_RELEASING(obj) ((void)0)
|
||||||
|
|
||||||
# define KMP_FSYNC_SPIN_INIT( obj, spin ) ((void)0)
|
#define KMP_FSYNC_SPIN_INIT(obj, spin) ((void)0)
|
||||||
# define KMP_FSYNC_SPIN_PREPARE( obj ) ((void)0)
|
#define KMP_FSYNC_SPIN_PREPARE(obj) ((void)0)
|
||||||
# define KMP_FSYNC_SPIN_ACQUIRED( obj ) ((void)0)
|
#define KMP_FSYNC_SPIN_ACQUIRED(obj) ((void)0)
|
||||||
|
|
||||||
# define KMP_ITT_IGNORE(stmt ) do { stmt } while (0)
|
#define KMP_ITT_IGNORE(stmt) \
|
||||||
|
do { \
|
||||||
|
stmt \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#endif // USE_ITT_NOTIFY
|
#endif // USE_ITT_NOTIFY
|
||||||
|
|
||||||
#if ! KMP_DEBUG
|
#if !KMP_DEBUG
|
||||||
// In release mode include definitions of inline functions.
|
// In release mode include definitions of inline functions.
|
||||||
#include "kmp_itt.inl"
|
#include "kmp_itt.inl"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // KMP_ITT_H
|
#endif // KMP_ITT_H
|
||||||
|
|
@ -296,17 +315,20 @@ __kmp_inline void __kmp_itt_stack_callee_leave(__itt_caller);
|
||||||
// Null definitions of the synchronization tracing functions.
|
// Null definitions of the synchronization tracing functions.
|
||||||
// If USE_ITT_BULID is not enabled, USE_ITT_NOTIFY cannot be either.
|
// If USE_ITT_BULID is not enabled, USE_ITT_NOTIFY cannot be either.
|
||||||
// By defining these we avoid unpleasant ifdef tests in many places.
|
// By defining these we avoid unpleasant ifdef tests in many places.
|
||||||
# define KMP_FSYNC_PREPARE( obj ) ((void)0)
|
#define KMP_FSYNC_PREPARE(obj) ((void)0)
|
||||||
# define KMP_FSYNC_CANCEL( obj ) ((void)0)
|
#define KMP_FSYNC_CANCEL(obj) ((void)0)
|
||||||
# define KMP_FSYNC_ACQUIRED( obj ) ((void)0)
|
#define KMP_FSYNC_ACQUIRED(obj) ((void)0)
|
||||||
# define KMP_FSYNC_RELEASING( obj ) ((void)0)
|
#define KMP_FSYNC_RELEASING(obj) ((void)0)
|
||||||
|
|
||||||
# define KMP_FSYNC_SPIN_INIT( obj, spin ) ((void)0)
|
#define KMP_FSYNC_SPIN_INIT(obj, spin) ((void)0)
|
||||||
# define KMP_FSYNC_SPIN_PREPARE( obj ) ((void)0)
|
#define KMP_FSYNC_SPIN_PREPARE(obj) ((void)0)
|
||||||
# define KMP_FSYNC_SPIN_ACQUIRED( obj ) ((void)0)
|
#define KMP_FSYNC_SPIN_ACQUIRED(obj) ((void)0)
|
||||||
|
|
||||||
# define KMP_ITT_IGNORE(stmt ) do { stmt } while (0)
|
#define KMP_ITT_IGNORE(stmt) \
|
||||||
|
do { \
|
||||||
|
stmt \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
# define USE_ITT_BUILD_ARG(x)
|
#define USE_ITT_BUILD_ARG(x)
|
||||||
|
|
||||||
#endif /* USE_ITT_BUILD */
|
#endif /* USE_ITT_BUILD */
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -16,19 +16,16 @@
|
||||||
|
|
||||||
|
|
||||||
/* THIS FILE SHOULD NOT BE MODIFIED IN IDB INTERFACE LIBRARY CODE
|
/* THIS FILE SHOULD NOT BE MODIFIED IN IDB INTERFACE LIBRARY CODE
|
||||||
* It should instead be modified in the OpenMP runtime and copied
|
It should instead be modified in the OpenMP runtime and copied to the
|
||||||
* to the interface library code. This way we can minimize the
|
interface library code. This way we can minimize the problems that this is
|
||||||
* problems that this is sure to cause having two copies of the
|
sure to cause having two copies of the same file.
|
||||||
* same file.
|
|
||||||
*
|
Files live in libomp and libomp_db/src/include */
|
||||||
* files live in libomp and libomp_db/src/include
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* CHANGE THIS WHEN STRUCTURES BELOW CHANGE
|
/* CHANGE THIS WHEN STRUCTURES BELOW CHANGE
|
||||||
* Before we release this to a customer, please don't change this value. After it is released and
|
Before we release this to a customer, please don't change this value. After
|
||||||
* stable, then any new updates to the structures or data structure traversal algorithms need to
|
it is released and stable, then any new updates to the structures or data
|
||||||
* change this value.
|
structure traversal algorithms need to change this value. */
|
||||||
*/
|
|
||||||
#define KMP_OMP_VERSION 9
|
#define KMP_OMP_VERSION 9
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -44,7 +41,8 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
kmp_uint64 flags; // Flags for future extensions.
|
kmp_uint64 flags; // Flags for future extensions.
|
||||||
kmp_uint64 file; // Pointer to name of source file where the parallel region is.
|
kmp_uint64
|
||||||
|
file; // Pointer to name of source file where the parallel region is.
|
||||||
kmp_uint64 func; // Pointer to name of routine where the parallel region is.
|
kmp_uint64 func; // Pointer to name of routine where the parallel region is.
|
||||||
kmp_int32 begin; // Beginning of source line range.
|
kmp_int32 begin; // Beginning of source line range.
|
||||||
kmp_int32 end; // End of source line range.
|
kmp_int32 end; // End of source line range.
|
||||||
|
|
@ -56,7 +54,6 @@ typedef struct {
|
||||||
kmp_uint64 array; // Address of array of kmp_omp_num_threads_item_t.
|
kmp_uint64 array; // Address of array of kmp_omp_num_threads_item_t.
|
||||||
} kmp_omp_nthr_info_t;
|
} kmp_omp_nthr_info_t;
|
||||||
|
|
||||||
|
|
||||||
/* This structure is known to the idb interface library */
|
/* This structure is known to the idb interface library */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
|
|
@ -80,7 +77,7 @@ typedef struct {
|
||||||
addr_and_size_t roots; // Pointer to __kmp_root.
|
addr_and_size_t roots; // Pointer to __kmp_root.
|
||||||
addr_and_size_t capacity; // Pointer to __kmp_threads_capacity.
|
addr_and_size_t capacity; // Pointer to __kmp_threads_capacity.
|
||||||
addr_and_size_t monitor; // Pointer to __kmp_monitor.
|
addr_and_size_t monitor; // Pointer to __kmp_monitor.
|
||||||
#if ! KMP_USE_DYNAMIC_LOCK
|
#if !KMP_USE_DYNAMIC_LOCK
|
||||||
addr_and_size_t lock_table; // Pointer to __kmp_lock_table.
|
addr_and_size_t lock_table; // Pointer to __kmp_lock_table.
|
||||||
#endif
|
#endif
|
||||||
addr_and_size_t func_microtask;
|
addr_and_size_t func_microtask;
|
||||||
|
|
@ -102,19 +99,23 @@ typedef struct {
|
||||||
offset_and_size_t th_serial_team; // serial team under this thread
|
offset_and_size_t th_serial_team; // serial team under this thread
|
||||||
offset_and_size_t th_ident; // location for this thread (if available)
|
offset_and_size_t th_ident; // location for this thread (if available)
|
||||||
offset_and_size_t th_spin_here; // is thread waiting for lock (if available)
|
offset_and_size_t th_spin_here; // is thread waiting for lock (if available)
|
||||||
offset_and_size_t th_next_waiting; // next thread waiting for lock (if available)
|
offset_and_size_t
|
||||||
|
th_next_waiting; // next thread waiting for lock (if available)
|
||||||
offset_and_size_t th_task_team; // task team struct
|
offset_and_size_t th_task_team; // task team struct
|
||||||
offset_and_size_t th_current_task; // innermost task being executed
|
offset_and_size_t th_current_task; // innermost task being executed
|
||||||
offset_and_size_t th_task_state; // alternating 0/1 for task team identification
|
offset_and_size_t
|
||||||
|
th_task_state; // alternating 0/1 for task team identification
|
||||||
offset_and_size_t th_bar;
|
offset_and_size_t th_bar;
|
||||||
offset_and_size_t th_b_worker_arrived; // the worker increases it by 1 when it arrives to the barrier
|
offset_and_size_t th_b_worker_arrived; // the worker increases it by 1 when it
|
||||||
|
// arrives to the barrier
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
/* teams information */
|
/* teams information */
|
||||||
offset_and_size_t th_teams_microtask;// entry address for teams construct
|
offset_and_size_t th_teams_microtask; // entry address for teams construct
|
||||||
offset_and_size_t th_teams_level; // initial level of teams construct
|
offset_and_size_t th_teams_level; // initial level of teams construct
|
||||||
offset_and_size_t th_teams_nteams; // number of teams in a league
|
offset_and_size_t th_teams_nteams; // number of teams in a league
|
||||||
offset_and_size_t th_teams_nth; // number of threads in each team of the league
|
offset_and_size_t
|
||||||
|
th_teams_nth; // number of threads in each team of the league
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* kmp_desc structure (for info field above) */
|
/* kmp_desc structure (for info field above) */
|
||||||
|
|
@ -139,8 +140,10 @@ typedef struct {
|
||||||
offset_and_size_t t_cancel_request;
|
offset_and_size_t t_cancel_request;
|
||||||
#endif
|
#endif
|
||||||
offset_and_size_t t_bar;
|
offset_and_size_t t_bar;
|
||||||
offset_and_size_t t_b_master_arrived; // increased by 1 when master arrives to a barrier
|
offset_and_size_t
|
||||||
offset_and_size_t t_b_team_arrived; // increased by one when all the threads arrived
|
t_b_master_arrived; // increased by 1 when master arrives to a barrier
|
||||||
|
offset_and_size_t
|
||||||
|
t_b_team_arrived; // increased by one when all the threads arrived
|
||||||
|
|
||||||
/* root structure information */
|
/* root structure information */
|
||||||
kmp_int32 r_sizeof_struct;
|
kmp_int32 r_sizeof_struct;
|
||||||
|
|
@ -151,7 +154,8 @@ typedef struct {
|
||||||
|
|
||||||
/* ident structure information */
|
/* ident structure information */
|
||||||
kmp_int32 id_sizeof_struct;
|
kmp_int32 id_sizeof_struct;
|
||||||
offset_and_size_t id_psource; /* address of string ";file;func;line1;line2;;". */
|
offset_and_size_t
|
||||||
|
id_psource; /* address of string ";file;func;line1;line2;;". */
|
||||||
offset_and_size_t id_flags;
|
offset_and_size_t id_flags;
|
||||||
|
|
||||||
/* lock structure information */
|
/* lock structure information */
|
||||||
|
|
@ -166,7 +170,7 @@ typedef struct {
|
||||||
offset_and_size_t lk_depth_locked;
|
offset_and_size_t lk_depth_locked;
|
||||||
offset_and_size_t lk_lock_flags;
|
offset_and_size_t lk_lock_flags;
|
||||||
|
|
||||||
#if ! KMP_USE_DYNAMIC_LOCK
|
#if !KMP_USE_DYNAMIC_LOCK
|
||||||
/* lock_table_t */
|
/* lock_table_t */
|
||||||
kmp_int32 lt_size_of_struct; /* Size and layout of kmp_lock_table_t. */
|
kmp_int32 lt_size_of_struct; /* Size and layout of kmp_lock_table_t. */
|
||||||
offset_and_size_t lt_used;
|
offset_and_size_t lt_used;
|
||||||
|
|
@ -190,22 +194,26 @@ typedef struct {
|
||||||
offset_and_size_t td_parent; // parent task
|
offset_and_size_t td_parent; // parent task
|
||||||
offset_and_size_t td_level; // task testing level
|
offset_and_size_t td_level; // task testing level
|
||||||
offset_and_size_t td_ident; // task identifier
|
offset_and_size_t td_ident; // task identifier
|
||||||
offset_and_size_t td_allocated_child_tasks; // child tasks (+ current task) not yet deallocated
|
offset_and_size_t td_allocated_child_tasks; // child tasks (+ current task)
|
||||||
|
// not yet deallocated
|
||||||
offset_and_size_t td_incomplete_child_tasks; // child tasks not yet complete
|
offset_and_size_t td_incomplete_child_tasks; // child tasks not yet complete
|
||||||
|
|
||||||
/* Taskwait */
|
/* Taskwait */
|
||||||
offset_and_size_t td_taskwait_ident;
|
offset_and_size_t td_taskwait_ident;
|
||||||
offset_and_size_t td_taskwait_counter;
|
offset_and_size_t td_taskwait_counter;
|
||||||
offset_and_size_t td_taskwait_thread; // gtid + 1 of thread encountered taskwait
|
offset_and_size_t
|
||||||
|
td_taskwait_thread; // gtid + 1 of thread encountered taskwait
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
/* Taskgroup */
|
/* Taskgroup */
|
||||||
offset_and_size_t td_taskgroup; // pointer to the current taskgroup
|
offset_and_size_t td_taskgroup; // pointer to the current taskgroup
|
||||||
offset_and_size_t td_task_count; // number of allocated and not yet complete tasks
|
offset_and_size_t
|
||||||
|
td_task_count; // number of allocated and not yet complete tasks
|
||||||
offset_and_size_t td_cancel; // request for cancellation of this taskgroup
|
offset_and_size_t td_cancel; // request for cancellation of this taskgroup
|
||||||
|
|
||||||
/* Task dependency */
|
/* Task dependency */
|
||||||
offset_and_size_t td_depnode; // pointer to graph node if the task has dependencies
|
offset_and_size_t
|
||||||
|
td_depnode; // pointer to graph node if the task has dependencies
|
||||||
offset_and_size_t dn_node;
|
offset_and_size_t dn_node;
|
||||||
offset_and_size_t dn_next;
|
offset_and_size_t dn_next;
|
||||||
offset_and_size_t dn_successors;
|
offset_and_size_t dn_successors;
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,6 +2,7 @@
|
||||||
* kmp_platform.h -- header for determining operating system and architecture
|
* kmp_platform.h -- header for determining operating system and architecture
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
|
|
@ -11,6 +12,7 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
|
||||||
#ifndef KMP_PLATFORM_H
|
#ifndef KMP_PLATFORM_H
|
||||||
#define KMP_PLATFORM_H
|
#define KMP_PLATFORM_H
|
||||||
|
|
||||||
|
|
@ -24,49 +26,50 @@
|
||||||
#define KMP_OS_CNK 0
|
#define KMP_OS_CNK 0
|
||||||
#define KMP_OS_UNIX 0 /* disjunction of KMP_OS_LINUX, KMP_OS_DARWIN etc. */
|
#define KMP_OS_UNIX 0 /* disjunction of KMP_OS_LINUX, KMP_OS_DARWIN etc. */
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# undef KMP_OS_WINDOWS
|
#undef KMP_OS_WINDOWS
|
||||||
# define KMP_OS_WINDOWS 1
|
#define KMP_OS_WINDOWS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ( defined __APPLE__ && defined __MACH__ )
|
#if (defined __APPLE__ && defined __MACH__)
|
||||||
# undef KMP_OS_DARWIN
|
#undef KMP_OS_DARWIN
|
||||||
# define KMP_OS_DARWIN 1
|
#define KMP_OS_DARWIN 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// in some ppc64 linux installations, only the second condition is met
|
// in some ppc64 linux installations, only the second condition is met
|
||||||
#if ( defined __linux )
|
#if (defined __linux)
|
||||||
# undef KMP_OS_LINUX
|
#undef KMP_OS_LINUX
|
||||||
# define KMP_OS_LINUX 1
|
#define KMP_OS_LINUX 1
|
||||||
#elif ( defined __linux__)
|
#elif (defined __linux__)
|
||||||
# undef KMP_OS_LINUX
|
#undef KMP_OS_LINUX
|
||||||
# define KMP_OS_LINUX 1
|
#define KMP_OS_LINUX 1
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ( defined __FreeBSD__ )
|
#if (defined __FreeBSD__)
|
||||||
# undef KMP_OS_FREEBSD
|
#undef KMP_OS_FREEBSD
|
||||||
# define KMP_OS_FREEBSD 1
|
#define KMP_OS_FREEBSD 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ( defined __NetBSD__ )
|
#if (defined __NetBSD__)
|
||||||
# undef KMP_OS_NETBSD
|
#undef KMP_OS_NETBSD
|
||||||
# define KMP_OS_NETBSD 1
|
#define KMP_OS_NETBSD 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ( defined __bgq__ )
|
#if (defined __bgq__)
|
||||||
# undef KMP_OS_CNK
|
#undef KMP_OS_CNK
|
||||||
# define KMP_OS_CNK 1
|
#define KMP_OS_CNK 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (1 != KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_NETBSD + KMP_OS_DARWIN + KMP_OS_WINDOWS)
|
#if (1 != \
|
||||||
# error Unknown OS
|
KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_NETBSD + KMP_OS_DARWIN + \
|
||||||
|
KMP_OS_WINDOWS)
|
||||||
|
#error Unknown OS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DARWIN
|
#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DARWIN
|
||||||
# undef KMP_OS_UNIX
|
#undef KMP_OS_UNIX
|
||||||
# define KMP_OS_UNIX 1
|
#define KMP_OS_UNIX 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ---------------------- Architecture recognition ------------------- */
|
/* ---------------------- Architecture recognition ------------------- */
|
||||||
|
|
@ -81,101 +84,103 @@
|
||||||
#define KMP_ARCH_MIPS64 0
|
#define KMP_ARCH_MIPS64 0
|
||||||
|
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
# if defined _M_AMD64
|
#if defined _M_AMD64
|
||||||
# undef KMP_ARCH_X86_64
|
#undef KMP_ARCH_X86_64
|
||||||
# define KMP_ARCH_X86_64 1
|
#define KMP_ARCH_X86_64 1
|
||||||
# else
|
#else
|
||||||
# undef KMP_ARCH_X86
|
#undef KMP_ARCH_X86
|
||||||
# define KMP_ARCH_X86 1
|
#define KMP_ARCH_X86 1
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if KMP_OS_UNIX
|
#if KMP_OS_UNIX
|
||||||
# if defined __x86_64
|
#if defined __x86_64
|
||||||
# undef KMP_ARCH_X86_64
|
#undef KMP_ARCH_X86_64
|
||||||
# define KMP_ARCH_X86_64 1
|
#define KMP_ARCH_X86_64 1
|
||||||
# elif defined __i386
|
#elif defined __i386
|
||||||
# undef KMP_ARCH_X86
|
#undef KMP_ARCH_X86
|
||||||
# define KMP_ARCH_X86 1
|
#define KMP_ARCH_X86 1
|
||||||
# elif defined __powerpc64__
|
#elif defined __powerpc64__
|
||||||
# if defined __LITTLE_ENDIAN__
|
#if defined __LITTLE_ENDIAN__
|
||||||
# undef KMP_ARCH_PPC64_LE
|
#undef KMP_ARCH_PPC64_LE
|
||||||
# define KMP_ARCH_PPC64_LE 1
|
#define KMP_ARCH_PPC64_LE 1
|
||||||
# else
|
#else
|
||||||
# undef KMP_ARCH_PPC64_BE
|
#undef KMP_ARCH_PPC64_BE
|
||||||
# define KMP_ARCH_PPC64_BE 1
|
#define KMP_ARCH_PPC64_BE 1
|
||||||
# endif
|
#endif
|
||||||
# elif defined __aarch64__
|
#elif defined __aarch64__
|
||||||
# undef KMP_ARCH_AARCH64
|
#undef KMP_ARCH_AARCH64
|
||||||
# define KMP_ARCH_AARCH64 1
|
#define KMP_ARCH_AARCH64 1
|
||||||
# elif defined __mips__
|
#elif defined __mips__
|
||||||
# if defined __mips64
|
#if defined __mips64
|
||||||
# undef KMP_ARCH_MIPS64
|
#undef KMP_ARCH_MIPS64
|
||||||
# define KMP_ARCH_MIPS64 1
|
#define KMP_ARCH_MIPS64 1
|
||||||
# else
|
#else
|
||||||
# undef KMP_ARCH_MIPS
|
#undef KMP_ARCH_MIPS
|
||||||
# define KMP_ARCH_MIPS 1
|
#define KMP_ARCH_MIPS 1
|
||||||
# endif
|
#endif
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7R__) || \
|
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7R__) || \
|
||||||
defined(__ARM_ARCH_7A__)
|
defined(__ARM_ARCH_7A__)
|
||||||
# define KMP_ARCH_ARMV7 1
|
#define KMP_ARCH_ARMV7 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(KMP_ARCH_ARMV7) || defined(__ARM_ARCH_6__) || \
|
#if defined(KMP_ARCH_ARMV7) || defined(__ARM_ARCH_6__) || \
|
||||||
defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || \
|
defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || \
|
||||||
defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6T2__) || \
|
defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6T2__) || \
|
||||||
defined(__ARM_ARCH_6ZK__)
|
defined(__ARM_ARCH_6ZK__)
|
||||||
# define KMP_ARCH_ARMV6 1
|
#define KMP_ARCH_ARMV6 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(KMP_ARCH_ARMV6) || defined(__ARM_ARCH_5T__) || \
|
#if defined(KMP_ARCH_ARMV6) || defined(__ARM_ARCH_5T__) || \
|
||||||
defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) || \
|
defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) || \
|
||||||
defined(__ARM_ARCH_5TEJ__)
|
defined(__ARM_ARCH_5TEJ__)
|
||||||
# define KMP_ARCH_ARMV5 1
|
#define KMP_ARCH_ARMV5 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(KMP_ARCH_ARMV5) || defined(__ARM_ARCH_4__) || \
|
#if defined(KMP_ARCH_ARMV5) || defined(__ARM_ARCH_4__) || \
|
||||||
defined(__ARM_ARCH_4T__)
|
defined(__ARM_ARCH_4T__)
|
||||||
# define KMP_ARCH_ARMV4 1
|
#define KMP_ARCH_ARMV4 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(KMP_ARCH_ARMV4) || defined(__ARM_ARCH_3__) || \
|
#if defined(KMP_ARCH_ARMV4) || defined(__ARM_ARCH_3__) || \
|
||||||
defined(__ARM_ARCH_3M__)
|
defined(__ARM_ARCH_3M__)
|
||||||
# define KMP_ARCH_ARMV3 1
|
#define KMP_ARCH_ARMV3 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(KMP_ARCH_ARMV3) || defined(__ARM_ARCH_2__)
|
#if defined(KMP_ARCH_ARMV3) || defined(__ARM_ARCH_2__)
|
||||||
# define KMP_ARCH_ARMV2 1
|
#define KMP_ARCH_ARMV2 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(KMP_ARCH_ARMV2)
|
#if defined(KMP_ARCH_ARMV2)
|
||||||
# define KMP_ARCH_ARM 1
|
#define KMP_ARCH_ARM 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__MIC__) || defined(__MIC2__)
|
#if defined(__MIC__) || defined(__MIC2__)
|
||||||
# define KMP_MIC 1
|
#define KMP_MIC 1
|
||||||
# if __MIC2__ || __KNC__
|
#if __MIC2__ || __KNC__
|
||||||
# define KMP_MIC1 0
|
#define KMP_MIC1 0
|
||||||
# define KMP_MIC2 1
|
#define KMP_MIC2 1
|
||||||
# else
|
|
||||||
# define KMP_MIC1 1
|
|
||||||
# define KMP_MIC2 0
|
|
||||||
# endif
|
|
||||||
#else
|
#else
|
||||||
# define KMP_MIC 0
|
#define KMP_MIC1 1
|
||||||
# define KMP_MIC1 0
|
#define KMP_MIC2 0
|
||||||
# define KMP_MIC2 0
|
#endif
|
||||||
|
#else
|
||||||
|
#define KMP_MIC 0
|
||||||
|
#define KMP_MIC1 0
|
||||||
|
#define KMP_MIC2 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Specify 32 bit architectures here */
|
/* Specify 32 bit architectures here */
|
||||||
#define KMP_32_BIT_ARCH (KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS)
|
#define KMP_32_BIT_ARCH (KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS)
|
||||||
|
|
||||||
// TODO: Fixme - This is clever, but really fugly
|
// TODO: Fixme - This is clever, but really fugly
|
||||||
#if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64 + KMP_ARCH_AARCH64 + KMP_ARCH_MIPS + KMP_ARCH_MIPS64)
|
#if (1 != \
|
||||||
# error Unknown or unsupported architecture
|
KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64 + \
|
||||||
|
KMP_ARCH_AARCH64 + KMP_ARCH_MIPS + KMP_ARCH_MIPS64)
|
||||||
|
#error Unknown or unsupported architecture
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // KMP_PLATFORM_H
|
#endif // KMP_PLATFORM_H
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -12,50 +12,49 @@
|
||||||
#ifndef KMP_SAFE_C_API_H
|
#ifndef KMP_SAFE_C_API_H
|
||||||
#define KMP_SAFE_C_API_H
|
#define KMP_SAFE_C_API_H
|
||||||
|
|
||||||
//
|
|
||||||
// Replacement for banned C API
|
// Replacement for banned C API
|
||||||
//
|
|
||||||
|
|
||||||
// Not every unsafe call listed here is handled now, but keeping everything
|
// Not every unsafe call listed here is handled now, but keeping everything
|
||||||
// in one place should be handy for future maintenance.
|
// in one place should be handy for future maintenance.
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
|
|
||||||
# define RSIZE_MAX_STR ( 4UL << 10 ) // 4KB
|
#define RSIZE_MAX_STR (4UL << 10) // 4KB
|
||||||
|
|
||||||
// _malloca was suggested, but it is not a drop-in replacement for _alloca
|
// _malloca was suggested, but it is not a drop-in replacement for _alloca
|
||||||
# define KMP_ALLOCA _alloca
|
#define KMP_ALLOCA _alloca
|
||||||
|
|
||||||
# define KMP_MEMCPY_S memcpy_s
|
#define KMP_MEMCPY_S memcpy_s
|
||||||
# define KMP_SNPRINTF sprintf_s
|
#define KMP_SNPRINTF sprintf_s
|
||||||
# define KMP_SSCANF sscanf_s
|
#define KMP_SSCANF sscanf_s
|
||||||
# define KMP_STRCPY_S strcpy_s
|
#define KMP_STRCPY_S strcpy_s
|
||||||
# define KMP_STRNCPY_S strncpy_s
|
#define KMP_STRNCPY_S strncpy_s
|
||||||
|
|
||||||
// Use this only when buffer size is unknown
|
// Use this only when buffer size is unknown
|
||||||
# define KMP_MEMCPY(dst, src, cnt) memcpy_s(dst, cnt, src, cnt)
|
#define KMP_MEMCPY(dst, src, cnt) memcpy_s(dst, cnt, src, cnt)
|
||||||
|
|
||||||
# define KMP_STRLEN(str) strnlen_s(str, RSIZE_MAX_STR)
|
#define KMP_STRLEN(str) strnlen_s(str, RSIZE_MAX_STR)
|
||||||
|
|
||||||
// Use this only when buffer size is unknown
|
// Use this only when buffer size is unknown
|
||||||
# define KMP_STRNCPY(dst, src, cnt) strncpy_s(dst, cnt, src, cnt)
|
#define KMP_STRNCPY(dst, src, cnt) strncpy_s(dst, cnt, src, cnt)
|
||||||
|
|
||||||
// _TRUNCATE insures buffer size > max string to print.
|
// _TRUNCATE insures buffer size > max string to print.
|
||||||
# define KMP_VSNPRINTF(dst, cnt, fmt, arg) vsnprintf_s(dst, cnt, _TRUNCATE, fmt, arg)
|
#define KMP_VSNPRINTF(dst, cnt, fmt, arg) \
|
||||||
|
vsnprintf_s(dst, cnt, _TRUNCATE, fmt, arg)
|
||||||
|
|
||||||
#else // KMP_OS_WINDOWS
|
#else // KMP_OS_WINDOWS
|
||||||
|
|
||||||
// For now, these macros use the existing API.
|
// For now, these macros use the existing API.
|
||||||
|
|
||||||
# define KMP_ALLOCA alloca
|
#define KMP_ALLOCA alloca
|
||||||
# define KMP_MEMCPY_S(dst, bsz, src, cnt) memcpy(dst, src, cnt)
|
#define KMP_MEMCPY_S(dst, bsz, src, cnt) memcpy(dst, src, cnt)
|
||||||
# define KMP_SNPRINTF snprintf
|
#define KMP_SNPRINTF snprintf
|
||||||
# define KMP_SSCANF sscanf
|
#define KMP_SSCANF sscanf
|
||||||
# define KMP_STRCPY_S(dst, bsz, src) strcpy(dst, src)
|
#define KMP_STRCPY_S(dst, bsz, src) strcpy(dst, src)
|
||||||
# define KMP_STRNCPY_S(dst, bsz, src, cnt) strncpy(dst, src, cnt)
|
#define KMP_STRNCPY_S(dst, bsz, src, cnt) strncpy(dst, src, cnt)
|
||||||
# define KMP_VSNPRINTF vsnprintf
|
#define KMP_VSNPRINTF vsnprintf
|
||||||
# define KMP_STRNCPY strncpy
|
#define KMP_STRNCPY strncpy
|
||||||
# define KMP_STRLEN strlen
|
#define KMP_STRLEN strlen
|
||||||
# define KMP_MEMCPY memcpy
|
#define KMP_MEMCPY memcpy
|
||||||
|
|
||||||
#endif // KMP_OS_WINDOWS
|
#endif // KMP_OS_WINDOWS
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -16,35 +16,52 @@
|
||||||
#ifndef KMP_SETTINGS_H
|
#ifndef KMP_SETTINGS_H
|
||||||
#define KMP_SETTINGS_H
|
#define KMP_SETTINGS_H
|
||||||
|
|
||||||
void __kmp_reset_global_vars( void );
|
void __kmp_reset_global_vars(void);
|
||||||
void __kmp_env_initialize( char const * );
|
void __kmp_env_initialize(char const *);
|
||||||
void __kmp_env_print();
|
void __kmp_env_print();
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
void __kmp_env_print_2();
|
void __kmp_env_print_2();
|
||||||
#endif // OMP_40_ENABLED
|
#endif // OMP_40_ENABLED
|
||||||
|
|
||||||
int __kmp_initial_threads_capacity( int req_nproc );
|
int __kmp_initial_threads_capacity(int req_nproc);
|
||||||
void __kmp_init_dflt_team_nth();
|
void __kmp_init_dflt_team_nth();
|
||||||
int __kmp_convert_to_milliseconds( char const * );
|
int __kmp_convert_to_milliseconds(char const *);
|
||||||
int __kmp_default_tp_capacity( int, int, int);
|
int __kmp_default_tp_capacity(int, int, int);
|
||||||
|
|
||||||
#if KMP_MIC
|
#if KMP_MIC
|
||||||
#define KMP_STR_BUF_PRINT_NAME __kmp_str_buf_print( buffer, " %s %s", KMP_I18N_STR(Device), name )
|
#define KMP_STR_BUF_PRINT_NAME \
|
||||||
#define KMP_STR_BUF_PRINT_NAME_EX(x) __kmp_str_buf_print( buffer, " %s %s='", KMP_I18N_STR(Device), x )
|
__kmp_str_buf_print(buffer, " %s %s", KMP_I18N_STR(Device), name)
|
||||||
#define KMP_STR_BUF_PRINT_BOOL __kmp_str_buf_print( buffer, " %s %s='%s'\n", KMP_I18N_STR(Device), name, value ? "TRUE" : "FALSE" );
|
#define KMP_STR_BUF_PRINT_NAME_EX(x) \
|
||||||
#define KMP_STR_BUF_PRINT_INT __kmp_str_buf_print( buffer, " %s %s='%d'\n", KMP_I18N_STR(Device), name, value )
|
__kmp_str_buf_print(buffer, " %s %s='", KMP_I18N_STR(Device), x)
|
||||||
#define KMP_STR_BUF_PRINT_UINT64 __kmp_str_buf_print( buffer, " %s %s='%" KMP_UINT64_SPEC "'\n", KMP_I18N_STR(Device), name, value );
|
#define KMP_STR_BUF_PRINT_BOOL \
|
||||||
#define KMP_STR_BUF_PRINT_STR __kmp_str_buf_print( buffer, " %s %s='%s'\n", KMP_I18N_STR(Device), name, value )
|
__kmp_str_buf_print(buffer, " %s %s='%s'\n", KMP_I18N_STR(Device), name, \
|
||||||
|
value ? "TRUE" : "FALSE");
|
||||||
|
#define KMP_STR_BUF_PRINT_INT \
|
||||||
|
__kmp_str_buf_print(buffer, " %s %s='%d'\n", KMP_I18N_STR(Device), name, \
|
||||||
|
value)
|
||||||
|
#define KMP_STR_BUF_PRINT_UINT64 \
|
||||||
|
__kmp_str_buf_print(buffer, " %s %s='%" KMP_UINT64_SPEC "'\n", \
|
||||||
|
KMP_I18N_STR(Device), name, value);
|
||||||
|
#define KMP_STR_BUF_PRINT_STR \
|
||||||
|
__kmp_str_buf_print(buffer, " %s %s='%s'\n", KMP_I18N_STR(Device), name, \
|
||||||
|
value)
|
||||||
#else
|
#else
|
||||||
#define KMP_STR_BUF_PRINT_NAME __kmp_str_buf_print( buffer, " %s %s", KMP_I18N_STR(Host), name )
|
#define KMP_STR_BUF_PRINT_NAME \
|
||||||
#define KMP_STR_BUF_PRINT_NAME_EX(x) __kmp_str_buf_print( buffer, " %s %s='", KMP_I18N_STR(Host), x )
|
__kmp_str_buf_print(buffer, " %s %s", KMP_I18N_STR(Host), name)
|
||||||
#define KMP_STR_BUF_PRINT_BOOL __kmp_str_buf_print( buffer, " %s %s='%s'\n", KMP_I18N_STR(Host), name, value ? "TRUE" : "FALSE" );
|
#define KMP_STR_BUF_PRINT_NAME_EX(x) \
|
||||||
#define KMP_STR_BUF_PRINT_INT __kmp_str_buf_print( buffer, " %s %s='%d'\n", KMP_I18N_STR(Host), name, value )
|
__kmp_str_buf_print(buffer, " %s %s='", KMP_I18N_STR(Host), x)
|
||||||
#define KMP_STR_BUF_PRINT_UINT64 __kmp_str_buf_print( buffer, " %s %s='%" KMP_UINT64_SPEC "'\n", KMP_I18N_STR(Host), name, value );
|
#define KMP_STR_BUF_PRINT_BOOL \
|
||||||
#define KMP_STR_BUF_PRINT_STR __kmp_str_buf_print( buffer, " %s %s='%s'\n", KMP_I18N_STR(Host), name, value )
|
__kmp_str_buf_print(buffer, " %s %s='%s'\n", KMP_I18N_STR(Host), name, \
|
||||||
|
value ? "TRUE" : "FALSE");
|
||||||
|
#define KMP_STR_BUF_PRINT_INT \
|
||||||
|
__kmp_str_buf_print(buffer, " %s %s='%d'\n", KMP_I18N_STR(Host), name, value)
|
||||||
|
#define KMP_STR_BUF_PRINT_UINT64 \
|
||||||
|
__kmp_str_buf_print(buffer, " %s %s='%" KMP_UINT64_SPEC "'\n", \
|
||||||
|
KMP_I18N_STR(Host), name, value);
|
||||||
|
#define KMP_STR_BUF_PRINT_STR \
|
||||||
|
__kmp_str_buf_print(buffer, " %s %s='%s'\n", KMP_I18N_STR(Host), name, value)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // KMP_SETTINGS_H
|
#endif // KMP_SETTINGS_H
|
||||||
|
|
||||||
// end of file //
|
// end of file //
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,39 +12,35 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
|
||||||
#include "kmp.h"
|
#include "kmp.h"
|
||||||
#include "kmp_str.h"
|
|
||||||
#include "kmp_lock.h"
|
#include "kmp_lock.h"
|
||||||
#include "kmp_stats.h"
|
#include "kmp_stats.h"
|
||||||
|
#include "kmp_str.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <sstream>
|
|
||||||
#include <iomanip>
|
|
||||||
#include <stdlib.h> // for atexit
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <sstream>
|
||||||
|
#include <stdlib.h> // for atexit
|
||||||
|
|
||||||
#define STRINGIZE2(x) #x
|
#define STRINGIZE2(x) #x
|
||||||
#define STRINGIZE(x) STRINGIZE2(x)
|
#define STRINGIZE(x) STRINGIZE2(x)
|
||||||
|
|
||||||
#define expandName(name,flags,ignore) {STRINGIZE(name),flags},
|
#define expandName(name, flags, ignore) {STRINGIZE(name), flags},
|
||||||
statInfo timeStat::timerInfo[] = {
|
statInfo timeStat::timerInfo[] = {
|
||||||
KMP_FOREACH_TIMER(expandName,0)
|
KMP_FOREACH_TIMER(expandName, 0){"TIMER_LAST", 0}};
|
||||||
{"TIMER_LAST", 0}
|
|
||||||
};
|
|
||||||
const statInfo counter::counterInfo[] = {
|
const statInfo counter::counterInfo[] = {
|
||||||
KMP_FOREACH_COUNTER(expandName,0)
|
KMP_FOREACH_COUNTER(expandName, 0){"COUNTER_LAST", 0}};
|
||||||
{"COUNTER_LAST", 0}
|
|
||||||
};
|
|
||||||
#undef expandName
|
#undef expandName
|
||||||
|
|
||||||
#define expandName(ignore1,ignore2,ignore3) {0.0,0.0,0.0},
|
#define expandName(ignore1, ignore2, ignore3) {0.0, 0.0, 0.0},
|
||||||
kmp_stats_output_module::rgb_color kmp_stats_output_module::timerColorInfo[] = {
|
kmp_stats_output_module::rgb_color kmp_stats_output_module::timerColorInfo[] = {
|
||||||
KMP_FOREACH_TIMER(expandName,0)
|
KMP_FOREACH_TIMER(expandName, 0){0.0, 0.0, 0.0}};
|
||||||
{0.0,0.0,0.0}
|
|
||||||
};
|
|
||||||
#undef expandName
|
#undef expandName
|
||||||
|
|
||||||
const kmp_stats_output_module::rgb_color kmp_stats_output_module::globalColorArray[] = {
|
const kmp_stats_output_module::rgb_color
|
||||||
|
kmp_stats_output_module::globalColorArray[] = {
|
||||||
{1.0, 0.0, 0.0}, // red
|
{1.0, 0.0, 0.0}, // red
|
||||||
{1.0, 0.6, 0.0}, // orange
|
{1.0, 0.6, 0.0}, // orange
|
||||||
{1.0, 1.0, 0.0}, // yellow
|
{1.0, 1.0, 0.0}, // yellow
|
||||||
|
|
@ -71,27 +67,23 @@ const kmp_stats_output_module::rgb_color kmp_stats_output_module::globalColorArr
|
||||||
static uint32_t statsPrinted = 0;
|
static uint32_t statsPrinted = 0;
|
||||||
|
|
||||||
// output interface
|
// output interface
|
||||||
static kmp_stats_output_module* __kmp_stats_global_output = NULL;
|
static kmp_stats_output_module *__kmp_stats_global_output = NULL;
|
||||||
|
|
||||||
/* ****************************************************** */
|
|
||||||
/* ************* statistic member functions ************* */
|
/* ************* statistic member functions ************* */
|
||||||
|
|
||||||
void statistic::addSample(double sample)
|
void statistic::addSample(double sample) {
|
||||||
{
|
|
||||||
double delta = sample - meanVal;
|
double delta = sample - meanVal;
|
||||||
|
|
||||||
sampleCount = sampleCount + 1;
|
sampleCount = sampleCount + 1;
|
||||||
meanVal = meanVal + delta/sampleCount;
|
meanVal = meanVal + delta / sampleCount;
|
||||||
m2 = m2 + delta*(sample - meanVal);
|
m2 = m2 + delta * (sample - meanVal);
|
||||||
|
|
||||||
minVal = std::min(minVal, sample);
|
minVal = std::min(minVal, sample);
|
||||||
maxVal = std::max(maxVal, sample);
|
maxVal = std::max(maxVal, sample);
|
||||||
}
|
}
|
||||||
|
|
||||||
statistic & statistic::operator+= (const statistic & other)
|
statistic &statistic::operator+=(const statistic &other) {
|
||||||
{
|
if (sampleCount == 0) {
|
||||||
if (sampleCount == 0)
|
|
||||||
{
|
|
||||||
*this = other;
|
*this = other;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
@ -99,101 +91,99 @@ statistic & statistic::operator+= (const statistic & other)
|
||||||
uint64_t newSampleCount = sampleCount + other.sampleCount;
|
uint64_t newSampleCount = sampleCount + other.sampleCount;
|
||||||
double dnsc = double(newSampleCount);
|
double dnsc = double(newSampleCount);
|
||||||
double dsc = double(sampleCount);
|
double dsc = double(sampleCount);
|
||||||
double dscBydnsc = dsc/dnsc;
|
double dscBydnsc = dsc / dnsc;
|
||||||
double dosc = double(other.sampleCount);
|
double dosc = double(other.sampleCount);
|
||||||
double delta = other.meanVal - meanVal;
|
double delta = other.meanVal - meanVal;
|
||||||
|
|
||||||
// Try to order these calculations to avoid overflows.
|
// Try to order these calculations to avoid overflows. If this were Fortran,
|
||||||
// If this were Fortran, then the compiler would not be able to re-order over brackets.
|
// then the compiler would not be able to re-order over brackets. In C++ it
|
||||||
// In C++ it may be legal to do that (we certainly hope it doesn't, and CC+ Programming Language 2nd edition
|
// may be legal to do that (we certainly hope it doesn't, and CC+ Programming
|
||||||
// suggests it shouldn't, since it says that exploitation of associativity can only be made if the operation
|
// Language 2nd edition suggests it shouldn't, since it says that exploitation
|
||||||
// really is associative (which floating addition isn't...)).
|
// of associativity can only be made if the operation really is associative
|
||||||
meanVal = meanVal*dscBydnsc + other.meanVal*(1-dscBydnsc);
|
// (which floating addition isn't...)).
|
||||||
m2 = m2 + other.m2 + dscBydnsc*dosc*delta*delta;
|
meanVal = meanVal * dscBydnsc + other.meanVal * (1 - dscBydnsc);
|
||||||
minVal = std::min (minVal, other.minVal);
|
m2 = m2 + other.m2 + dscBydnsc * dosc * delta * delta;
|
||||||
maxVal = std::max (maxVal, other.maxVal);
|
minVal = std::min(minVal, other.minVal);
|
||||||
|
maxVal = std::max(maxVal, other.maxVal);
|
||||||
sampleCount = newSampleCount;
|
sampleCount = newSampleCount;
|
||||||
|
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void statistic::scale(double factor)
|
void statistic::scale(double factor) {
|
||||||
{
|
minVal = minVal * factor;
|
||||||
minVal = minVal*factor;
|
maxVal = maxVal * factor;
|
||||||
maxVal = maxVal*factor;
|
meanVal = meanVal * factor;
|
||||||
meanVal= meanVal*factor;
|
m2 = m2 * factor * factor;
|
||||||
m2 = m2*factor*factor;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string statistic::format(char unit, bool total) const
|
std::string statistic::format(char unit, bool total) const {
|
||||||
{
|
std::string result = formatSI(sampleCount, 9, ' ');
|
||||||
std::string result = formatSI(sampleCount,9,' ');
|
|
||||||
|
|
||||||
if (sampleCount == 0)
|
if (sampleCount == 0) {
|
||||||
{
|
|
||||||
result = result + std::string(", ") + formatSI(0.0, 9, unit);
|
result = result + std::string(", ") + formatSI(0.0, 9, unit);
|
||||||
result = result + std::string(", ") + formatSI(0.0, 9, unit);
|
result = result + std::string(", ") + formatSI(0.0, 9, unit);
|
||||||
result = result + std::string(", ") + formatSI(0.0, 9, unit);
|
result = result + std::string(", ") + formatSI(0.0, 9, unit);
|
||||||
if (total)
|
if (total)
|
||||||
result = result + std::string(", ") + formatSI(0.0, 9, unit);
|
result = result + std::string(", ") + formatSI(0.0, 9, unit);
|
||||||
result = result + std::string(", ") + formatSI(0.0, 9, unit);
|
result = result + std::string(", ") + formatSI(0.0, 9, unit);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
result = result + std::string(", ") + formatSI(minVal, 9, unit);
|
result = result + std::string(", ") + formatSI(minVal, 9, unit);
|
||||||
result = result + std::string(", ") + formatSI(meanVal, 9, unit);
|
result = result + std::string(", ") + formatSI(meanVal, 9, unit);
|
||||||
result = result + std::string(", ") + formatSI(maxVal, 9, unit);
|
result = result + std::string(", ") + formatSI(maxVal, 9, unit);
|
||||||
if (total)
|
if (total)
|
||||||
result = result + std::string(", ") + formatSI(meanVal*sampleCount, 9, unit);
|
result =
|
||||||
|
result + std::string(", ") + formatSI(meanVal * sampleCount, 9, unit);
|
||||||
result = result + std::string(", ") + formatSI(getSD(), 9, unit);
|
result = result + std::string(", ") + formatSI(getSD(), 9, unit);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
/* ************* explicitTimer member functions ************* */
|
/* ************* explicitTimer member functions ************* */
|
||||||
|
|
||||||
void explicitTimer::start(timer_e timerEnumValue) {
|
void explicitTimer::start(timer_e timerEnumValue) {
|
||||||
startTime = tsc_tick_count::now();
|
startTime = tsc_tick_count::now();
|
||||||
totalPauseTime = 0;
|
totalPauseTime = 0;
|
||||||
if(timeStat::logEvent(timerEnumValue)) {
|
if (timeStat::logEvent(timerEnumValue)) {
|
||||||
__kmp_stats_thread_ptr->incrementNestValue();
|
__kmp_stats_thread_ptr->incrementNestValue();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void explicitTimer::stop(timer_e timerEnumValue, kmp_stats_list* stats_ptr /* = nullptr */) {
|
void explicitTimer::stop(timer_e timerEnumValue,
|
||||||
|
kmp_stats_list *stats_ptr /* = nullptr */) {
|
||||||
if (startTime.getValue() == 0)
|
if (startTime.getValue() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tsc_tick_count finishTime = tsc_tick_count::now();
|
tsc_tick_count finishTime = tsc_tick_count::now();
|
||||||
|
|
||||||
//stat->addSample ((tsc_tick_count::now() - startTime).ticks());
|
// stat->addSample ((tsc_tick_count::now() - startTime).ticks());
|
||||||
stat->addSample(((finishTime - startTime) - totalPauseTime).ticks());
|
stat->addSample(((finishTime - startTime) - totalPauseTime).ticks());
|
||||||
|
|
||||||
if(timeStat::logEvent(timerEnumValue)) {
|
if (timeStat::logEvent(timerEnumValue)) {
|
||||||
if(!stats_ptr)
|
if (!stats_ptr)
|
||||||
stats_ptr = __kmp_stats_thread_ptr;
|
stats_ptr = __kmp_stats_thread_ptr;
|
||||||
stats_ptr->push_event(startTime.getValue() - __kmp_stats_start_time.getValue(), finishTime.getValue() - __kmp_stats_start_time.getValue(), __kmp_stats_thread_ptr->getNestValue(), timerEnumValue);
|
stats_ptr->push_event(
|
||||||
|
startTime.getValue() - __kmp_stats_start_time.getValue(),
|
||||||
|
finishTime.getValue() - __kmp_stats_start_time.getValue(),
|
||||||
|
__kmp_stats_thread_ptr->getNestValue(), timerEnumValue);
|
||||||
stats_ptr->decrementNestValue();
|
stats_ptr->decrementNestValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We accept the risk that we drop a sample because it really did start at t==0. */
|
/* We accept the risk that we drop a sample because it really did start at
|
||||||
|
t==0. */
|
||||||
startTime = 0;
|
startTime = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************** */
|
|
||||||
/* ************* partitionedTimers member functions ************* */
|
/* ************* partitionedTimers member functions ************* */
|
||||||
partitionedTimers::partitionedTimers() {
|
partitionedTimers::partitionedTimers() { timer_stack.reserve(8); }
|
||||||
timer_stack.reserve(8);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add a timer to this collection of partitioned timers.
|
// add a timer to this collection of partitioned timers.
|
||||||
void partitionedTimers::add_timer(explicit_timer_e timer_index, explicitTimer* timer_pointer) {
|
void partitionedTimers::add_timer(explicit_timer_e timer_index,
|
||||||
KMP_DEBUG_ASSERT((int)timer_index < (int)EXPLICIT_TIMER_LAST+1);
|
explicitTimer *timer_pointer) {
|
||||||
|
KMP_DEBUG_ASSERT((int)timer_index < (int)EXPLICIT_TIMER_LAST + 1);
|
||||||
timers[timer_index] = timer_pointer;
|
timers[timer_index] = timer_pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -216,7 +206,7 @@ void partitionedTimers::push(timerPair timer_pair) {
|
||||||
KMP_DEBUG_ASSERT(this->timer_stack.size() > 0);
|
KMP_DEBUG_ASSERT(this->timer_stack.size() > 0);
|
||||||
timerPair current_timer = timer_stack.back();
|
timerPair current_timer = timer_stack.back();
|
||||||
timer_stack.push_back(timer_pair);
|
timer_stack.push_back(timer_pair);
|
||||||
if(current_timer != timer_pair) {
|
if (current_timer != timer_pair) {
|
||||||
timers[current_timer.get_index()]->pause();
|
timers[current_timer.get_index()]->pause();
|
||||||
timers[timer_pair.get_index()]->start(timer_pair.get_timer());
|
timers[timer_pair.get_index()]->start(timer_pair.get_timer());
|
||||||
}
|
}
|
||||||
|
|
@ -232,7 +222,7 @@ void partitionedTimers::pop() {
|
||||||
timerPair current_timer = timer_stack.back();
|
timerPair current_timer = timer_stack.back();
|
||||||
timer_stack.pop_back();
|
timer_stack.pop_back();
|
||||||
timerPair new_timer = timer_stack.back();
|
timerPair new_timer = timer_stack.back();
|
||||||
if(current_timer != new_timer) {
|
if (current_timer != new_timer) {
|
||||||
timers[current_timer.get_index()]->stop(current_timer.get_timer());
|
timers[current_timer.get_index()]->stop(current_timer.get_timer());
|
||||||
timers[new_timer.get_index()]->resume();
|
timers[new_timer.get_index()]->resume();
|
||||||
}
|
}
|
||||||
|
|
@ -243,17 +233,16 @@ void partitionedTimers::pop() {
|
||||||
// After this is called, init() must be run again to initialize the
|
// After this is called, init() must be run again to initialize the
|
||||||
// stack of timers
|
// stack of timers
|
||||||
void partitionedTimers::windup() {
|
void partitionedTimers::windup() {
|
||||||
while(timer_stack.size() > 1) {
|
while (timer_stack.size() > 1) {
|
||||||
this->pop();
|
this->pop();
|
||||||
}
|
}
|
||||||
if(timer_stack.size() > 0) {
|
if (timer_stack.size() > 0) {
|
||||||
timerPair last_timer = timer_stack.back();
|
timerPair last_timer = timer_stack.back();
|
||||||
timer_stack.pop_back();
|
timer_stack.pop_back();
|
||||||
timers[last_timer.get_index()]->stop(last_timer.get_timer());
|
timers[last_timer.get_index()]->stop(last_timer.get_timer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ******************************************************************* */
|
|
||||||
/* ************* kmp_stats_event_vector member functions ************* */
|
/* ************* kmp_stats_event_vector member functions ************* */
|
||||||
|
|
||||||
void kmp_stats_event_vector::deallocate() {
|
void kmp_stats_event_vector::deallocate() {
|
||||||
|
|
@ -264,29 +253,33 @@ void kmp_stats_event_vector::deallocate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is for qsort() which requires the compare function to return
|
// This function is for qsort() which requires the compare function to return
|
||||||
// either a negative number if event1 < event2, a positive number if event1 > event2
|
// either a negative number if event1 < event2, a positive number if event1 >
|
||||||
// or zero if event1 == event2.
|
// event2 or zero if event1 == event2. This sorts by start time (lowest to
|
||||||
// This sorts by start time (lowest to highest).
|
// highest).
|
||||||
int compare_two_events(const void* event1, const void* event2) {
|
int compare_two_events(const void *event1, const void *event2) {
|
||||||
kmp_stats_event* ev1 = (kmp_stats_event*)event1;
|
kmp_stats_event *ev1 = (kmp_stats_event *)event1;
|
||||||
kmp_stats_event* ev2 = (kmp_stats_event*)event2;
|
kmp_stats_event *ev2 = (kmp_stats_event *)event2;
|
||||||
|
|
||||||
if(ev1->getStart() < ev2->getStart()) return -1;
|
if (ev1->getStart() < ev2->getStart())
|
||||||
else if(ev1->getStart() > ev2->getStart()) return 1;
|
return -1;
|
||||||
else return 0;
|
else if (ev1->getStart() > ev2->getStart())
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void kmp_stats_event_vector::sort() {
|
void kmp_stats_event_vector::sort() {
|
||||||
qsort(events, internal_size, sizeof(kmp_stats_event), compare_two_events);
|
qsort(events, internal_size, sizeof(kmp_stats_event), compare_two_events);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *********************************************************** */
|
|
||||||
/* ************* kmp_stats_list member functions ************* */
|
/* ************* kmp_stats_list member functions ************* */
|
||||||
|
|
||||||
// returns a pointer to newly created stats node
|
// returns a pointer to newly created stats node
|
||||||
kmp_stats_list* kmp_stats_list::push_back(int gtid) {
|
kmp_stats_list *kmp_stats_list::push_back(int gtid) {
|
||||||
kmp_stats_list* newnode = (kmp_stats_list*)__kmp_allocate(sizeof(kmp_stats_list));
|
kmp_stats_list *newnode =
|
||||||
// placement new, only requires space and pointer and initializes (so __kmp_allocate instead of C++ new[] is used)
|
(kmp_stats_list *)__kmp_allocate(sizeof(kmp_stats_list));
|
||||||
|
// placement new, only requires space and pointer and initializes (so
|
||||||
|
// __kmp_allocate instead of C++ new[] is used)
|
||||||
new (newnode) kmp_stats_list();
|
new (newnode) kmp_stats_list();
|
||||||
newnode->setGtid(gtid);
|
newnode->setGtid(gtid);
|
||||||
newnode->prev = this->prev;
|
newnode->prev = this->prev;
|
||||||
|
|
@ -296,11 +289,11 @@ kmp_stats_list* kmp_stats_list::push_back(int gtid) {
|
||||||
return newnode;
|
return newnode;
|
||||||
}
|
}
|
||||||
void kmp_stats_list::deallocate() {
|
void kmp_stats_list::deallocate() {
|
||||||
kmp_stats_list* ptr = this->next;
|
kmp_stats_list *ptr = this->next;
|
||||||
kmp_stats_list* delptr = this->next;
|
kmp_stats_list *delptr = this->next;
|
||||||
while(ptr != this) {
|
while (ptr != this) {
|
||||||
delptr = ptr;
|
delptr = ptr;
|
||||||
ptr=ptr->next;
|
ptr = ptr->next;
|
||||||
// placement new means we have to explicitly call destructor.
|
// placement new means we have to explicitly call destructor.
|
||||||
delptr->_event_vector.deallocate();
|
delptr->_event_vector.deallocate();
|
||||||
delptr->~kmp_stats_list();
|
delptr->~kmp_stats_list();
|
||||||
|
|
@ -320,11 +313,11 @@ kmp_stats_list::iterator kmp_stats_list::end() {
|
||||||
int kmp_stats_list::size() {
|
int kmp_stats_list::size() {
|
||||||
int retval;
|
int retval;
|
||||||
kmp_stats_list::iterator it;
|
kmp_stats_list::iterator it;
|
||||||
for(retval=0, it=begin(); it!=end(); it++, retval++) {}
|
for (retval = 0, it = begin(); it != end(); it++, retval++) {
|
||||||
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************************* */
|
|
||||||
/* ************* kmp_stats_list::iterator member functions ************* */
|
/* ************* kmp_stats_list::iterator member functions ************* */
|
||||||
|
|
||||||
kmp_stats_list::iterator::iterator() : ptr(NULL) {}
|
kmp_stats_list::iterator::iterator() : ptr(NULL) {}
|
||||||
|
|
@ -345,35 +338,34 @@ kmp_stats_list::iterator kmp_stats_list::iterator::operator--(int dummy) {
|
||||||
this->ptr = this->ptr->prev;
|
this->ptr = this->ptr->prev;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
bool kmp_stats_list::iterator::operator!=(const kmp_stats_list::iterator & rhs) {
|
bool kmp_stats_list::iterator::operator!=(const kmp_stats_list::iterator &rhs) {
|
||||||
return this->ptr!=rhs.ptr;
|
return this->ptr != rhs.ptr;
|
||||||
}
|
}
|
||||||
bool kmp_stats_list::iterator::operator==(const kmp_stats_list::iterator & rhs) {
|
bool kmp_stats_list::iterator::operator==(const kmp_stats_list::iterator &rhs) {
|
||||||
return this->ptr==rhs.ptr;
|
return this->ptr == rhs.ptr;
|
||||||
}
|
}
|
||||||
kmp_stats_list* kmp_stats_list::iterator::operator*() const {
|
kmp_stats_list *kmp_stats_list::iterator::operator*() const {
|
||||||
return this->ptr;
|
return this->ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *************************************************************** */
|
|
||||||
/* ************* kmp_stats_output_module functions ************** */
|
/* ************* kmp_stats_output_module functions ************** */
|
||||||
|
|
||||||
const char* kmp_stats_output_module::eventsFileName = NULL;
|
const char *kmp_stats_output_module::eventsFileName = NULL;
|
||||||
const char* kmp_stats_output_module::plotFileName = NULL;
|
const char *kmp_stats_output_module::plotFileName = NULL;
|
||||||
int kmp_stats_output_module::printPerThreadFlag = 0;
|
int kmp_stats_output_module::printPerThreadFlag = 0;
|
||||||
int kmp_stats_output_module::printPerThreadEventsFlag = 0;
|
int kmp_stats_output_module::printPerThreadEventsFlag = 0;
|
||||||
|
|
||||||
// init() is called very near the beginning of execution time in the constructor of __kmp_stats_global_output
|
// init() is called very near the beginning of execution time in the constructor
|
||||||
void kmp_stats_output_module::init()
|
// of __kmp_stats_global_output
|
||||||
{
|
void kmp_stats_output_module::init() {
|
||||||
char * statsFileName = getenv("KMP_STATS_FILE");
|
char *statsFileName = getenv("KMP_STATS_FILE");
|
||||||
eventsFileName = getenv("KMP_STATS_EVENTS_FILE");
|
eventsFileName = getenv("KMP_STATS_EVENTS_FILE");
|
||||||
plotFileName = getenv("KMP_STATS_PLOT_FILE");
|
plotFileName = getenv("KMP_STATS_PLOT_FILE");
|
||||||
char * threadStats = getenv("KMP_STATS_THREADS");
|
char *threadStats = getenv("KMP_STATS_THREADS");
|
||||||
char * threadEvents = getenv("KMP_STATS_EVENTS");
|
char *threadEvents = getenv("KMP_STATS_EVENTS");
|
||||||
|
|
||||||
// set the stats output filenames based on environment variables and defaults
|
// set the stats output filenames based on environment variables and defaults
|
||||||
if(statsFileName) {
|
if (statsFileName) {
|
||||||
// append the process id to the output filename
|
// append the process id to the output filename
|
||||||
// events.csv --> events-pid.csv
|
// events.csv --> events-pid.csv
|
||||||
size_t index;
|
size_t index;
|
||||||
|
|
@ -381,7 +373,7 @@ void kmp_stats_output_module::init()
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
outputFileName = std::string(statsFileName);
|
outputFileName = std::string(statsFileName);
|
||||||
index = outputFileName.find_last_of('.');
|
index = outputFileName.find_last_of('.');
|
||||||
if(index == std::string::npos) {
|
if (index == std::string::npos) {
|
||||||
baseFileName = outputFileName;
|
baseFileName = outputFileName;
|
||||||
} else {
|
} else {
|
||||||
baseFileName = outputFileName.substr(0, index);
|
baseFileName = outputFileName.substr(0, index);
|
||||||
|
|
@ -394,11 +386,12 @@ void kmp_stats_output_module::init()
|
||||||
eventsFileName = eventsFileName ? eventsFileName : "events.dat";
|
eventsFileName = eventsFileName ? eventsFileName : "events.dat";
|
||||||
plotFileName = plotFileName ? plotFileName : "events.plt";
|
plotFileName = plotFileName ? plotFileName : "events.plt";
|
||||||
|
|
||||||
// set the flags based on environment variables matching: true, on, 1, .true. , .t. , yes
|
// set the flags based on environment variables matching: true, on, 1, .true.
|
||||||
|
// , .t. , yes
|
||||||
printPerThreadFlag = __kmp_str_match_true(threadStats);
|
printPerThreadFlag = __kmp_str_match_true(threadStats);
|
||||||
printPerThreadEventsFlag = __kmp_str_match_true(threadEvents);
|
printPerThreadEventsFlag = __kmp_str_match_true(threadEvents);
|
||||||
|
|
||||||
if(printPerThreadEventsFlag) {
|
if (printPerThreadEventsFlag) {
|
||||||
// assigns a color to each timer for printing
|
// assigns a color to each timer for printing
|
||||||
setupEventColors();
|
setupEventColors();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -413,80 +406,83 @@ void kmp_stats_output_module::setupEventColors() {
|
||||||
int i;
|
int i;
|
||||||
int globalColorIndex = 0;
|
int globalColorIndex = 0;
|
||||||
int numGlobalColors = sizeof(globalColorArray) / sizeof(rgb_color);
|
int numGlobalColors = sizeof(globalColorArray) / sizeof(rgb_color);
|
||||||
for(i=0;i<TIMER_LAST;i++) {
|
for (i = 0; i < TIMER_LAST; i++) {
|
||||||
if(timeStat::logEvent((timer_e)i)) {
|
if (timeStat::logEvent((timer_e)i)) {
|
||||||
timerColorInfo[i] = globalColorArray[globalColorIndex];
|
timerColorInfo[i] = globalColorArray[globalColorIndex];
|
||||||
globalColorIndex = (globalColorIndex+1)%numGlobalColors;
|
globalColorIndex = (globalColorIndex + 1) % numGlobalColors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void kmp_stats_output_module::printTimerStats(FILE *statsOut, statistic const * theStats, statistic const * totalStats)
|
void kmp_stats_output_module::printTimerStats(FILE *statsOut,
|
||||||
{
|
statistic const *theStats,
|
||||||
fprintf (statsOut, "Timer, SampleCount, Min, Mean, Max, Total, SD\n");
|
statistic const *totalStats) {
|
||||||
for (timer_e s = timer_e(0); s<TIMER_LAST; s = timer_e(s+1)) {
|
fprintf(statsOut, "Timer, SampleCount, Min, "
|
||||||
statistic const * stat = &theStats[s];
|
"Mean, Max, Total, SD\n");
|
||||||
|
for (timer_e s = timer_e(0); s < TIMER_LAST; s = timer_e(s + 1)) {
|
||||||
|
statistic const *stat = &theStats[s];
|
||||||
char tag = timeStat::noUnits(s) ? ' ' : 'T';
|
char tag = timeStat::noUnits(s) ? ' ' : 'T';
|
||||||
|
|
||||||
fprintf (statsOut, "%-28s, %s\n", timeStat::name(s), stat->format(tag, true).c_str());
|
fprintf(statsOut, "%-28s, %s\n", timeStat::name(s),
|
||||||
|
stat->format(tag, true).c_str());
|
||||||
}
|
}
|
||||||
// Also print the Total_ versions of times.
|
// Also print the Total_ versions of times.
|
||||||
for (timer_e s = timer_e(0); s<TIMER_LAST; s = timer_e(s+1)) {
|
for (timer_e s = timer_e(0); s < TIMER_LAST; s = timer_e(s + 1)) {
|
||||||
char tag = timeStat::noUnits(s) ? ' ' : 'T';
|
char tag = timeStat::noUnits(s) ? ' ' : 'T';
|
||||||
if (totalStats && !timeStat::noTotal(s))
|
if (totalStats && !timeStat::noTotal(s))
|
||||||
fprintf(statsOut, "Total_%-22s, %s\n", timeStat::name(s), totalStats[s].format(tag, true).c_str());
|
fprintf(statsOut, "Total_%-22s, %s\n", timeStat::name(s),
|
||||||
|
totalStats[s].format(tag, true).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void kmp_stats_output_module::printCounterStats(FILE *statsOut, statistic const * theStats)
|
void kmp_stats_output_module::printCounterStats(FILE *statsOut,
|
||||||
{
|
statistic const *theStats) {
|
||||||
fprintf (statsOut, "Counter, ThreadCount, Min, Mean, Max, Total, SD\n");
|
fprintf(statsOut, "Counter, ThreadCount, Min, Mean, "
|
||||||
for (int s = 0; s<COUNTER_LAST; s++) {
|
" Max, Total, SD\n");
|
||||||
statistic const * stat = &theStats[s];
|
for (int s = 0; s < COUNTER_LAST; s++) {
|
||||||
fprintf (statsOut, "%-25s, %s\n", counter::name(counter_e(s)), stat->format(' ', true).c_str());
|
statistic const *stat = &theStats[s];
|
||||||
|
fprintf(statsOut, "%-25s, %s\n", counter::name(counter_e(s)),
|
||||||
|
stat->format(' ', true).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void kmp_stats_output_module::printCounters(FILE * statsOut, counter const * theCounters)
|
void kmp_stats_output_module::printCounters(FILE *statsOut,
|
||||||
{
|
counter const *theCounters) {
|
||||||
// We print all the counters even if they are zero.
|
// We print all the counters even if they are zero.
|
||||||
// That makes it easier to slice them into a spreadsheet if you need to.
|
// That makes it easier to slice them into a spreadsheet if you need to.
|
||||||
fprintf (statsOut, "\nCounter, Count\n");
|
fprintf(statsOut, "\nCounter, Count\n");
|
||||||
for (int c = 0; c<COUNTER_LAST; c++) {
|
for (int c = 0; c < COUNTER_LAST; c++) {
|
||||||
counter const * stat = &theCounters[c];
|
counter const *stat = &theCounters[c];
|
||||||
fprintf (statsOut, "%-25s, %s\n", counter::name(counter_e(c)), formatSI(stat->getValue(), 9, ' ').c_str());
|
fprintf(statsOut, "%-25s, %s\n", counter::name(counter_e(c)),
|
||||||
|
formatSI(stat->getValue(), 9, ' ').c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void kmp_stats_output_module::printEvents(FILE* eventsOut, kmp_stats_event_vector* theEvents, int gtid) {
|
void kmp_stats_output_module::printEvents(FILE *eventsOut,
|
||||||
|
kmp_stats_event_vector *theEvents,
|
||||||
|
int gtid) {
|
||||||
// sort by start time before printing
|
// sort by start time before printing
|
||||||
theEvents->sort();
|
theEvents->sort();
|
||||||
for (int i = 0; i < theEvents->size(); i++) {
|
for (int i = 0; i < theEvents->size(); i++) {
|
||||||
kmp_stats_event ev = theEvents->at(i);
|
kmp_stats_event ev = theEvents->at(i);
|
||||||
rgb_color color = getEventColor(ev.getTimerName());
|
rgb_color color = getEventColor(ev.getTimerName());
|
||||||
fprintf(eventsOut, "%d %lu %lu %1.1f rgb(%1.1f,%1.1f,%1.1f) %s\n",
|
fprintf(eventsOut, "%d %lu %lu %1.1f rgb(%1.1f,%1.1f,%1.1f) %s\n", gtid,
|
||||||
gtid,
|
ev.getStart(), ev.getStop(), 1.2 - (ev.getNestLevel() * 0.2),
|
||||||
ev.getStart(),
|
color.r, color.g, color.b, timeStat::name(ev.getTimerName()));
|
||||||
ev.getStop(),
|
|
||||||
1.2 - (ev.getNestLevel() * 0.2),
|
|
||||||
color.r, color.g, color.b,
|
|
||||||
timeStat::name(ev.getTimerName())
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void kmp_stats_output_module::windupExplicitTimers()
|
void kmp_stats_output_module::windupExplicitTimers() {
|
||||||
{
|
// Wind up any explicit timers. We assume that it's fair at this point to just
|
||||||
// Wind up any explicit timers. We assume that it's fair at this point to just walk all the explcit timers in all threads
|
// walk all the explcit timers in all threads and say "it's over".
|
||||||
// and say "it's over".
|
|
||||||
// If the timer wasn't running, this won't record anything anyway.
|
// If the timer wasn't running, this won't record anything anyway.
|
||||||
kmp_stats_list::iterator it;
|
kmp_stats_list::iterator it;
|
||||||
for(it = __kmp_stats_list->begin(); it != __kmp_stats_list->end(); it++) {
|
for (it = __kmp_stats_list->begin(); it != __kmp_stats_list->end(); it++) {
|
||||||
kmp_stats_list* ptr = *it;
|
kmp_stats_list *ptr = *it;
|
||||||
ptr->getPartitionedTimers()->windup();
|
ptr->getPartitionedTimers()->windup();
|
||||||
for (int timer=0; timer<EXPLICIT_TIMER_LAST; timer++) {
|
for (int timer = 0; timer < EXPLICIT_TIMER_LAST; timer++) {
|
||||||
ptr->getExplicitTimer(explicit_timer_e(timer))->stop((timer_e)timer, ptr);
|
ptr->getExplicitTimer(explicit_timer_e(timer))->stop((timer_e)timer, ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -495,7 +491,7 @@ void kmp_stats_output_module::windupExplicitTimers()
|
||||||
void kmp_stats_output_module::printPloticusFile() {
|
void kmp_stats_output_module::printPloticusFile() {
|
||||||
int i;
|
int i;
|
||||||
int size = __kmp_stats_list->size();
|
int size = __kmp_stats_list->size();
|
||||||
FILE* plotOut = fopen(plotFileName, "w+");
|
FILE *plotOut = fopen(plotFileName, "w+");
|
||||||
|
|
||||||
fprintf(plotOut, "#proc page\n"
|
fprintf(plotOut, "#proc page\n"
|
||||||
" pagesize: 15 10\n"
|
" pagesize: 15 10\n"
|
||||||
|
|
@ -525,7 +521,7 @@ void kmp_stats_output_module::printPloticusFile() {
|
||||||
" stubdetails: size=12\n"
|
" stubdetails: size=12\n"
|
||||||
" label: Thread #\n"
|
" label: Thread #\n"
|
||||||
" labeldetails: size=14\n\n",
|
" labeldetails: size=14\n\n",
|
||||||
size-1);
|
size - 1);
|
||||||
|
|
||||||
fprintf(plotOut, "#proc bars\n"
|
fprintf(plotOut, "#proc bars\n"
|
||||||
" exactcolorfield: 5\n"
|
" exactcolorfield: 5\n"
|
||||||
|
|
@ -535,16 +531,14 @@ void kmp_stats_output_module::printPloticusFile() {
|
||||||
" barwidthfield: 4\n\n");
|
" barwidthfield: 4\n\n");
|
||||||
|
|
||||||
// create legend entries corresponding to the timer color
|
// create legend entries corresponding to the timer color
|
||||||
for(i=0;i<TIMER_LAST;i++) {
|
for (i = 0; i < TIMER_LAST; i++) {
|
||||||
if(timeStat::logEvent((timer_e)i)) {
|
if (timeStat::logEvent((timer_e)i)) {
|
||||||
rgb_color c = getEventColor((timer_e)i);
|
rgb_color c = getEventColor((timer_e)i);
|
||||||
fprintf(plotOut, "#proc legendentry\n"
|
fprintf(plotOut, "#proc legendentry\n"
|
||||||
" sampletype: color\n"
|
" sampletype: color\n"
|
||||||
" label: %s\n"
|
" label: %s\n"
|
||||||
" details: rgb(%1.1f,%1.1f,%1.1f)\n\n",
|
" details: rgb(%1.1f,%1.1f,%1.1f)\n\n",
|
||||||
timeStat::name((timer_e)i),
|
timeStat::name((timer_e)i), c.r, c.g, c.b);
|
||||||
c.r, c.g, c.b);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -555,63 +549,65 @@ void kmp_stats_output_module::printPloticusFile() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Print some useful information about
|
||||||
* Print some useful information about
|
* the date and time this experiment ran.
|
||||||
* * the date and time this experiment ran.
|
* the machine on which it ran.
|
||||||
* * the machine on which it ran.
|
We output all of this as stylised comments, though we may decide to parse
|
||||||
* We output all of this as stylised comments, though we may decide to parse some of it.
|
some of it. */
|
||||||
*/
|
void kmp_stats_output_module::printHeaderInfo(FILE *statsOut) {
|
||||||
void kmp_stats_output_module::printHeaderInfo(FILE * statsOut)
|
|
||||||
{
|
|
||||||
std::time_t now = std::time(0);
|
std::time_t now = std::time(0);
|
||||||
char buffer[40];
|
char buffer[40];
|
||||||
char hostName[80];
|
char hostName[80];
|
||||||
|
|
||||||
std::strftime(&buffer[0], sizeof(buffer), "%c", std::localtime(&now));
|
std::strftime(&buffer[0], sizeof(buffer), "%c", std::localtime(&now));
|
||||||
fprintf (statsOut, "# Time of run: %s\n", &buffer[0]);
|
fprintf(statsOut, "# Time of run: %s\n", &buffer[0]);
|
||||||
if (gethostname(&hostName[0], sizeof(hostName)) == 0)
|
if (gethostname(&hostName[0], sizeof(hostName)) == 0)
|
||||||
fprintf (statsOut,"# Hostname: %s\n", &hostName[0]);
|
fprintf(statsOut, "# Hostname: %s\n", &hostName[0]);
|
||||||
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
||||||
fprintf (statsOut, "# CPU: %s\n", &__kmp_cpuinfo.name[0]);
|
fprintf(statsOut, "# CPU: %s\n", &__kmp_cpuinfo.name[0]);
|
||||||
fprintf (statsOut, "# Family: %d, Model: %d, Stepping: %d\n", __kmp_cpuinfo.family, __kmp_cpuinfo.model, __kmp_cpuinfo.stepping);
|
fprintf(statsOut, "# Family: %d, Model: %d, Stepping: %d\n",
|
||||||
|
__kmp_cpuinfo.family, __kmp_cpuinfo.model, __kmp_cpuinfo.stepping);
|
||||||
if (__kmp_cpuinfo.frequency == 0)
|
if (__kmp_cpuinfo.frequency == 0)
|
||||||
fprintf (statsOut, "# Nominal frequency: Unknown\n");
|
fprintf(statsOut, "# Nominal frequency: Unknown\n");
|
||||||
else
|
else
|
||||||
fprintf (statsOut, "# Nominal frequency: %sz\n", formatSI(double(__kmp_cpuinfo.frequency),9,'H').c_str());
|
fprintf(statsOut, "# Nominal frequency: %sz\n",
|
||||||
|
formatSI(double(__kmp_cpuinfo.frequency), 9, 'H').c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void kmp_stats_output_module::outputStats(const char* heading)
|
void kmp_stats_output_module::outputStats(const char *heading) {
|
||||||
{
|
|
||||||
// Stop all the explicit timers in all threads
|
// Stop all the explicit timers in all threads
|
||||||
// Do this before declaring the local statistics because thay have constructors so will take time to create.
|
// Do this before declaring the local statistics because thay have
|
||||||
|
// constructors so will take time to create.
|
||||||
windupExplicitTimers();
|
windupExplicitTimers();
|
||||||
|
|
||||||
statistic allStats[TIMER_LAST];
|
statistic allStats[TIMER_LAST];
|
||||||
statistic totalStats[TIMER_LAST]; /* Synthesized, cross threads versions of normal timer stats */
|
statistic totalStats[TIMER_LAST]; /* Synthesized, cross threads versions of
|
||||||
|
normal timer stats */
|
||||||
statistic allCounters[COUNTER_LAST];
|
statistic allCounters[COUNTER_LAST];
|
||||||
|
|
||||||
FILE * statsOut = !outputFileName.empty() ? fopen (outputFileName.c_str(), "a+") : stderr;
|
FILE *statsOut =
|
||||||
|
!outputFileName.empty() ? fopen(outputFileName.c_str(), "a+") : stderr;
|
||||||
if (!statsOut)
|
if (!statsOut)
|
||||||
statsOut = stderr;
|
statsOut = stderr;
|
||||||
|
|
||||||
FILE * eventsOut;
|
FILE *eventsOut;
|
||||||
if (eventPrintingEnabled()) {
|
if (eventPrintingEnabled()) {
|
||||||
eventsOut = fopen(eventsFileName, "w+");
|
eventsOut = fopen(eventsFileName, "w+");
|
||||||
}
|
}
|
||||||
|
|
||||||
printHeaderInfo (statsOut);
|
printHeaderInfo(statsOut);
|
||||||
fprintf(statsOut, "%s\n",heading);
|
fprintf(statsOut, "%s\n", heading);
|
||||||
// Accumulate across threads.
|
// Accumulate across threads.
|
||||||
kmp_stats_list::iterator it;
|
kmp_stats_list::iterator it;
|
||||||
for (it = __kmp_stats_list->begin(); it != __kmp_stats_list->end(); it++) {
|
for (it = __kmp_stats_list->begin(); it != __kmp_stats_list->end(); it++) {
|
||||||
int t = (*it)->getGtid();
|
int t = (*it)->getGtid();
|
||||||
// Output per thread stats if requested.
|
// Output per thread stats if requested.
|
||||||
if (printPerThreadFlag) {
|
if (printPerThreadFlag) {
|
||||||
fprintf (statsOut, "Thread %d\n", t);
|
fprintf(statsOut, "Thread %d\n", t);
|
||||||
printTimerStats (statsOut, (*it)->getTimers(), 0);
|
printTimerStats(statsOut, (*it)->getTimers(), 0);
|
||||||
printCounters (statsOut, (*it)->getCounters());
|
printCounters(statsOut, (*it)->getCounters());
|
||||||
fprintf (statsOut,"\n");
|
fprintf(statsOut, "\n");
|
||||||
}
|
}
|
||||||
// Output per thread events if requested.
|
// Output per thread events if requested.
|
||||||
if (eventPrintingEnabled()) {
|
if (eventPrintingEnabled()) {
|
||||||
|
|
@ -620,16 +616,17 @@ void kmp_stats_output_module::outputStats(const char* heading)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accumulate timers.
|
// Accumulate timers.
|
||||||
for (timer_e s = timer_e(0); s<TIMER_LAST; s = timer_e(s+1)) {
|
for (timer_e s = timer_e(0); s < TIMER_LAST; s = timer_e(s + 1)) {
|
||||||
// See if we should ignore this timer when aggregating
|
// See if we should ignore this timer when aggregating
|
||||||
if ((timeStat::masterOnly(s) && (t != 0)) || // Timer is only valid on the master and this thread is a worker
|
if ((timeStat::masterOnly(s) && (t != 0)) || // Timer only valid on master
|
||||||
(timeStat::workerOnly(s) && (t == 0)) // Timer is only valid on a worker and this thread is the master
|
// and this thread is worker
|
||||||
)
|
(timeStat::workerOnly(s) && (t == 0)) // Timer only valid on worker
|
||||||
{
|
// and this thread is the master
|
||||||
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
statistic * threadStat = (*it)->getTimer(s);
|
statistic *threadStat = (*it)->getTimer(s);
|
||||||
allStats[s] += *threadStat;
|
allStats[s] += *threadStat;
|
||||||
|
|
||||||
// Add Total stats for timers that are valid in more than one thread
|
// Add Total stats for timers that are valid in more than one thread
|
||||||
|
|
@ -638,10 +635,10 @@ void kmp_stats_output_module::outputStats(const char* heading)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accumulate counters.
|
// Accumulate counters.
|
||||||
for (counter_e c = counter_e(0); c<COUNTER_LAST; c = counter_e(c+1)) {
|
for (counter_e c = counter_e(0); c < COUNTER_LAST; c = counter_e(c + 1)) {
|
||||||
if (counter::masterOnly(c) && t != 0)
|
if (counter::masterOnly(c) && t != 0)
|
||||||
continue;
|
continue;
|
||||||
allCounters[c].addSample ((*it)->getCounter(c)->getValue());
|
allCounters[c].addSample((*it)->getCounter(c)->getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -650,36 +647,35 @@ void kmp_stats_output_module::outputStats(const char* heading)
|
||||||
fclose(eventsOut);
|
fclose(eventsOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (statsOut, "Aggregate for all threads\n");
|
fprintf(statsOut, "Aggregate for all threads\n");
|
||||||
printTimerStats (statsOut, &allStats[0], &totalStats[0]);
|
printTimerStats(statsOut, &allStats[0], &totalStats[0]);
|
||||||
fprintf (statsOut, "\n");
|
fprintf(statsOut, "\n");
|
||||||
printCounterStats (statsOut, &allCounters[0]);
|
printCounterStats(statsOut, &allCounters[0]);
|
||||||
|
|
||||||
if (statsOut != stderr)
|
if (statsOut != stderr)
|
||||||
fclose(statsOut);
|
fclose(statsOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************** */
|
|
||||||
/* ************* exported C functions ************** */
|
/* ************* exported C functions ************** */
|
||||||
|
|
||||||
// no name mangling for these functions, we want the c files to be able to get at these functions
|
// no name mangling for these functions, we want the c files to be able to get
|
||||||
|
// at these functions
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
void __kmp_reset_stats()
|
void __kmp_reset_stats() {
|
||||||
{
|
|
||||||
kmp_stats_list::iterator it;
|
kmp_stats_list::iterator it;
|
||||||
for(it = __kmp_stats_list->begin(); it != __kmp_stats_list->end(); it++) {
|
for (it = __kmp_stats_list->begin(); it != __kmp_stats_list->end(); it++) {
|
||||||
timeStat * timers = (*it)->getTimers();
|
timeStat *timers = (*it)->getTimers();
|
||||||
counter * counters = (*it)->getCounters();
|
counter *counters = (*it)->getCounters();
|
||||||
explicitTimer * eTimers = (*it)->getExplicitTimers();
|
explicitTimer *eTimers = (*it)->getExplicitTimers();
|
||||||
|
|
||||||
for (int t = 0; t<TIMER_LAST; t++)
|
for (int t = 0; t < TIMER_LAST; t++)
|
||||||
timers[t].reset();
|
timers[t].reset();
|
||||||
|
|
||||||
for (int c = 0; c<COUNTER_LAST; c++)
|
for (int c = 0; c < COUNTER_LAST; c++)
|
||||||
counters[c].reset();
|
counters[c].reset();
|
||||||
|
|
||||||
for (int t=0; t<EXPLICIT_TIMER_LAST; t++)
|
for (int t = 0; t < EXPLICIT_TIMER_LAST; t++)
|
||||||
eTimers[t].reset();
|
eTimers[t].reset();
|
||||||
|
|
||||||
// reset the event vector so all previous events are "erased"
|
// reset the event vector so all previous events are "erased"
|
||||||
|
|
@ -687,15 +683,14 @@ void __kmp_reset_stats()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function will reset all stats and stop all threads' explicit timers if they haven't been stopped already.
|
// This function will reset all stats and stop all threads' explicit timers if
|
||||||
void __kmp_output_stats(const char * heading)
|
// they haven't been stopped already.
|
||||||
{
|
void __kmp_output_stats(const char *heading) {
|
||||||
__kmp_stats_global_output->outputStats(heading);
|
__kmp_stats_global_output->outputStats(heading);
|
||||||
__kmp_reset_stats();
|
__kmp_reset_stats();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __kmp_accumulate_stats_at_exit(void)
|
void __kmp_accumulate_stats_at_exit(void) {
|
||||||
{
|
|
||||||
// Only do this once.
|
// Only do this once.
|
||||||
if (KMP_XCHG_FIXED32(&statsPrinted, 1) != 0)
|
if (KMP_XCHG_FIXED32(&statsPrinted, 1) != 0)
|
||||||
return;
|
return;
|
||||||
|
|
@ -703,16 +698,14 @@ void __kmp_accumulate_stats_at_exit(void)
|
||||||
__kmp_output_stats("Statistics on exit");
|
__kmp_output_stats("Statistics on exit");
|
||||||
}
|
}
|
||||||
|
|
||||||
void __kmp_stats_init(void)
|
void __kmp_stats_init(void) {
|
||||||
{
|
__kmp_init_tas_lock(&__kmp_stats_lock);
|
||||||
__kmp_init_tas_lock( & __kmp_stats_lock );
|
|
||||||
__kmp_stats_start_time = tsc_tick_count::now();
|
__kmp_stats_start_time = tsc_tick_count::now();
|
||||||
__kmp_stats_global_output = new kmp_stats_output_module();
|
__kmp_stats_global_output = new kmp_stats_output_module();
|
||||||
__kmp_stats_list = new kmp_stats_list();
|
__kmp_stats_list = new kmp_stats_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __kmp_stats_fini(void)
|
void __kmp_stats_fini(void) {
|
||||||
{
|
|
||||||
__kmp_accumulate_stats_at_exit();
|
__kmp_accumulate_stats_at_exit();
|
||||||
__kmp_stats_list->deallocate();
|
__kmp_stats_list->deallocate();
|
||||||
delete __kmp_stats_global_output;
|
delete __kmp_stats_global_output;
|
||||||
|
|
@ -720,4 +713,3 @@ void __kmp_stats_fini(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -16,8 +16,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "kmp.h"
|
#include "kmp.h"
|
||||||
|
|
@ -26,21 +26,18 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#if KMP_HAVE_TICK_TIME
|
#if KMP_HAVE_TICK_TIME
|
||||||
# if KMP_MIC
|
#if KMP_MIC
|
||||||
double tsc_tick_count::tick_time()
|
double tsc_tick_count::tick_time() {
|
||||||
{
|
|
||||||
// pretty bad assumption of 1GHz clock for MIC
|
// pretty bad assumption of 1GHz clock for MIC
|
||||||
return 1/((double)1000*1.e6);
|
return 1 / ((double)1000 * 1.e6);
|
||||||
}
|
}
|
||||||
# elif KMP_ARCH_X86 || KMP_ARCH_X86_64
|
#elif KMP_ARCH_X86 || KMP_ARCH_X86_64
|
||||||
# include <string.h>
|
#include <string.h>
|
||||||
// Extract the value from the CPUID information
|
// Extract the value from the CPUID information
|
||||||
double tsc_tick_count::tick_time()
|
double tsc_tick_count::tick_time() {
|
||||||
{
|
|
||||||
static double result = 0.0;
|
static double result = 0.0;
|
||||||
|
|
||||||
if (result == 0.0)
|
if (result == 0.0) {
|
||||||
{
|
|
||||||
kmp_cpuid_t cpuinfo;
|
kmp_cpuid_t cpuinfo;
|
||||||
char brand[256];
|
char brand[256];
|
||||||
|
|
||||||
|
|
@ -48,97 +45,88 @@ double tsc_tick_count::tick_time()
|
||||||
memset(brand, 0, sizeof(brand));
|
memset(brand, 0, sizeof(brand));
|
||||||
int ids = cpuinfo.eax;
|
int ids = cpuinfo.eax;
|
||||||
|
|
||||||
for (unsigned int i=2; i<(ids^0x80000000)+2; i++)
|
for (unsigned int i = 2; i < (ids ^ 0x80000000) + 2; i++)
|
||||||
__kmp_x86_cpuid(i | 0x80000000, 0, (kmp_cpuid_t*)(brand+(i-2)*sizeof(kmp_cpuid_t)));
|
__kmp_x86_cpuid(i | 0x80000000, 0,
|
||||||
|
(kmp_cpuid_t *)(brand + (i - 2) * sizeof(kmp_cpuid_t)));
|
||||||
|
|
||||||
char * start = &brand[0];
|
char *start = &brand[0];
|
||||||
for (;*start == ' '; start++)
|
for (; *start == ' '; start++)
|
||||||
;
|
;
|
||||||
|
|
||||||
char * end = brand + KMP_STRLEN(brand) - 3;
|
char *end = brand + KMP_STRLEN(brand) - 3;
|
||||||
uint64_t multiplier;
|
uint64_t multiplier;
|
||||||
|
|
||||||
if (*end == 'M') multiplier = 1000LL*1000LL;
|
if (*end == 'M')
|
||||||
else if (*end == 'G') multiplier = 1000LL*1000LL*1000LL;
|
multiplier = 1000LL * 1000LL;
|
||||||
else if (*end == 'T') multiplier = 1000LL*1000LL*1000LL*1000LL;
|
else if (*end == 'G')
|
||||||
else
|
multiplier = 1000LL * 1000LL * 1000LL;
|
||||||
{
|
else if (*end == 'T')
|
||||||
|
multiplier = 1000LL * 1000LL * 1000LL * 1000LL;
|
||||||
|
else {
|
||||||
cout << "Error determining multiplier '" << *end << "'\n";
|
cout << "Error determining multiplier '" << *end << "'\n";
|
||||||
exit (-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
*end = 0;
|
*end = 0;
|
||||||
while (*end != ' ') end--;
|
while (*end != ' ')
|
||||||
|
end--;
|
||||||
end++;
|
end++;
|
||||||
|
|
||||||
double freq = strtod(end, &start);
|
double freq = strtod(end, &start);
|
||||||
if (freq == 0.0)
|
if (freq == 0.0) {
|
||||||
{
|
|
||||||
cout << "Error calculating frequency " << end << "\n";
|
cout << "Error calculating frequency " << end << "\n";
|
||||||
exit (-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ((double)1.0)/(freq * multiplier);
|
result = ((double)1.0) / (freq * multiplier);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool useSI = true;
|
static bool useSI = true;
|
||||||
|
|
||||||
// Return a formatted string after normalising the value into
|
// Return a formatted string after normalising the value into
|
||||||
// engineering style and using a suitable unit prefix (e.g. ms, us, ns).
|
// engineering style and using a suitable unit prefix (e.g. ms, us, ns).
|
||||||
std::string formatSI(double interval, int width, char unit)
|
std::string formatSI(double interval, int width, char unit) {
|
||||||
{
|
|
||||||
std::stringstream os;
|
std::stringstream os;
|
||||||
|
|
||||||
if (useSI)
|
if (useSI) {
|
||||||
{
|
// Preserve accuracy for small numbers, since we only multiply and the
|
||||||
// Preserve accuracy for small numbers, since we only multiply and the positive powers
|
// positive powers of ten are precisely representable.
|
||||||
// of ten are precisely representable.
|
static struct {
|
||||||
static struct { double scale; char prefix; } ranges[] = {
|
double scale;
|
||||||
{1.e12,'f'},
|
char prefix;
|
||||||
{1.e9, 'p'},
|
} ranges[] = {{1.e12, 'f'}, {1.e9, 'p'}, {1.e6, 'n'}, {1.e3, 'u'},
|
||||||
{1.e6, 'n'},
|
{1.0, 'm'}, {1.e-3, ' '}, {1.e-6, 'k'}, {1.e-9, 'M'},
|
||||||
{1.e3, 'u'},
|
{1.e-12, 'G'}, {1.e-15, 'T'}, {1.e-18, 'P'}, {1.e-21, 'E'},
|
||||||
{1.0, 'm'},
|
{1.e-24, 'Z'}, {1.e-27, 'Y'}};
|
||||||
{1.e-3,' '},
|
|
||||||
{1.e-6,'k'},
|
|
||||||
{1.e-9,'M'},
|
|
||||||
{1.e-12,'G'},
|
|
||||||
{1.e-15,'T'},
|
|
||||||
{1.e-18,'P'},
|
|
||||||
{1.e-21,'E'},
|
|
||||||
{1.e-24,'Z'},
|
|
||||||
{1.e-27,'Y'}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (interval == 0.0)
|
if (interval == 0.0) {
|
||||||
{
|
os << std::setw(width - 3) << std::right << "0.00" << std::setw(3)
|
||||||
os << std::setw(width-3) << std::right << "0.00" << std::setw(3) << unit;
|
<< unit;
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool negative = false;
|
bool negative = false;
|
||||||
if (interval < 0.0)
|
if (interval < 0.0) {
|
||||||
{
|
|
||||||
negative = true;
|
negative = true;
|
||||||
interval = -interval;
|
interval = -interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<(int)(sizeof(ranges)/sizeof(ranges[0])); i++)
|
for (int i = 0; i < (int)(sizeof(ranges) / sizeof(ranges[0])); i++) {
|
||||||
{
|
if (interval * ranges[i].scale < 1.e0) {
|
||||||
if (interval*ranges[i].scale < 1.e0)
|
|
||||||
{
|
|
||||||
interval = interval * 1000.e0 * ranges[i].scale;
|
interval = interval * 1000.e0 * ranges[i].scale;
|
||||||
os << std::fixed << std::setprecision(2) << std::setw(width-3) << std::right <<
|
os << std::fixed << std::setprecision(2) << std::setw(width - 3)
|
||||||
(negative ? -interval : interval) << std::setw(2) << ranges[i].prefix << std::setw(1) << unit;
|
<< std::right << (negative ? -interval : interval) << std::setw(2)
|
||||||
|
<< ranges[i].prefix << std::setw(1) << unit;
|
||||||
|
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os << std::setprecision(2) << std::fixed << std::right << std::setw(width-3) << interval << std::setw(3) << unit;
|
os << std::setprecision(2) << std::fixed << std::right << std::setw(width - 3)
|
||||||
|
<< interval << std::setw(3) << unit;
|
||||||
|
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,52 +16,56 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
|
||||||
|
#include "kmp_os.h"
|
||||||
|
#include <limits>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <limits>
|
|
||||||
#include "kmp_os.h"
|
|
||||||
#if KMP_HAVE_X86INTRIN_H
|
#if KMP_HAVE_X86INTRIN_H
|
||||||
# include <x86intrin.h>
|
#include <x86intrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class tsc_tick_count {
|
class tsc_tick_count {
|
||||||
private:
|
private:
|
||||||
int64_t my_count;
|
int64_t my_count;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class tsc_interval_t {
|
class tsc_interval_t {
|
||||||
int64_t value;
|
int64_t value;
|
||||||
explicit tsc_interval_t(int64_t _value) : value(_value) {}
|
explicit tsc_interval_t(int64_t _value) : value(_value) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
tsc_interval_t() : value(0) {}; // Construct 0 time duration
|
tsc_interval_t() : value(0){}; // Construct 0 time duration
|
||||||
#if KMP_HAVE_TICK_TIME
|
#if KMP_HAVE_TICK_TIME
|
||||||
double seconds() const; // Return the length of a time interval in seconds
|
double seconds() const; // Return the length of a time interval in seconds
|
||||||
#endif
|
#endif
|
||||||
double ticks() const { return double(value); }
|
double ticks() const { return double(value); }
|
||||||
int64_t getValue() const { return value; }
|
int64_t getValue() const { return value; }
|
||||||
tsc_interval_t& operator=(int64_t nvalue) { value = nvalue; return *this; }
|
tsc_interval_t &operator=(int64_t nvalue) {
|
||||||
|
value = nvalue;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
friend class tsc_tick_count;
|
friend class tsc_tick_count;
|
||||||
|
|
||||||
friend tsc_interval_t operator-(const tsc_tick_count& t1,
|
friend tsc_interval_t operator-(const tsc_tick_count &t1,
|
||||||
const tsc_tick_count& t0);
|
const tsc_tick_count &t0);
|
||||||
friend tsc_interval_t operator-(const tsc_tick_count::tsc_interval_t& i1,
|
friend tsc_interval_t operator-(const tsc_tick_count::tsc_interval_t &i1,
|
||||||
const tsc_tick_count::tsc_interval_t& i0);
|
const tsc_tick_count::tsc_interval_t &i0);
|
||||||
friend tsc_interval_t& operator+=(tsc_tick_count::tsc_interval_t& i1,
|
friend tsc_interval_t &operator+=(tsc_tick_count::tsc_interval_t &i1,
|
||||||
const tsc_tick_count::tsc_interval_t& i0);
|
const tsc_tick_count::tsc_interval_t &i0);
|
||||||
};
|
};
|
||||||
|
|
||||||
#if KMP_HAVE___BUILTIN_READCYCLECOUNTER
|
#if KMP_HAVE___BUILTIN_READCYCLECOUNTER
|
||||||
tsc_tick_count() : my_count(static_cast<int64_t>(__builtin_readcyclecounter())) {}
|
tsc_tick_count()
|
||||||
|
: my_count(static_cast<int64_t>(__builtin_readcyclecounter())) {}
|
||||||
#elif KMP_HAVE___RDTSC
|
#elif KMP_HAVE___RDTSC
|
||||||
tsc_tick_count() : my_count(static_cast<int64_t>(__rdtsc())) {};
|
tsc_tick_count() : my_count(static_cast<int64_t>(__rdtsc())){};
|
||||||
#else
|
#else
|
||||||
# error Must have high resolution timer defined
|
#error Must have high resolution timer defined
|
||||||
#endif
|
#endif
|
||||||
tsc_tick_count(int64_t value) : my_count(value) {};
|
tsc_tick_count(int64_t value) : my_count(value){};
|
||||||
int64_t getValue() const { return my_count; }
|
int64_t getValue() const { return my_count; }
|
||||||
tsc_tick_count later (tsc_tick_count const other) const {
|
tsc_tick_count later(tsc_tick_count const other) const {
|
||||||
return my_count > other.my_count ? (*this) : other;
|
return my_count > other.my_count ? (*this) : other;
|
||||||
}
|
}
|
||||||
tsc_tick_count earlier(tsc_tick_count const other) const {
|
tsc_tick_count earlier(tsc_tick_count const other) const {
|
||||||
|
|
@ -70,42 +74,44 @@ class tsc_tick_count {
|
||||||
#if KMP_HAVE_TICK_TIME
|
#if KMP_HAVE_TICK_TIME
|
||||||
static double tick_time(); // returns seconds per cycle (period) of clock
|
static double tick_time(); // returns seconds per cycle (period) of clock
|
||||||
#endif
|
#endif
|
||||||
static tsc_tick_count now() { return tsc_tick_count(); } // returns the rdtsc register value
|
static tsc_tick_count now() {
|
||||||
friend tsc_tick_count::tsc_interval_t operator-(const tsc_tick_count& t1, const tsc_tick_count& t0);
|
return tsc_tick_count();
|
||||||
|
} // returns the rdtsc register value
|
||||||
|
friend tsc_tick_count::tsc_interval_t operator-(const tsc_tick_count &t1,
|
||||||
|
const tsc_tick_count &t0);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline tsc_tick_count::tsc_interval_t operator-(const tsc_tick_count& t1, const tsc_tick_count& t0)
|
inline tsc_tick_count::tsc_interval_t operator-(const tsc_tick_count &t1,
|
||||||
{
|
const tsc_tick_count &t0) {
|
||||||
return tsc_tick_count::tsc_interval_t( t1.my_count-t0.my_count );
|
return tsc_tick_count::tsc_interval_t(t1.my_count - t0.my_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline tsc_tick_count::tsc_interval_t operator-(const tsc_tick_count::tsc_interval_t& i1, const tsc_tick_count::tsc_interval_t& i0)
|
inline tsc_tick_count::tsc_interval_t
|
||||||
{
|
operator-(const tsc_tick_count::tsc_interval_t &i1,
|
||||||
return tsc_tick_count::tsc_interval_t( i1.value-i0.value );
|
const tsc_tick_count::tsc_interval_t &i0) {
|
||||||
|
return tsc_tick_count::tsc_interval_t(i1.value - i0.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline tsc_tick_count::tsc_interval_t& operator+=(tsc_tick_count::tsc_interval_t& i1, const tsc_tick_count::tsc_interval_t& i0)
|
inline tsc_tick_count::tsc_interval_t &
|
||||||
{
|
operator+=(tsc_tick_count::tsc_interval_t &i1,
|
||||||
|
const tsc_tick_count::tsc_interval_t &i0) {
|
||||||
i1.value += i0.value;
|
i1.value += i0.value;
|
||||||
return i1;
|
return i1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if KMP_HAVE_TICK_TIME
|
#if KMP_HAVE_TICK_TIME
|
||||||
inline double tsc_tick_count::tsc_interval_t::seconds() const
|
inline double tsc_tick_count::tsc_interval_t::seconds() const {
|
||||||
{
|
return value * tick_time();
|
||||||
return value*tick_time();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern std::string formatSI(double interval, int width, char unit);
|
extern std::string formatSI(double interval, int width, char unit);
|
||||||
|
|
||||||
inline std::string formatSeconds(double interval, int width)
|
inline std::string formatSeconds(double interval, int width) {
|
||||||
{
|
|
||||||
return formatSI(interval, width, 'S');
|
return formatSI(interval, width, 'S');
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string formatTicks(double interval, int width)
|
inline std::string formatTicks(double interval, int width) {
|
||||||
{
|
|
||||||
return formatSI(interval, width, 'T');
|
return formatSI(interval, width, 'T');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -16,104 +16,112 @@
|
||||||
#ifndef KMP_STR_H
|
#ifndef KMP_STR_H
|
||||||
#define KMP_STR_H
|
#define KMP_STR_H
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "kmp_os.h"
|
#include "kmp_os.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
# define strdup _strdup
|
#define strdup _strdup
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* some macros to replace ctype.h functions */
|
/* some macros to replace ctype.h functions */
|
||||||
#define TOLOWER(c) ((((c) >= 'A') && ((c) <= 'Z')) ? ((c) + 'a' - 'A') : (c))
|
#define TOLOWER(c) ((((c) >= 'A') && ((c) <= 'Z')) ? ((c) + 'a' - 'A') : (c))
|
||||||
|
|
||||||
struct kmp_str_buf {
|
struct kmp_str_buf {
|
||||||
char * str; // Pointer to buffer content, read only.
|
char *str; // Pointer to buffer content, read only.
|
||||||
unsigned int size; // Do not change this field!
|
unsigned int size; // Do not change this field!
|
||||||
int used; // Number of characters printed to buffer, read only.
|
int used; // Number of characters printed to buffer, read only.
|
||||||
char bulk[ 512 ]; // Do not use this field!
|
char bulk[512]; // Do not use this field!
|
||||||
}; // struct kmp_str_buf
|
}; // struct kmp_str_buf
|
||||||
typedef struct kmp_str_buf kmp_str_buf_t;
|
typedef struct kmp_str_buf kmp_str_buf_t;
|
||||||
|
|
||||||
#define __kmp_str_buf_init( b ) { (b)->str = (b)->bulk; (b)->size = sizeof( (b)->bulk ); (b)->used = 0; (b)->bulk[ 0 ] = 0; }
|
#define __kmp_str_buf_init(b) \
|
||||||
|
{ \
|
||||||
|
(b)->str = (b)->bulk; \
|
||||||
|
(b)->size = sizeof((b)->bulk); \
|
||||||
|
(b)->used = 0; \
|
||||||
|
(b)->bulk[0] = 0; \
|
||||||
|
}
|
||||||
|
|
||||||
void __kmp_str_buf_clear( kmp_str_buf_t * buffer );
|
void __kmp_str_buf_clear(kmp_str_buf_t *buffer);
|
||||||
void __kmp_str_buf_reserve( kmp_str_buf_t * buffer, int size );
|
void __kmp_str_buf_reserve(kmp_str_buf_t *buffer, int size);
|
||||||
void __kmp_str_buf_detach( kmp_str_buf_t * buffer );
|
void __kmp_str_buf_detach(kmp_str_buf_t *buffer);
|
||||||
void __kmp_str_buf_free( kmp_str_buf_t * buffer );
|
void __kmp_str_buf_free(kmp_str_buf_t *buffer);
|
||||||
void __kmp_str_buf_cat( kmp_str_buf_t * buffer, char const * str, int len );
|
void __kmp_str_buf_cat(kmp_str_buf_t *buffer, char const *str, int len);
|
||||||
void __kmp_str_buf_vprint( kmp_str_buf_t * buffer, char const * format, va_list args );
|
void __kmp_str_buf_vprint(kmp_str_buf_t *buffer, char const *format,
|
||||||
void __kmp_str_buf_print( kmp_str_buf_t * buffer, char const * format, ... );
|
va_list args);
|
||||||
void __kmp_str_buf_print_size( kmp_str_buf_t * buffer, size_t size );
|
void __kmp_str_buf_print(kmp_str_buf_t *buffer, char const *format, ...);
|
||||||
|
void __kmp_str_buf_print_size(kmp_str_buf_t *buffer, size_t size);
|
||||||
|
|
||||||
/*
|
/* File name parser.
|
||||||
File name parser. Usage:
|
Usage:
|
||||||
|
|
||||||
kmp_str_fname_t fname = __kmp_str_fname_init( path );
|
kmp_str_fname_t fname = __kmp_str_fname_init( path );
|
||||||
// Use fname.path (copy of original path ), fname.dir, fname.base.
|
// Use fname.path (copy of original path ), fname.dir, fname.base.
|
||||||
// Note fname.dir concatenated with fname.base gives exact copy of path.
|
// Note fname.dir concatenated with fname.base gives exact copy of path.
|
||||||
__kmp_str_fname_free( & fname );
|
__kmp_str_fname_free( & fname );
|
||||||
|
|
||||||
*/
|
*/
|
||||||
struct kmp_str_fname {
|
struct kmp_str_fname {
|
||||||
char * path;
|
char *path;
|
||||||
char * dir;
|
char *dir;
|
||||||
char * base;
|
char *base;
|
||||||
}; // struct kmp_str_fname
|
}; // struct kmp_str_fname
|
||||||
typedef struct kmp_str_fname kmp_str_fname_t;
|
typedef struct kmp_str_fname kmp_str_fname_t;
|
||||||
void __kmp_str_fname_init( kmp_str_fname_t * fname, char const * path );
|
void __kmp_str_fname_init(kmp_str_fname_t *fname, char const *path);
|
||||||
void __kmp_str_fname_free( kmp_str_fname_t * fname );
|
void __kmp_str_fname_free(kmp_str_fname_t *fname);
|
||||||
// Compares file name with specified patern. If pattern is NULL, any fname matched.
|
// Compares file name with specified patern. If pattern is NULL, any fname
|
||||||
int __kmp_str_fname_match( kmp_str_fname_t const * fname, char const * pattern );
|
// matched.
|
||||||
|
int __kmp_str_fname_match(kmp_str_fname_t const *fname, char const *pattern);
|
||||||
|
|
||||||
/*
|
/* The compiler provides source locations in string form
|
||||||
The compiler provides source locations in string form ";file;func;line;col;;". It not not
|
";file;func;line;col;;". It is not convenient for manupulation. This
|
||||||
convenient for manupulation. These structure keeps source location in more convenient form.
|
structure keeps source location in more convenient form.
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
kmp_str_loc_t loc = __kmp_str_loc_init( ident->psource, 0 );
|
kmp_str_loc_t loc = __kmp_str_loc_init( ident->psource, 0 );
|
||||||
// use loc.file, loc.func, loc.line, loc.col.
|
// use loc.file, loc.func, loc.line, loc.col.
|
||||||
// loc.fname is available if the second argument of __kmp_str_loc_init is true.
|
// loc.fname is available if second argument of __kmp_str_loc_init is true.
|
||||||
__kmp_str_loc_free( & loc );
|
__kmp_str_loc_free( & loc );
|
||||||
|
|
||||||
If psource is NULL or does not follow format above, file and/or func may be NULL pointers.
|
If psource is NULL or does not follow format above, file and/or func may be
|
||||||
|
NULL pointers.
|
||||||
*/
|
*/
|
||||||
struct kmp_str_loc {
|
struct kmp_str_loc {
|
||||||
char * _bulk; // Do not use thid field.
|
char *_bulk; // Do not use thid field.
|
||||||
kmp_str_fname_t fname; // Will be initialized if init_fname is true.
|
kmp_str_fname_t fname; // Will be initialized if init_fname is true.
|
||||||
char * file;
|
char *file;
|
||||||
char * func;
|
char *func;
|
||||||
int line;
|
int line;
|
||||||
int col;
|
int col;
|
||||||
}; // struct kmp_str_loc
|
}; // struct kmp_str_loc
|
||||||
typedef struct kmp_str_loc kmp_str_loc_t;
|
typedef struct kmp_str_loc kmp_str_loc_t;
|
||||||
kmp_str_loc_t __kmp_str_loc_init( char const * psource, int init_fname );
|
kmp_str_loc_t __kmp_str_loc_init(char const *psource, int init_fname);
|
||||||
void __kmp_str_loc_free( kmp_str_loc_t * loc );
|
void __kmp_str_loc_free(kmp_str_loc_t *loc);
|
||||||
|
|
||||||
int __kmp_str_eqf( char const * lhs, char const * rhs );
|
int __kmp_str_eqf(char const *lhs, char const *rhs);
|
||||||
char * __kmp_str_format( char const * format, ... );
|
char *__kmp_str_format(char const *format, ...);
|
||||||
void __kmp_str_free( char const * * str );
|
void __kmp_str_free(char const **str);
|
||||||
int __kmp_str_match( char const * target, int len, char const * data );
|
int __kmp_str_match(char const *target, int len, char const *data);
|
||||||
int __kmp_str_match_false( char const * data );
|
int __kmp_str_match_false(char const *data);
|
||||||
int __kmp_str_match_true( char const * data );
|
int __kmp_str_match_true(char const *data);
|
||||||
void __kmp_str_replace( char * str, char search_for, char replace_with );
|
void __kmp_str_replace(char *str, char search_for, char replace_with);
|
||||||
void __kmp_str_split( char * str, char delim, char ** head, char ** tail );
|
void __kmp_str_split(char *str, char delim, char **head, char **tail);
|
||||||
char * __kmp_str_token( char * str, char const * delim, char ** buf );
|
char *__kmp_str_token(char *str, char const *delim, char **buf);
|
||||||
int __kmp_str_to_int( char const * str, char sentinel );
|
int __kmp_str_to_int(char const *str, char sentinel);
|
||||||
|
|
||||||
void __kmp_str_to_size( char const * str, size_t * out, size_t dfactor, char const * * error );
|
void __kmp_str_to_size(char const *str, size_t *out, size_t dfactor,
|
||||||
void __kmp_str_to_uint( char const * str, kmp_uint64 * out, char const * * error );
|
char const **error);
|
||||||
|
void __kmp_str_to_uint(char const *str, kmp_uint64 *out, char const **error);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif // KMP_STR_H
|
#endif // KMP_STR_H
|
||||||
|
|
||||||
// end of file //
|
// end of file //
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,18 +13,18 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "omp.h" // Function renamings.
|
|
||||||
#include "kmp.h" // KMP_DEFAULT_STKSIZE
|
#include "kmp.h" // KMP_DEFAULT_STKSIZE
|
||||||
#include "kmp_stub.h"
|
#include "kmp_stub.h"
|
||||||
|
#include "omp.h" // Function renamings.
|
||||||
|
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Moved from omp.h
|
// Moved from omp.h
|
||||||
|
|
@ -54,13 +54,12 @@ static double frequency = 0.0;
|
||||||
static size_t __kmps_init() {
|
static size_t __kmps_init() {
|
||||||
static int initialized = 0;
|
static int initialized = 0;
|
||||||
static size_t dummy = 0;
|
static size_t dummy = 0;
|
||||||
if ( ! initialized ) {
|
if (!initialized) {
|
||||||
|
|
||||||
// TODO: Analyze KMP_VERSION environment variable, print
|
// TODO: Analyze KMP_VERSION environment variable, print
|
||||||
// __kmp_version_copyright and __kmp_version_build_time.
|
// __kmp_version_copyright and __kmp_version_build_time.
|
||||||
// WARNING: Do not use "fprintf( stderr, ... )" because it will cause
|
// WARNING: Do not use "fprintf(stderr, ...)" because it will cause
|
||||||
// unresolved "__iob" symbol (see C70080). We need to extract
|
// unresolved "__iob" symbol (see C70080). We need to extract __kmp_printf()
|
||||||
// __kmp_printf() stuff from kmp_runtime.cpp and use it.
|
// stuff from kmp_runtime.cpp and use it.
|
||||||
|
|
||||||
// Trick with dummy variable forces linker to keep __kmp_version_copyright
|
// Trick with dummy variable forces linker to keep __kmp_version_copyright
|
||||||
// and __kmp_version_build_time strings in executable file (in case of
|
// and __kmp_version_build_time strings in executable file (in case of
|
||||||
|
|
@ -68,13 +67,13 @@ static size_t __kmps_init() {
|
||||||
// variable should be deleted, function should return void.
|
// variable should be deleted, function should return void.
|
||||||
dummy = __kmp_version_copyright - __kmp_version_build_time;
|
dummy = __kmp_version_copyright - __kmp_version_build_time;
|
||||||
|
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
LARGE_INTEGER freq;
|
LARGE_INTEGER freq;
|
||||||
BOOL status = QueryPerformanceFrequency( & freq );
|
BOOL status = QueryPerformanceFrequency(&freq);
|
||||||
if ( status ) {
|
if (status) {
|
||||||
frequency = double( freq.QuadPart );
|
frequency = double(freq.QuadPart);
|
||||||
}; // if
|
}; // if
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
}; // if
|
}; // if
|
||||||
|
|
@ -84,28 +83,67 @@ static size_t __kmps_init() {
|
||||||
#define i __kmps_init();
|
#define i __kmps_init();
|
||||||
|
|
||||||
/* set API functions */
|
/* set API functions */
|
||||||
void omp_set_num_threads( omp_int_t num_threads ) { i; }
|
void omp_set_num_threads(omp_int_t num_threads) { i; }
|
||||||
void omp_set_dynamic( omp_int_t dynamic ) { i; __kmps_set_dynamic( dynamic ); }
|
void omp_set_dynamic(omp_int_t dynamic) {
|
||||||
void omp_set_nested( omp_int_t nested ) { i; __kmps_set_nested( nested ); }
|
i;
|
||||||
void omp_set_max_active_levels( omp_int_t max_active_levels ) { i; }
|
__kmps_set_dynamic(dynamic);
|
||||||
void omp_set_schedule( omp_sched_t kind, omp_int_t modifier ) { i; __kmps_set_schedule( (kmp_sched_t)kind, modifier ); }
|
}
|
||||||
int omp_get_ancestor_thread_num( omp_int_t level ) { i; return ( level ) ? ( -1 ) : ( 0 ); }
|
void omp_set_nested(omp_int_t nested) {
|
||||||
int omp_get_team_size( omp_int_t level ) { i; return ( level ) ? ( -1 ) : ( 1 ); }
|
i;
|
||||||
int kmpc_set_affinity_mask_proc( int proc, void **mask ) { i; return -1; }
|
__kmps_set_nested(nested);
|
||||||
int kmpc_unset_affinity_mask_proc( int proc, void **mask ) { i; return -1; }
|
}
|
||||||
int kmpc_get_affinity_mask_proc( int proc, void **mask ) { i; return -1; }
|
void omp_set_max_active_levels(omp_int_t max_active_levels) { i; }
|
||||||
|
void omp_set_schedule(omp_sched_t kind, omp_int_t modifier) {
|
||||||
|
i;
|
||||||
|
__kmps_set_schedule((kmp_sched_t)kind, modifier);
|
||||||
|
}
|
||||||
|
int omp_get_ancestor_thread_num(omp_int_t level) {
|
||||||
|
i;
|
||||||
|
return (level) ? (-1) : (0);
|
||||||
|
}
|
||||||
|
int omp_get_team_size(omp_int_t level) {
|
||||||
|
i;
|
||||||
|
return (level) ? (-1) : (1);
|
||||||
|
}
|
||||||
|
int kmpc_set_affinity_mask_proc(int proc, void **mask) {
|
||||||
|
i;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
int kmpc_unset_affinity_mask_proc(int proc, void **mask) {
|
||||||
|
i;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
int kmpc_get_affinity_mask_proc(int proc, void **mask) {
|
||||||
|
i;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* kmp API functions */
|
/* kmp API functions */
|
||||||
void kmp_set_stacksize( omp_int_t arg ) { i; __kmps_set_stacksize( arg ); }
|
void kmp_set_stacksize(omp_int_t arg) {
|
||||||
void kmp_set_stacksize_s( size_t arg ) { i; __kmps_set_stacksize( arg ); }
|
i;
|
||||||
void kmp_set_blocktime( omp_int_t arg ) { i; __kmps_set_blocktime( arg ); }
|
__kmps_set_stacksize(arg);
|
||||||
void kmp_set_library( omp_int_t arg ) { i; __kmps_set_library( arg ); }
|
}
|
||||||
void kmp_set_defaults( char const * str ) { i; }
|
void kmp_set_stacksize_s(size_t arg) {
|
||||||
void kmp_set_disp_num_buffers( omp_int_t arg ) { i; }
|
i;
|
||||||
|
__kmps_set_stacksize(arg);
|
||||||
|
}
|
||||||
|
void kmp_set_blocktime(omp_int_t arg) {
|
||||||
|
i;
|
||||||
|
__kmps_set_blocktime(arg);
|
||||||
|
}
|
||||||
|
void kmp_set_library(omp_int_t arg) {
|
||||||
|
i;
|
||||||
|
__kmps_set_library(arg);
|
||||||
|
}
|
||||||
|
void kmp_set_defaults(char const *str) { i; }
|
||||||
|
void kmp_set_disp_num_buffers(omp_int_t arg) { i; }
|
||||||
|
|
||||||
/* KMP memory management functions. */
|
/* KMP memory management functions. */
|
||||||
void * kmp_malloc( size_t size ) { i; return malloc( size ); }
|
void *kmp_malloc(size_t size) {
|
||||||
void * kmp_aligned_malloc( size_t sz, size_t a ) {
|
i;
|
||||||
|
return malloc(size);
|
||||||
|
}
|
||||||
|
void *kmp_aligned_malloc(size_t sz, size_t a) {
|
||||||
i;
|
i;
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
errno = ENOSYS; // not supported
|
errno = ENOSYS; // not supported
|
||||||
|
|
@ -113,73 +151,82 @@ void * kmp_aligned_malloc( size_t sz, size_t a ) {
|
||||||
#else
|
#else
|
||||||
void *res;
|
void *res;
|
||||||
int err;
|
int err;
|
||||||
if( err = posix_memalign( &res, a, sz ) ) {
|
if (err = posix_memalign(&res, a, sz)) {
|
||||||
errno = err; // can be EINVAL or ENOMEM
|
errno = err; // can be EINVAL or ENOMEM
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void * kmp_calloc( size_t nelem, size_t elsize ) { i; return calloc( nelem, elsize ); }
|
void *kmp_calloc(size_t nelem, size_t elsize) {
|
||||||
void * kmp_realloc( void *ptr, size_t size ) { i; return realloc( ptr, size ); }
|
i;
|
||||||
void kmp_free( void * ptr ) { i; free( ptr ); }
|
return calloc(nelem, elsize);
|
||||||
|
}
|
||||||
|
void *kmp_realloc(void *ptr, size_t size) {
|
||||||
|
i;
|
||||||
|
return realloc(ptr, size);
|
||||||
|
}
|
||||||
|
void kmp_free(void *ptr) {
|
||||||
|
i;
|
||||||
|
free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
static int __kmps_blocktime = INT_MAX;
|
static int __kmps_blocktime = INT_MAX;
|
||||||
|
|
||||||
void __kmps_set_blocktime( int arg ) {
|
void __kmps_set_blocktime(int arg) {
|
||||||
i;
|
i;
|
||||||
__kmps_blocktime = arg;
|
__kmps_blocktime = arg;
|
||||||
} // __kmps_set_blocktime
|
} // __kmps_set_blocktime
|
||||||
|
|
||||||
int __kmps_get_blocktime( void ) {
|
int __kmps_get_blocktime(void) {
|
||||||
i;
|
i;
|
||||||
return __kmps_blocktime;
|
return __kmps_blocktime;
|
||||||
} // __kmps_get_blocktime
|
} // __kmps_get_blocktime
|
||||||
|
|
||||||
static int __kmps_dynamic = 0;
|
static int __kmps_dynamic = 0;
|
||||||
|
|
||||||
void __kmps_set_dynamic( int arg ) {
|
void __kmps_set_dynamic(int arg) {
|
||||||
i;
|
i;
|
||||||
__kmps_dynamic = arg;
|
__kmps_dynamic = arg;
|
||||||
} // __kmps_set_dynamic
|
} // __kmps_set_dynamic
|
||||||
|
|
||||||
int __kmps_get_dynamic( void ) {
|
int __kmps_get_dynamic(void) {
|
||||||
i;
|
i;
|
||||||
return __kmps_dynamic;
|
return __kmps_dynamic;
|
||||||
} // __kmps_get_dynamic
|
} // __kmps_get_dynamic
|
||||||
|
|
||||||
static int __kmps_library = 1000;
|
static int __kmps_library = 1000;
|
||||||
|
|
||||||
void __kmps_set_library( int arg ) {
|
void __kmps_set_library(int arg) {
|
||||||
i;
|
i;
|
||||||
__kmps_library = arg;
|
__kmps_library = arg;
|
||||||
} // __kmps_set_library
|
} // __kmps_set_library
|
||||||
|
|
||||||
int __kmps_get_library( void ) {
|
int __kmps_get_library(void) {
|
||||||
i;
|
i;
|
||||||
return __kmps_library;
|
return __kmps_library;
|
||||||
} // __kmps_get_library
|
} // __kmps_get_library
|
||||||
|
|
||||||
static int __kmps_nested = 0;
|
static int __kmps_nested = 0;
|
||||||
|
|
||||||
void __kmps_set_nested( int arg ) {
|
void __kmps_set_nested(int arg) {
|
||||||
i;
|
i;
|
||||||
__kmps_nested = arg;
|
__kmps_nested = arg;
|
||||||
} // __kmps_set_nested
|
} // __kmps_set_nested
|
||||||
|
|
||||||
int __kmps_get_nested( void ) {
|
int __kmps_get_nested(void) {
|
||||||
i;
|
i;
|
||||||
return __kmps_nested;
|
return __kmps_nested;
|
||||||
} // __kmps_get_nested
|
} // __kmps_get_nested
|
||||||
|
|
||||||
static size_t __kmps_stacksize = KMP_DEFAULT_STKSIZE;
|
static size_t __kmps_stacksize = KMP_DEFAULT_STKSIZE;
|
||||||
|
|
||||||
void __kmps_set_stacksize( int arg ) {
|
void __kmps_set_stacksize(int arg) {
|
||||||
i;
|
i;
|
||||||
__kmps_stacksize = arg;
|
__kmps_stacksize = arg;
|
||||||
} // __kmps_set_stacksize
|
} // __kmps_set_stacksize
|
||||||
|
|
||||||
int __kmps_get_stacksize( void ) {
|
int __kmps_get_stacksize(void) {
|
||||||
i;
|
i;
|
||||||
return __kmps_stacksize;
|
return __kmps_stacksize;
|
||||||
} // __kmps_get_stacksize
|
} // __kmps_get_stacksize
|
||||||
|
|
@ -187,84 +234,83 @@ int __kmps_get_stacksize( void ) {
|
||||||
static kmp_sched_t __kmps_sched_kind = kmp_sched_default;
|
static kmp_sched_t __kmps_sched_kind = kmp_sched_default;
|
||||||
static int __kmps_sched_modifier = 0;
|
static int __kmps_sched_modifier = 0;
|
||||||
|
|
||||||
void __kmps_set_schedule( kmp_sched_t kind, int modifier ) {
|
void __kmps_set_schedule(kmp_sched_t kind, int modifier) {
|
||||||
i;
|
i;
|
||||||
__kmps_sched_kind = kind;
|
__kmps_sched_kind = kind;
|
||||||
__kmps_sched_modifier = modifier;
|
__kmps_sched_modifier = modifier;
|
||||||
} // __kmps_set_schedule
|
} // __kmps_set_schedule
|
||||||
|
|
||||||
void __kmps_get_schedule( kmp_sched_t *kind, int *modifier ) {
|
void __kmps_get_schedule(kmp_sched_t *kind, int *modifier) {
|
||||||
i;
|
i;
|
||||||
*kind = __kmps_sched_kind;
|
*kind = __kmps_sched_kind;
|
||||||
*modifier = __kmps_sched_modifier;
|
*modifier = __kmps_sched_modifier;
|
||||||
} // __kmps_get_schedule
|
} // __kmps_get_schedule
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
|
|
||||||
static kmp_proc_bind_t __kmps_proc_bind = proc_bind_false;
|
static kmp_proc_bind_t __kmps_proc_bind = proc_bind_false;
|
||||||
|
|
||||||
void __kmps_set_proc_bind( kmp_proc_bind_t arg ) {
|
void __kmps_set_proc_bind(kmp_proc_bind_t arg) {
|
||||||
i;
|
i;
|
||||||
__kmps_proc_bind = arg;
|
__kmps_proc_bind = arg;
|
||||||
} // __kmps_set_proc_bind
|
} // __kmps_set_proc_bind
|
||||||
|
|
||||||
kmp_proc_bind_t __kmps_get_proc_bind( void ) {
|
kmp_proc_bind_t __kmps_get_proc_bind(void) {
|
||||||
i;
|
i;
|
||||||
return __kmps_proc_bind;
|
return __kmps_proc_bind;
|
||||||
} // __kmps_get_proc_bind
|
} // __kmps_get_proc_bind
|
||||||
|
|
||||||
#endif /* OMP_40_ENABLED */
|
#endif /* OMP_40_ENABLED */
|
||||||
|
|
||||||
double __kmps_get_wtime( void ) {
|
double __kmps_get_wtime(void) {
|
||||||
// Elapsed wall clock time (in second) from "sometime in the past".
|
// Elapsed wall clock time (in second) from "sometime in the past".
|
||||||
double wtime = 0.0;
|
double wtime = 0.0;
|
||||||
i;
|
i;
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
if ( frequency > 0.0 ) {
|
if (frequency > 0.0) {
|
||||||
LARGE_INTEGER now;
|
LARGE_INTEGER now;
|
||||||
BOOL status = QueryPerformanceCounter( & now );
|
BOOL status = QueryPerformanceCounter(&now);
|
||||||
if ( status ) {
|
if (status) {
|
||||||
wtime = double( now.QuadPart ) / frequency;
|
wtime = double(now.QuadPart) / frequency;
|
||||||
}; // if
|
}; // if
|
||||||
}; // if
|
}; // if
|
||||||
#else
|
#else
|
||||||
// gettimeofday() returns seconds and microseconds since the Epoch.
|
// gettimeofday() returns seconds and microseconds since the Epoch.
|
||||||
struct timeval tval;
|
struct timeval tval;
|
||||||
int rc;
|
int rc;
|
||||||
rc = gettimeofday( & tval, NULL );
|
rc = gettimeofday(&tval, NULL);
|
||||||
if ( rc == 0 ) {
|
if (rc == 0) {
|
||||||
wtime = (double)( tval.tv_sec ) + 1.0E-06 * (double)( tval.tv_usec );
|
wtime = (double)(tval.tv_sec) + 1.0E-06 * (double)(tval.tv_usec);
|
||||||
} else {
|
} else {
|
||||||
// TODO: Assert or abort here.
|
// TODO: Assert or abort here.
|
||||||
}; // if
|
}; // if
|
||||||
#endif
|
#endif
|
||||||
return wtime;
|
return wtime;
|
||||||
}; // __kmps_get_wtime
|
}; // __kmps_get_wtime
|
||||||
|
|
||||||
double __kmps_get_wtick( void ) {
|
double __kmps_get_wtick(void) {
|
||||||
// Number of seconds between successive clock ticks.
|
// Number of seconds between successive clock ticks.
|
||||||
double wtick = 0.0;
|
double wtick = 0.0;
|
||||||
i;
|
i;
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
{
|
{
|
||||||
DWORD increment;
|
DWORD increment;
|
||||||
DWORD adjustment;
|
DWORD adjustment;
|
||||||
BOOL disabled;
|
BOOL disabled;
|
||||||
BOOL rc;
|
BOOL rc;
|
||||||
rc = GetSystemTimeAdjustment( & adjustment, & increment, & disabled );
|
rc = GetSystemTimeAdjustment(&adjustment, &increment, &disabled);
|
||||||
if ( rc ) {
|
if (rc) {
|
||||||
wtick = 1.0E-07 * (double)( disabled ? increment : adjustment );
|
wtick = 1.0E-07 * (double)(disabled ? increment : adjustment);
|
||||||
} else {
|
} else {
|
||||||
// TODO: Assert or abort here.
|
// TODO: Assert or abort here.
|
||||||
wtick = 1.0E-03;
|
wtick = 1.0E-03;
|
||||||
}; // if
|
}; // if
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// TODO: gettimeofday() returns in microseconds, but what the precision?
|
// TODO: gettimeofday() returns in microseconds, but what the precision?
|
||||||
wtick = 1.0E-06;
|
wtick = 1.0E-06;
|
||||||
#endif
|
#endif
|
||||||
return wtick;
|
return wtick;
|
||||||
}; // __kmps_get_wtick
|
}; // __kmps_get_wtick
|
||||||
|
|
||||||
// end of file //
|
// end of file //
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,18 +17,18 @@
|
||||||
#define KMP_STUB_H
|
#define KMP_STUB_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
void __kmps_set_blocktime( int arg );
|
void __kmps_set_blocktime(int arg);
|
||||||
int __kmps_get_blocktime( void );
|
int __kmps_get_blocktime(void);
|
||||||
void __kmps_set_dynamic( int arg );
|
void __kmps_set_dynamic(int arg);
|
||||||
int __kmps_get_dynamic( void );
|
int __kmps_get_dynamic(void);
|
||||||
void __kmps_set_library( int arg );
|
void __kmps_set_library(int arg);
|
||||||
int __kmps_get_library( void );
|
int __kmps_get_library(void);
|
||||||
void __kmps_set_nested( int arg );
|
void __kmps_set_nested(int arg);
|
||||||
int __kmps_get_nested( void );
|
int __kmps_get_nested(void);
|
||||||
void __kmps_set_stacksize( int arg );
|
void __kmps_set_stacksize(int arg);
|
||||||
int __kmps_get_stacksize();
|
int __kmps_get_stacksize();
|
||||||
|
|
||||||
#ifndef KMP_SCHED_TYPE_DEFINED
|
#ifndef KMP_SCHED_TYPE_DEFINED
|
||||||
|
|
@ -41,19 +41,19 @@ typedef enum kmp_sched {
|
||||||
kmp_sched_default = kmp_sched_static // default scheduling
|
kmp_sched_default = kmp_sched_static // default scheduling
|
||||||
} kmp_sched_t;
|
} kmp_sched_t;
|
||||||
#endif
|
#endif
|
||||||
void __kmps_set_schedule( kmp_sched_t kind, int modifier );
|
void __kmps_set_schedule(kmp_sched_t kind, int modifier);
|
||||||
void __kmps_get_schedule( kmp_sched_t *kind, int *modifier );
|
void __kmps_get_schedule(kmp_sched_t *kind, int *modifier);
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
void __kmps_set_proc_bind( kmp_proc_bind_t arg );
|
void __kmps_set_proc_bind(kmp_proc_bind_t arg);
|
||||||
kmp_proc_bind_t __kmps_get_proc_bind( void );
|
kmp_proc_bind_t __kmps_get_proc_bind(void);
|
||||||
#endif /* OMP_40_ENABLED */
|
#endif /* OMP_40_ENABLED */
|
||||||
|
|
||||||
double __kmps_get_wtime();
|
double __kmps_get_wtime();
|
||||||
double __kmps_get_wtick();
|
double __kmps_get_wtick();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif // KMP_STUB_H
|
#endif // KMP_STUB_H
|
||||||
|
|
|
||||||
|
|
@ -21,21 +21,22 @@
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
|
|
||||||
//TODO: Improve memory allocation? keep a list of pre-allocated structures? allocate in blocks? re-use list finished list entries?
|
// TODO: Improve memory allocation? keep a list of pre-allocated structures?
|
||||||
//TODO: don't use atomic ref counters for stack-allocated nodes.
|
// allocate in blocks? re-use list finished list entries?
|
||||||
//TODO: find an alternate to atomic refs for heap-allocated nodes?
|
// TODO: don't use atomic ref counters for stack-allocated nodes.
|
||||||
//TODO: Finish graph output support
|
// TODO: find an alternate to atomic refs for heap-allocated nodes?
|
||||||
//TODO: kmp_lock_t seems a tad to big (and heavy weight) for this. Check other runtime locks
|
// TODO: Finish graph output support
|
||||||
//TODO: Any ITT support needed?
|
// TODO: kmp_lock_t seems a tad to big (and heavy weight) for this. Check other
|
||||||
|
// runtime locks
|
||||||
|
// TODO: Any ITT support needed?
|
||||||
|
|
||||||
#ifdef KMP_SUPPORT_GRAPH_OUTPUT
|
#ifdef KMP_SUPPORT_GRAPH_OUTPUT
|
||||||
static kmp_int32 kmp_node_id_seed = 0;
|
static kmp_int32 kmp_node_id_seed = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void __kmp_init_node(kmp_depnode_t *node) {
|
||||||
__kmp_init_node ( kmp_depnode_t *node )
|
node->dn.task = NULL; // set to null initially, it will point to the right
|
||||||
{
|
// task once dependences have been processed
|
||||||
node->dn.task = NULL; // set to null initially, it will point to the right task once dependences have been processed
|
|
||||||
node->dn.successors = NULL;
|
node->dn.successors = NULL;
|
||||||
__kmp_init_lock(&node->dn.lock);
|
__kmp_init_lock(&node->dn.lock);
|
||||||
node->dn.nrefs = 1; // init creates the first reference to the node
|
node->dn.nrefs = 1; // init creates the first reference to the node
|
||||||
|
|
@ -44,55 +45,46 @@ __kmp_init_node ( kmp_depnode_t *node )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline kmp_depnode_t *
|
static inline kmp_depnode_t *__kmp_node_ref(kmp_depnode_t *node) {
|
||||||
__kmp_node_ref ( kmp_depnode_t *node )
|
|
||||||
{
|
|
||||||
KMP_TEST_THEN_INC32(&node->dn.nrefs);
|
KMP_TEST_THEN_INC32(&node->dn.nrefs);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void __kmp_node_deref(kmp_info_t *thread, kmp_depnode_t *node) {
|
||||||
__kmp_node_deref ( kmp_info_t *thread, kmp_depnode_t *node )
|
if (!node)
|
||||||
{
|
return;
|
||||||
if (!node) return;
|
|
||||||
|
|
||||||
kmp_int32 n = KMP_TEST_THEN_DEC32(&node->dn.nrefs) - 1;
|
kmp_int32 n = KMP_TEST_THEN_DEC32(&node->dn.nrefs) - 1;
|
||||||
if ( n == 0 ) {
|
if (n == 0) {
|
||||||
KMP_ASSERT(node->dn.nrefs == 0);
|
KMP_ASSERT(node->dn.nrefs == 0);
|
||||||
#if USE_FAST_MEMORY
|
#if USE_FAST_MEMORY
|
||||||
__kmp_fast_free(thread,node);
|
__kmp_fast_free(thread, node);
|
||||||
#else
|
#else
|
||||||
__kmp_thread_free(thread,node);
|
__kmp_thread_free(thread, node);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define KMP_ACQUIRE_DEPNODE(gtid,n) __kmp_acquire_lock(&(n)->dn.lock,(gtid))
|
#define KMP_ACQUIRE_DEPNODE(gtid, n) __kmp_acquire_lock(&(n)->dn.lock, (gtid))
|
||||||
#define KMP_RELEASE_DEPNODE(gtid,n) __kmp_release_lock(&(n)->dn.lock,(gtid))
|
#define KMP_RELEASE_DEPNODE(gtid, n) __kmp_release_lock(&(n)->dn.lock, (gtid))
|
||||||
|
|
||||||
static void
|
static void __kmp_depnode_list_free(kmp_info_t *thread, kmp_depnode_list *list);
|
||||||
__kmp_depnode_list_free ( kmp_info_t *thread, kmp_depnode_list *list );
|
|
||||||
|
|
||||||
enum {
|
enum { KMP_DEPHASH_OTHER_SIZE = 97, KMP_DEPHASH_MASTER_SIZE = 997 };
|
||||||
KMP_DEPHASH_OTHER_SIZE = 97,
|
|
||||||
KMP_DEPHASH_MASTER_SIZE = 997
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline kmp_int32
|
static inline kmp_int32 __kmp_dephash_hash(kmp_intptr_t addr, size_t hsize) {
|
||||||
__kmp_dephash_hash ( kmp_intptr_t addr, size_t hsize )
|
// TODO alternate to try: set = (((Addr64)(addrUsefulBits * 9.618)) %
|
||||||
{
|
// m_num_sets );
|
||||||
//TODO alternate to try: set = (((Addr64)(addrUsefulBits * 9.618)) % m_num_sets );
|
|
||||||
return ((addr >> 6) ^ (addr >> 2)) % hsize;
|
return ((addr >> 6) ^ (addr >> 2)) % hsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static kmp_dephash_t *
|
static kmp_dephash_t *__kmp_dephash_create(kmp_info_t *thread,
|
||||||
__kmp_dephash_create ( kmp_info_t *thread, kmp_taskdata_t *current_task )
|
kmp_taskdata_t *current_task) {
|
||||||
{
|
|
||||||
kmp_dephash_t *h;
|
kmp_dephash_t *h;
|
||||||
|
|
||||||
size_t h_size;
|
size_t h_size;
|
||||||
|
|
||||||
if ( current_task->td_flags.tasktype == TASK_IMPLICIT )
|
if (current_task->td_flags.tasktype == TASK_IMPLICIT)
|
||||||
h_size = KMP_DEPHASH_MASTER_SIZE;
|
h_size = KMP_DEPHASH_MASTER_SIZE;
|
||||||
else
|
else
|
||||||
h_size = KMP_DEPHASH_OTHER_SIZE;
|
h_size = KMP_DEPHASH_OTHER_SIZE;
|
||||||
|
|
@ -101,9 +93,9 @@ __kmp_dephash_create ( kmp_info_t *thread, kmp_taskdata_t *current_task )
|
||||||
h_size * sizeof(kmp_dephash_entry_t *) + sizeof(kmp_dephash_t);
|
h_size * sizeof(kmp_dephash_entry_t *) + sizeof(kmp_dephash_t);
|
||||||
|
|
||||||
#if USE_FAST_MEMORY
|
#if USE_FAST_MEMORY
|
||||||
h = (kmp_dephash_t *) __kmp_fast_allocate( thread, size );
|
h = (kmp_dephash_t *)__kmp_fast_allocate(thread, size);
|
||||||
#else
|
#else
|
||||||
h = (kmp_dephash_t *) __kmp_thread_malloc( thread, size );
|
h = (kmp_dephash_t *)__kmp_thread_malloc(thread, size);
|
||||||
#endif
|
#endif
|
||||||
h->size = h_size;
|
h->size = h_size;
|
||||||
|
|
||||||
|
|
@ -111,28 +103,26 @@ __kmp_dephash_create ( kmp_info_t *thread, kmp_taskdata_t *current_task )
|
||||||
h->nelements = 0;
|
h->nelements = 0;
|
||||||
h->nconflicts = 0;
|
h->nconflicts = 0;
|
||||||
#endif
|
#endif
|
||||||
h->buckets = (kmp_dephash_entry **)(h+1);
|
h->buckets = (kmp_dephash_entry **)(h + 1);
|
||||||
|
|
||||||
for ( size_t i = 0; i < h_size; i++ )
|
for (size_t i = 0; i < h_size; i++)
|
||||||
h->buckets[i] = 0;
|
h->buckets[i] = 0;
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void __kmp_dephash_free_entries(kmp_info_t *thread, kmp_dephash_t *h) {
|
||||||
__kmp_dephash_free_entries(kmp_info_t *thread, kmp_dephash_t *h)
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < h->size; i++) {
|
for (size_t i = 0; i < h->size; i++) {
|
||||||
if (h->buckets[i]) {
|
if (h->buckets[i]) {
|
||||||
kmp_dephash_entry_t *next;
|
kmp_dephash_entry_t *next;
|
||||||
for (kmp_dephash_entry_t *entry = h->buckets[i]; entry; entry = next) {
|
for (kmp_dephash_entry_t *entry = h->buckets[i]; entry; entry = next) {
|
||||||
next = entry->next_in_bucket;
|
next = entry->next_in_bucket;
|
||||||
__kmp_depnode_list_free(thread,entry->last_ins);
|
__kmp_depnode_list_free(thread, entry->last_ins);
|
||||||
__kmp_node_deref(thread,entry->last_out);
|
__kmp_node_deref(thread, entry->last_out);
|
||||||
#if USE_FAST_MEMORY
|
#if USE_FAST_MEMORY
|
||||||
__kmp_fast_free(thread,entry);
|
__kmp_fast_free(thread, entry);
|
||||||
#else
|
#else
|
||||||
__kmp_thread_free(thread,entry);
|
__kmp_thread_free(thread, entry);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
h->buckets[i] = 0;
|
h->buckets[i] = 0;
|
||||||
|
|
@ -140,32 +130,32 @@ __kmp_dephash_free_entries(kmp_info_t *thread, kmp_dephash_t *h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void __kmp_dephash_free(kmp_info_t *thread, kmp_dephash_t *h) {
|
||||||
__kmp_dephash_free(kmp_info_t *thread, kmp_dephash_t *h)
|
|
||||||
{
|
|
||||||
__kmp_dephash_free_entries(thread, h);
|
__kmp_dephash_free_entries(thread, h);
|
||||||
#if USE_FAST_MEMORY
|
#if USE_FAST_MEMORY
|
||||||
__kmp_fast_free(thread,h);
|
__kmp_fast_free(thread, h);
|
||||||
#else
|
#else
|
||||||
__kmp_thread_free(thread,h);
|
__kmp_thread_free(thread, h);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static kmp_dephash_entry *
|
static kmp_dephash_entry *
|
||||||
__kmp_dephash_find ( kmp_info_t *thread, kmp_dephash_t *h, kmp_intptr_t addr )
|
__kmp_dephash_find(kmp_info_t *thread, kmp_dephash_t *h, kmp_intptr_t addr) {
|
||||||
{
|
kmp_int32 bucket = __kmp_dephash_hash(addr, h->size);
|
||||||
kmp_int32 bucket = __kmp_dephash_hash(addr,h->size);
|
|
||||||
|
|
||||||
kmp_dephash_entry_t *entry;
|
kmp_dephash_entry_t *entry;
|
||||||
for ( entry = h->buckets[bucket]; entry; entry = entry->next_in_bucket )
|
for (entry = h->buckets[bucket]; entry; entry = entry->next_in_bucket)
|
||||||
if ( entry->addr == addr ) break;
|
if (entry->addr == addr)
|
||||||
|
break;
|
||||||
|
|
||||||
if ( entry == NULL ) {
|
if (entry == NULL) {
|
||||||
// create entry. This is only done by one thread so no locking required
|
// create entry. This is only done by one thread so no locking required
|
||||||
#if USE_FAST_MEMORY
|
#if USE_FAST_MEMORY
|
||||||
entry = (kmp_dephash_entry_t *) __kmp_fast_allocate( thread, sizeof(kmp_dephash_entry_t) );
|
entry = (kmp_dephash_entry_t *)__kmp_fast_allocate(
|
||||||
|
thread, sizeof(kmp_dephash_entry_t));
|
||||||
#else
|
#else
|
||||||
entry = (kmp_dephash_entry_t *) __kmp_thread_malloc( thread, sizeof(kmp_dephash_entry_t) );
|
entry = (kmp_dephash_entry_t *)__kmp_thread_malloc(
|
||||||
|
thread, sizeof(kmp_dephash_entry_t));
|
||||||
#endif
|
#endif
|
||||||
entry->addr = addr;
|
entry->addr = addr;
|
||||||
entry->last_out = NULL;
|
entry->last_out = NULL;
|
||||||
|
|
@ -174,21 +164,24 @@ __kmp_dephash_find ( kmp_info_t *thread, kmp_dephash_t *h, kmp_intptr_t addr )
|
||||||
h->buckets[bucket] = entry;
|
h->buckets[bucket] = entry;
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
h->nelements++;
|
h->nelements++;
|
||||||
if ( entry->next_in_bucket ) h->nconflicts++;
|
if (entry->next_in_bucket)
|
||||||
|
h->nconflicts++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
static kmp_depnode_list_t *
|
static kmp_depnode_list_t *__kmp_add_node(kmp_info_t *thread,
|
||||||
__kmp_add_node ( kmp_info_t *thread, kmp_depnode_list_t *list, kmp_depnode_t *node )
|
kmp_depnode_list_t *list,
|
||||||
{
|
kmp_depnode_t *node) {
|
||||||
kmp_depnode_list_t *new_head;
|
kmp_depnode_list_t *new_head;
|
||||||
|
|
||||||
#if USE_FAST_MEMORY
|
#if USE_FAST_MEMORY
|
||||||
new_head = (kmp_depnode_list_t *) __kmp_fast_allocate(thread,sizeof(kmp_depnode_list_t));
|
new_head = (kmp_depnode_list_t *)__kmp_fast_allocate(
|
||||||
|
thread, sizeof(kmp_depnode_list_t));
|
||||||
#else
|
#else
|
||||||
new_head = (kmp_depnode_list_t *) __kmp_thread_malloc(thread,sizeof(kmp_depnode_list_t));
|
new_head = (kmp_depnode_list_t *)__kmp_thread_malloc(
|
||||||
|
thread, sizeof(kmp_depnode_list_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
new_head->node = __kmp_node_ref(node);
|
new_head->node = __kmp_node_ref(node);
|
||||||
|
|
@ -197,119 +190,128 @@ __kmp_add_node ( kmp_info_t *thread, kmp_depnode_list_t *list, kmp_depnode_t *no
|
||||||
return new_head;
|
return new_head;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __kmp_depnode_list_free(kmp_info_t *thread,
|
||||||
__kmp_depnode_list_free ( kmp_info_t *thread, kmp_depnode_list *list )
|
kmp_depnode_list *list) {
|
||||||
{
|
|
||||||
kmp_depnode_list *next;
|
kmp_depnode_list *next;
|
||||||
|
|
||||||
for ( ; list ; list = next ) {
|
for (; list; list = next) {
|
||||||
next = list->next;
|
next = list->next;
|
||||||
|
|
||||||
__kmp_node_deref(thread,list->node);
|
__kmp_node_deref(thread, list->node);
|
||||||
#if USE_FAST_MEMORY
|
#if USE_FAST_MEMORY
|
||||||
__kmp_fast_free(thread,list);
|
__kmp_fast_free(thread, list);
|
||||||
#else
|
#else
|
||||||
__kmp_thread_free(thread,list);
|
__kmp_thread_free(thread, list);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void __kmp_track_dependence(kmp_depnode_t *source,
|
||||||
__kmp_track_dependence ( kmp_depnode_t *source, kmp_depnode_t *sink,
|
kmp_depnode_t *sink,
|
||||||
kmp_task_t *sink_task )
|
kmp_task_t *sink_task) {
|
||||||
{
|
|
||||||
#ifdef KMP_SUPPORT_GRAPH_OUTPUT
|
#ifdef KMP_SUPPORT_GRAPH_OUTPUT
|
||||||
kmp_taskdata_t * task_source = KMP_TASK_TO_TASKDATA(source->dn.task);
|
kmp_taskdata_t *task_source = KMP_TASK_TO_TASKDATA(source->dn.task);
|
||||||
// do not use sink->dn.task as that is only filled after the dependencies
|
// do not use sink->dn.task as that is only filled after the dependencies
|
||||||
// are already processed!
|
// are already processed!
|
||||||
kmp_taskdata_t * task_sink = KMP_TASK_TO_TASKDATA(sink_task);
|
kmp_taskdata_t *task_sink = KMP_TASK_TO_TASKDATA(sink_task);
|
||||||
|
|
||||||
__kmp_printf("%d(%s) -> %d(%s)\n", source->dn.id, task_source->td_ident->psource, sink->dn.id, task_sink->td_ident->psource);
|
__kmp_printf("%d(%s) -> %d(%s)\n", source->dn.id,
|
||||||
|
task_source->td_ident->psource, sink->dn.id,
|
||||||
|
task_sink->td_ident->psource);
|
||||||
#endif
|
#endif
|
||||||
#if OMPT_SUPPORT && OMPT_TRACE
|
#if OMPT_SUPPORT && OMPT_TRACE
|
||||||
/* OMPT tracks dependences between task (a=source, b=sink) in which
|
// OMPT tracks dependences between task (a=source, b=sink) in which
|
||||||
task a blocks the execution of b through the ompt_new_dependence_callback */
|
// task a blocks the execution of b through the ompt_new_dependence_callback
|
||||||
if (ompt_enabled &&
|
if (ompt_enabled &&
|
||||||
ompt_callbacks.ompt_callback(ompt_event_task_dependence_pair))
|
ompt_callbacks.ompt_callback(ompt_event_task_dependence_pair)) {
|
||||||
{
|
kmp_taskdata_t *task_source = KMP_TASK_TO_TASKDATA(source->dn.task);
|
||||||
kmp_taskdata_t * task_source = KMP_TASK_TO_TASKDATA(source->dn.task);
|
kmp_taskdata_t *task_sink = KMP_TASK_TO_TASKDATA(sink_task);
|
||||||
kmp_taskdata_t * task_sink = KMP_TASK_TO_TASKDATA(sink_task);
|
|
||||||
|
|
||||||
ompt_callbacks.ompt_callback(ompt_event_task_dependence_pair)(
|
ompt_callbacks.ompt_callback(ompt_event_task_dependence_pair)(
|
||||||
task_source->ompt_task_info.task_id,
|
task_source->ompt_task_info.task_id, task_sink->ompt_task_info.task_id);
|
||||||
task_sink->ompt_task_info.task_id);
|
|
||||||
}
|
}
|
||||||
#endif /* OMPT_SUPPORT && OMPT_TRACE */
|
#endif /* OMPT_SUPPORT && OMPT_TRACE */
|
||||||
}
|
}
|
||||||
|
|
||||||
template< bool filter >
|
template <bool filter>
|
||||||
static inline kmp_int32
|
static inline kmp_int32
|
||||||
__kmp_process_deps ( kmp_int32 gtid, kmp_depnode_t *node, kmp_dephash_t *hash,
|
__kmp_process_deps(kmp_int32 gtid, kmp_depnode_t *node, kmp_dephash_t *hash,
|
||||||
bool dep_barrier,kmp_int32 ndeps, kmp_depend_info_t *dep_list,
|
bool dep_barrier, kmp_int32 ndeps,
|
||||||
kmp_task_t *task )
|
kmp_depend_info_t *dep_list, kmp_task_t *task) {
|
||||||
{
|
KA_TRACE(30, ("__kmp_process_deps<%d>: T#%d processing %d dependencies : "
|
||||||
KA_TRACE(30, ("__kmp_process_deps<%d>: T#%d processing %d dependencies : dep_barrier = %d\n", filter, gtid, ndeps, dep_barrier ) );
|
"dep_barrier = %d\n",
|
||||||
|
filter, gtid, ndeps, dep_barrier));
|
||||||
|
|
||||||
kmp_info_t *thread = __kmp_threads[ gtid ];
|
kmp_info_t *thread = __kmp_threads[gtid];
|
||||||
kmp_int32 npredecessors=0;
|
kmp_int32 npredecessors = 0;
|
||||||
for ( kmp_int32 i = 0; i < ndeps ; i++ ) {
|
for (kmp_int32 i = 0; i < ndeps; i++) {
|
||||||
const kmp_depend_info_t * dep = &dep_list[i];
|
const kmp_depend_info_t *dep = &dep_list[i];
|
||||||
|
|
||||||
KMP_DEBUG_ASSERT(dep->flags.in);
|
KMP_DEBUG_ASSERT(dep->flags.in);
|
||||||
|
|
||||||
if ( filter && dep->base_addr == 0 ) continue; // skip filtered entries
|
if (filter && dep->base_addr == 0)
|
||||||
|
continue; // skip filtered entries
|
||||||
|
|
||||||
kmp_dephash_entry_t *info = __kmp_dephash_find(thread,hash,dep->base_addr);
|
kmp_dephash_entry_t *info =
|
||||||
|
__kmp_dephash_find(thread, hash, dep->base_addr);
|
||||||
kmp_depnode_t *last_out = info->last_out;
|
kmp_depnode_t *last_out = info->last_out;
|
||||||
|
|
||||||
if ( dep->flags.out && info->last_ins ) {
|
if (dep->flags.out && info->last_ins) {
|
||||||
for ( kmp_depnode_list_t * p = info->last_ins; p; p = p->next ) {
|
for (kmp_depnode_list_t *p = info->last_ins; p; p = p->next) {
|
||||||
kmp_depnode_t * indep = p->node;
|
kmp_depnode_t *indep = p->node;
|
||||||
if ( indep->dn.task ) {
|
if (indep->dn.task) {
|
||||||
KMP_ACQUIRE_DEPNODE(gtid,indep);
|
KMP_ACQUIRE_DEPNODE(gtid, indep);
|
||||||
if ( indep->dn.task ) {
|
if (indep->dn.task) {
|
||||||
__kmp_track_dependence(indep,node,task);
|
__kmp_track_dependence(indep, node, task);
|
||||||
indep->dn.successors = __kmp_add_node(thread, indep->dn.successors, node);
|
indep->dn.successors =
|
||||||
KA_TRACE(40,("__kmp_process_deps<%d>: T#%d adding dependence from %p to %p\n",
|
__kmp_add_node(thread, indep->dn.successors, node);
|
||||||
filter,gtid, KMP_TASK_TO_TASKDATA(indep->dn.task), KMP_TASK_TO_TASKDATA(task)));
|
KA_TRACE(40, ("__kmp_process_deps<%d>: T#%d adding dependence from "
|
||||||
|
"%p to %p\n",
|
||||||
|
filter, gtid, KMP_TASK_TO_TASKDATA(indep->dn.task),
|
||||||
|
KMP_TASK_TO_TASKDATA(task)));
|
||||||
npredecessors++;
|
npredecessors++;
|
||||||
}
|
}
|
||||||
KMP_RELEASE_DEPNODE(gtid,indep);
|
KMP_RELEASE_DEPNODE(gtid, indep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__kmp_depnode_list_free(thread,info->last_ins);
|
__kmp_depnode_list_free(thread, info->last_ins);
|
||||||
info->last_ins = NULL;
|
info->last_ins = NULL;
|
||||||
|
|
||||||
} else if ( last_out && last_out->dn.task ) {
|
} else if (last_out && last_out->dn.task) {
|
||||||
KMP_ACQUIRE_DEPNODE(gtid,last_out);
|
KMP_ACQUIRE_DEPNODE(gtid, last_out);
|
||||||
if ( last_out->dn.task ) {
|
if (last_out->dn.task) {
|
||||||
__kmp_track_dependence(last_out,node,task);
|
__kmp_track_dependence(last_out, node, task);
|
||||||
last_out->dn.successors = __kmp_add_node(thread, last_out->dn.successors, node);
|
last_out->dn.successors =
|
||||||
KA_TRACE(40,("__kmp_process_deps<%d>: T#%d adding dependence from %p to %p\n",
|
__kmp_add_node(thread, last_out->dn.successors, node);
|
||||||
filter,gtid, KMP_TASK_TO_TASKDATA(last_out->dn.task), KMP_TASK_TO_TASKDATA(task)));
|
KA_TRACE(
|
||||||
|
40,
|
||||||
|
("__kmp_process_deps<%d>: T#%d adding dependence from %p to %p\n",
|
||||||
|
filter, gtid, KMP_TASK_TO_TASKDATA(last_out->dn.task),
|
||||||
|
KMP_TASK_TO_TASKDATA(task)));
|
||||||
|
|
||||||
npredecessors++;
|
npredecessors++;
|
||||||
}
|
}
|
||||||
KMP_RELEASE_DEPNODE(gtid,last_out);
|
KMP_RELEASE_DEPNODE(gtid, last_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( dep_barrier ) {
|
if (dep_barrier) {
|
||||||
// if this is a sync point in the serial sequence, then the previous outputs are guaranteed to be completed after
|
// if this is a sync point in the serial sequence, then the previous
|
||||||
|
// outputs are guaranteed to be completed after
|
||||||
// the execution of this task so the previous output nodes can be cleared.
|
// the execution of this task so the previous output nodes can be cleared.
|
||||||
__kmp_node_deref(thread,last_out);
|
__kmp_node_deref(thread, last_out);
|
||||||
info->last_out = NULL;
|
info->last_out = NULL;
|
||||||
} else {
|
} else {
|
||||||
if ( dep->flags.out ) {
|
if (dep->flags.out) {
|
||||||
__kmp_node_deref(thread,last_out);
|
__kmp_node_deref(thread, last_out);
|
||||||
info->last_out = __kmp_node_ref(node);
|
info->last_out = __kmp_node_ref(node);
|
||||||
} else
|
} else
|
||||||
info->last_ins = __kmp_add_node(thread, info->last_ins, node);
|
info->last_ins = __kmp_add_node(thread, info->last_ins, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KA_TRACE(30, ("__kmp_process_deps<%d>: T#%d found %d predecessors\n", filter, gtid, npredecessors ) );
|
KA_TRACE(30, ("__kmp_process_deps<%d>: T#%d found %d predecessors\n", filter,
|
||||||
|
gtid, npredecessors));
|
||||||
|
|
||||||
return npredecessors;
|
return npredecessors;
|
||||||
}
|
}
|
||||||
|
|
@ -318,41 +320,48 @@ __kmp_process_deps ( kmp_int32 gtid, kmp_depnode_t *node, kmp_dephash_t *hash,
|
||||||
#define DEP_BARRIER (true)
|
#define DEP_BARRIER (true)
|
||||||
|
|
||||||
// returns true if the task has any outstanding dependence
|
// returns true if the task has any outstanding dependence
|
||||||
static bool
|
static bool __kmp_check_deps(kmp_int32 gtid, kmp_depnode_t *node,
|
||||||
__kmp_check_deps ( kmp_int32 gtid, kmp_depnode_t *node, kmp_task_t *task, kmp_dephash_t *hash, bool dep_barrier,
|
kmp_task_t *task, kmp_dephash_t *hash,
|
||||||
kmp_int32 ndeps, kmp_depend_info_t *dep_list,
|
bool dep_barrier, kmp_int32 ndeps,
|
||||||
kmp_int32 ndeps_noalias, kmp_depend_info_t *noalias_dep_list )
|
kmp_depend_info_t *dep_list,
|
||||||
{
|
kmp_int32 ndeps_noalias,
|
||||||
|
kmp_depend_info_t *noalias_dep_list) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
#if KMP_DEBUG
|
#if KMP_DEBUG
|
||||||
kmp_taskdata_t * taskdata = KMP_TASK_TO_TASKDATA(task);
|
kmp_taskdata_t *taskdata = KMP_TASK_TO_TASKDATA(task);
|
||||||
#endif
|
#endif
|
||||||
KA_TRACE(20, ("__kmp_check_deps: T#%d checking dependencies for task %p : %d possibly aliased dependencies, %d non-aliased depedencies : dep_barrier=%d .\n", gtid, taskdata, ndeps, ndeps_noalias, dep_barrier ) );
|
KA_TRACE(20, ("__kmp_check_deps: T#%d checking dependencies for task %p : %d "
|
||||||
|
"possibly aliased dependencies, %d non-aliased depedencies : "
|
||||||
|
"dep_barrier=%d .\n",
|
||||||
|
gtid, taskdata, ndeps, ndeps_noalias, dep_barrier));
|
||||||
|
|
||||||
// Filter deps in dep_list
|
// Filter deps in dep_list
|
||||||
// TODO: Different algorithm for large dep_list ( > 10 ? )
|
// TODO: Different algorithm for large dep_list ( > 10 ? )
|
||||||
for ( i = 0; i < ndeps; i ++ ) {
|
for (i = 0; i < ndeps; i++) {
|
||||||
if ( dep_list[i].base_addr != 0 )
|
if (dep_list[i].base_addr != 0)
|
||||||
for ( int j = i+1; j < ndeps; j++ )
|
for (int j = i + 1; j < ndeps; j++)
|
||||||
if ( dep_list[i].base_addr == dep_list[j].base_addr ) {
|
if (dep_list[i].base_addr == dep_list[j].base_addr) {
|
||||||
dep_list[i].flags.in |= dep_list[j].flags.in;
|
dep_list[i].flags.in |= dep_list[j].flags.in;
|
||||||
dep_list[i].flags.out |= dep_list[j].flags.out;
|
dep_list[i].flags.out |= dep_list[j].flags.out;
|
||||||
dep_list[j].base_addr = 0; // Mark j element as void
|
dep_list[j].base_addr = 0; // Mark j element as void
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// doesn't need to be atomic as no other thread is going to be accessing this node just yet
|
// doesn't need to be atomic as no other thread is going to be accessing this
|
||||||
// npredecessors is set -1 to ensure that none of the releasing tasks queues this task before we have finished processing all the dependencies
|
// node just yet.
|
||||||
|
// npredecessors is set -1 to ensure that none of the releasing tasks queues
|
||||||
|
// this task before we have finished processing all the dependencies
|
||||||
node->dn.npredecessors = -1;
|
node->dn.npredecessors = -1;
|
||||||
|
|
||||||
// used to pack all npredecessors additions into a single atomic operation at the end
|
// used to pack all npredecessors additions into a single atomic operation at
|
||||||
|
// the end
|
||||||
int npredecessors;
|
int npredecessors;
|
||||||
|
|
||||||
npredecessors = __kmp_process_deps<true>(gtid, node, hash, dep_barrier,
|
npredecessors = __kmp_process_deps<true>(gtid, node, hash, dep_barrier, ndeps,
|
||||||
ndeps, dep_list, task);
|
dep_list, task);
|
||||||
npredecessors += __kmp_process_deps<false>(gtid, node, hash, dep_barrier,
|
npredecessors += __kmp_process_deps<false>(
|
||||||
ndeps_noalias, noalias_dep_list, task);
|
gtid, node, hash, dep_barrier, ndeps_noalias, noalias_dep_list, task);
|
||||||
|
|
||||||
node->dn.task = task;
|
node->dn.task = task;
|
||||||
KMP_MB();
|
KMP_MB();
|
||||||
|
|
@ -360,108 +369,123 @@ __kmp_check_deps ( kmp_int32 gtid, kmp_depnode_t *node, kmp_task_t *task, kmp_de
|
||||||
// Account for our initial fake value
|
// Account for our initial fake value
|
||||||
npredecessors++;
|
npredecessors++;
|
||||||
|
|
||||||
// Update predecessors and obtain current value to check if there are still any outstandig dependences (some tasks may have finished while we processed the dependences)
|
// Update predecessors and obtain current value to check if there are still
|
||||||
npredecessors = KMP_TEST_THEN_ADD32(&node->dn.npredecessors, npredecessors) + npredecessors;
|
// any outstandig dependences (some tasks may have finished while we processed
|
||||||
|
// the dependences)
|
||||||
|
npredecessors = KMP_TEST_THEN_ADD32(&node->dn.npredecessors, npredecessors) +
|
||||||
|
npredecessors;
|
||||||
|
|
||||||
KA_TRACE(20, ("__kmp_check_deps: T#%d found %d predecessors for task %p \n", gtid, npredecessors, taskdata ) );
|
KA_TRACE(20, ("__kmp_check_deps: T#%d found %d predecessors for task %p \n",
|
||||||
|
gtid, npredecessors, taskdata));
|
||||||
|
|
||||||
// beyond this point the task could be queued (and executed) by a releasing task...
|
// beyond this point the task could be queued (and executed) by a releasing
|
||||||
|
// task...
|
||||||
return npredecessors > 0 ? true : false;
|
return npredecessors > 0 ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void __kmp_release_deps(kmp_int32 gtid, kmp_taskdata_t *task) {
|
||||||
__kmp_release_deps ( kmp_int32 gtid, kmp_taskdata_t *task )
|
kmp_info_t *thread = __kmp_threads[gtid];
|
||||||
{
|
|
||||||
kmp_info_t *thread = __kmp_threads[ gtid ];
|
|
||||||
kmp_depnode_t *node = task->td_depnode;
|
kmp_depnode_t *node = task->td_depnode;
|
||||||
|
|
||||||
if ( task->td_dephash ) {
|
if (task->td_dephash) {
|
||||||
KA_TRACE(40, ("__kmp_release_deps: T#%d freeing dependencies hash of task %p.\n", gtid, task ) );
|
KA_TRACE(
|
||||||
__kmp_dephash_free(thread,task->td_dephash);
|
40, ("__kmp_release_deps: T#%d freeing dependencies hash of task %p.\n",
|
||||||
|
gtid, task));
|
||||||
|
__kmp_dephash_free(thread, task->td_dephash);
|
||||||
task->td_dephash = NULL;
|
task->td_dephash = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !node ) return;
|
if (!node)
|
||||||
|
return;
|
||||||
|
|
||||||
KA_TRACE(20, ("__kmp_release_deps: T#%d notifying successors of task %p.\n", gtid, task ) );
|
KA_TRACE(20, ("__kmp_release_deps: T#%d notifying successors of task %p.\n",
|
||||||
|
gtid, task));
|
||||||
|
|
||||||
KMP_ACQUIRE_DEPNODE(gtid,node);
|
KMP_ACQUIRE_DEPNODE(gtid, node);
|
||||||
node->dn.task = NULL; // mark this task as finished, so no new dependencies are generated
|
node->dn.task =
|
||||||
KMP_RELEASE_DEPNODE(gtid,node);
|
NULL; // mark this task as finished, so no new dependencies are generated
|
||||||
|
KMP_RELEASE_DEPNODE(gtid, node);
|
||||||
|
|
||||||
kmp_depnode_list_t *next;
|
kmp_depnode_list_t *next;
|
||||||
for ( kmp_depnode_list_t *p = node->dn.successors; p; p = next ) {
|
for (kmp_depnode_list_t *p = node->dn.successors; p; p = next) {
|
||||||
kmp_depnode_t *successor = p->node;
|
kmp_depnode_t *successor = p->node;
|
||||||
kmp_int32 npredecessors = KMP_TEST_THEN_DEC32(&successor->dn.npredecessors) - 1;
|
kmp_int32 npredecessors =
|
||||||
|
KMP_TEST_THEN_DEC32(&successor->dn.npredecessors) - 1;
|
||||||
|
|
||||||
// successor task can be NULL for wait_depends or because deps are still being processed
|
// successor task can be NULL for wait_depends or because deps are still
|
||||||
if ( npredecessors == 0 ) {
|
// being processed
|
||||||
|
if (npredecessors == 0) {
|
||||||
KMP_MB();
|
KMP_MB();
|
||||||
if ( successor->dn.task ) {
|
if (successor->dn.task) {
|
||||||
KA_TRACE(20, ("__kmp_release_deps: T#%d successor %p of %p scheduled for execution.\n", gtid, successor->dn.task, task ) );
|
KA_TRACE(20, ("__kmp_release_deps: T#%d successor %p of %p scheduled "
|
||||||
__kmp_omp_task(gtid,successor->dn.task,false);
|
"for execution.\n",
|
||||||
|
gtid, successor->dn.task, task));
|
||||||
|
__kmp_omp_task(gtid, successor->dn.task, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
next = p->next;
|
next = p->next;
|
||||||
__kmp_node_deref(thread,p->node);
|
__kmp_node_deref(thread, p->node);
|
||||||
#if USE_FAST_MEMORY
|
#if USE_FAST_MEMORY
|
||||||
__kmp_fast_free(thread,p);
|
__kmp_fast_free(thread, p);
|
||||||
#else
|
#else
|
||||||
__kmp_thread_free(thread,p);
|
__kmp_thread_free(thread, p);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
__kmp_node_deref(thread,node);
|
__kmp_node_deref(thread, node);
|
||||||
|
|
||||||
KA_TRACE(20, ("__kmp_release_deps: T#%d all successors of %p notified of completion\n", gtid, task ) );
|
KA_TRACE(
|
||||||
|
20,
|
||||||
|
("__kmp_release_deps: T#%d all successors of %p notified of completion\n",
|
||||||
|
gtid, task));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ingroup TASKING
|
@ingroup TASKING
|
||||||
@param loc_ref location of the original task directive
|
@param loc_ref location of the original task directive
|
||||||
@param gtid Global Thread ID of encountering thread
|
@param gtid Global Thread ID of encountering thread
|
||||||
@param new_task task thunk allocated by __kmp_omp_task_alloc() for the ''new task''
|
@param new_task task thunk allocated by __kmp_omp_task_alloc() for the ''new
|
||||||
|
task''
|
||||||
@param ndeps Number of depend items with possible aliasing
|
@param ndeps Number of depend items with possible aliasing
|
||||||
@param dep_list List of depend items with possible aliasing
|
@param dep_list List of depend items with possible aliasing
|
||||||
@param ndeps_noalias Number of depend items with no aliasing
|
@param ndeps_noalias Number of depend items with no aliasing
|
||||||
@param noalias_dep_list List of depend items with no aliasing
|
@param noalias_dep_list List of depend items with no aliasing
|
||||||
|
|
||||||
@return Returns either TASK_CURRENT_NOT_QUEUED if the current task was not suspendend and queued, or TASK_CURRENT_QUEUED if it was suspended and queued
|
@return Returns either TASK_CURRENT_NOT_QUEUED if the current task was not
|
||||||
|
suspendend and queued, or TASK_CURRENT_QUEUED if it was suspended and queued
|
||||||
|
|
||||||
Schedule a non-thread-switchable task with dependences for execution
|
Schedule a non-thread-switchable task with dependences for execution
|
||||||
*/
|
*/
|
||||||
kmp_int32
|
kmp_int32 __kmpc_omp_task_with_deps(ident_t *loc_ref, kmp_int32 gtid,
|
||||||
__kmpc_omp_task_with_deps( ident_t *loc_ref, kmp_int32 gtid, kmp_task_t * new_task,
|
kmp_task_t *new_task, kmp_int32 ndeps,
|
||||||
kmp_int32 ndeps, kmp_depend_info_t *dep_list,
|
kmp_depend_info_t *dep_list,
|
||||||
kmp_int32 ndeps_noalias, kmp_depend_info_t *noalias_dep_list )
|
kmp_int32 ndeps_noalias,
|
||||||
{
|
kmp_depend_info_t *noalias_dep_list) {
|
||||||
|
|
||||||
kmp_taskdata_t * new_taskdata = KMP_TASK_TO_TASKDATA(new_task);
|
kmp_taskdata_t *new_taskdata = KMP_TASK_TO_TASKDATA(new_task);
|
||||||
KA_TRACE(10, ("__kmpc_omp_task_with_deps(enter): T#%d loc=%p task=%p\n",
|
KA_TRACE(10, ("__kmpc_omp_task_with_deps(enter): T#%d loc=%p task=%p\n", gtid,
|
||||||
gtid, loc_ref, new_taskdata ) );
|
loc_ref, new_taskdata));
|
||||||
|
|
||||||
kmp_info_t *thread = __kmp_threads[ gtid ];
|
kmp_info_t *thread = __kmp_threads[gtid];
|
||||||
kmp_taskdata_t * current_task = thread->th.th_current_task;
|
kmp_taskdata_t *current_task = thread->th.th_current_task;
|
||||||
|
|
||||||
#if OMPT_SUPPORT && OMPT_TRACE
|
#if OMPT_SUPPORT && OMPT_TRACE
|
||||||
/* OMPT grab all dependences if requested by the tool */
|
/* OMPT grab all dependences if requested by the tool */
|
||||||
if (ompt_enabled && ndeps+ndeps_noalias > 0 &&
|
if (ompt_enabled && ndeps + ndeps_noalias > 0 &&
|
||||||
ompt_callbacks.ompt_callback(ompt_event_task_dependences))
|
ompt_callbacks.ompt_callback(ompt_event_task_dependences)) {
|
||||||
{
|
|
||||||
kmp_int32 i;
|
kmp_int32 i;
|
||||||
|
|
||||||
new_taskdata->ompt_task_info.ndeps = ndeps+ndeps_noalias;
|
new_taskdata->ompt_task_info.ndeps = ndeps + ndeps_noalias;
|
||||||
new_taskdata->ompt_task_info.deps = (ompt_task_dependence_t *)
|
new_taskdata->ompt_task_info.deps =
|
||||||
KMP_OMPT_DEPS_ALLOC(thread,
|
(ompt_task_dependence_t *)KMP_OMPT_DEPS_ALLOC(
|
||||||
(ndeps+ndeps_noalias)*sizeof(ompt_task_dependence_t));
|
thread, (ndeps + ndeps_noalias) * sizeof(ompt_task_dependence_t));
|
||||||
|
|
||||||
KMP_ASSERT(new_taskdata->ompt_task_info.deps != NULL);
|
KMP_ASSERT(new_taskdata->ompt_task_info.deps != NULL);
|
||||||
|
|
||||||
for (i = 0; i < ndeps; i++)
|
for (i = 0; i < ndeps; i++) {
|
||||||
{
|
|
||||||
new_taskdata->ompt_task_info.deps[i].variable_addr =
|
new_taskdata->ompt_task_info.deps[i].variable_addr =
|
||||||
(void*) dep_list[i].base_addr;
|
(void *)dep_list[i].base_addr;
|
||||||
if (dep_list[i].flags.in && dep_list[i].flags.out)
|
if (dep_list[i].flags.in && dep_list[i].flags.out)
|
||||||
new_taskdata->ompt_task_info.deps[i].dependence_flags =
|
new_taskdata->ompt_task_info.deps[i].dependence_flags =
|
||||||
ompt_task_dependence_type_inout;
|
ompt_task_dependence_type_inout;
|
||||||
|
|
@ -472,60 +496,68 @@ __kmpc_omp_task_with_deps( ident_t *loc_ref, kmp_int32 gtid, kmp_task_t * new_ta
|
||||||
new_taskdata->ompt_task_info.deps[i].dependence_flags =
|
new_taskdata->ompt_task_info.deps[i].dependence_flags =
|
||||||
ompt_task_dependence_type_in;
|
ompt_task_dependence_type_in;
|
||||||
}
|
}
|
||||||
for (i = 0; i < ndeps_noalias; i++)
|
for (i = 0; i < ndeps_noalias; i++) {
|
||||||
{
|
new_taskdata->ompt_task_info.deps[ndeps + i].variable_addr =
|
||||||
new_taskdata->ompt_task_info.deps[ndeps+i].variable_addr =
|
(void *)noalias_dep_list[i].base_addr;
|
||||||
(void*) noalias_dep_list[i].base_addr;
|
|
||||||
if (noalias_dep_list[i].flags.in && noalias_dep_list[i].flags.out)
|
if (noalias_dep_list[i].flags.in && noalias_dep_list[i].flags.out)
|
||||||
new_taskdata->ompt_task_info.deps[ndeps+i].dependence_flags =
|
new_taskdata->ompt_task_info.deps[ndeps + i].dependence_flags =
|
||||||
ompt_task_dependence_type_inout;
|
ompt_task_dependence_type_inout;
|
||||||
else if (noalias_dep_list[i].flags.out)
|
else if (noalias_dep_list[i].flags.out)
|
||||||
new_taskdata->ompt_task_info.deps[ndeps+i].dependence_flags =
|
new_taskdata->ompt_task_info.deps[ndeps + i].dependence_flags =
|
||||||
ompt_task_dependence_type_out;
|
ompt_task_dependence_type_out;
|
||||||
else if (noalias_dep_list[i].flags.in)
|
else if (noalias_dep_list[i].flags.in)
|
||||||
new_taskdata->ompt_task_info.deps[ndeps+i].dependence_flags =
|
new_taskdata->ompt_task_info.deps[ndeps + i].dependence_flags =
|
||||||
ompt_task_dependence_type_in;
|
ompt_task_dependence_type_in;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* OMPT_SUPPORT && OMPT_TRACE */
|
#endif /* OMPT_SUPPORT && OMPT_TRACE */
|
||||||
|
|
||||||
bool serial = current_task->td_flags.team_serial || current_task->td_flags.tasking_ser || current_task->td_flags.final;
|
bool serial = current_task->td_flags.team_serial ||
|
||||||
|
current_task->td_flags.tasking_ser ||
|
||||||
|
current_task->td_flags.final;
|
||||||
#if OMP_45_ENABLED
|
#if OMP_45_ENABLED
|
||||||
kmp_task_team_t * task_team = thread->th.th_task_team;
|
kmp_task_team_t *task_team = thread->th.th_task_team;
|
||||||
serial = serial && !(task_team && task_team->tt.tt_found_proxy_tasks);
|
serial = serial && !(task_team && task_team->tt.tt_found_proxy_tasks);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( !serial && ( ndeps > 0 || ndeps_noalias > 0 )) {
|
if (!serial && (ndeps > 0 || ndeps_noalias > 0)) {
|
||||||
/* if no dependencies have been tracked yet, create the dependence hash */
|
/* if no dependencies have been tracked yet, create the dependence hash */
|
||||||
if ( current_task->td_dephash == NULL )
|
if (current_task->td_dephash == NULL)
|
||||||
current_task->td_dephash = __kmp_dephash_create(thread, current_task);
|
current_task->td_dephash = __kmp_dephash_create(thread, current_task);
|
||||||
|
|
||||||
#if USE_FAST_MEMORY
|
#if USE_FAST_MEMORY
|
||||||
kmp_depnode_t *node = (kmp_depnode_t *) __kmp_fast_allocate(thread,sizeof(kmp_depnode_t));
|
kmp_depnode_t *node =
|
||||||
|
(kmp_depnode_t *)__kmp_fast_allocate(thread, sizeof(kmp_depnode_t));
|
||||||
#else
|
#else
|
||||||
kmp_depnode_t *node = (kmp_depnode_t *) __kmp_thread_malloc(thread,sizeof(kmp_depnode_t));
|
kmp_depnode_t *node =
|
||||||
|
(kmp_depnode_t *)__kmp_thread_malloc(thread, sizeof(kmp_depnode_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__kmp_init_node(node);
|
__kmp_init_node(node);
|
||||||
new_taskdata->td_depnode = node;
|
new_taskdata->td_depnode = node;
|
||||||
|
|
||||||
if ( __kmp_check_deps( gtid, node, new_task, current_task->td_dephash, NO_DEP_BARRIER,
|
if (__kmp_check_deps(gtid, node, new_task, current_task->td_dephash,
|
||||||
ndeps, dep_list, ndeps_noalias,noalias_dep_list ) ) {
|
NO_DEP_BARRIER, ndeps, dep_list, ndeps_noalias,
|
||||||
KA_TRACE(10, ("__kmpc_omp_task_with_deps(exit): T#%d task had blocking dependencies: "
|
noalias_dep_list)) {
|
||||||
"loc=%p task=%p, return: TASK_CURRENT_NOT_QUEUED\n", gtid, loc_ref,
|
KA_TRACE(10, ("__kmpc_omp_task_with_deps(exit): T#%d task had blocking "
|
||||||
new_taskdata ) );
|
"dependencies: "
|
||||||
|
"loc=%p task=%p, return: TASK_CURRENT_NOT_QUEUED\n",
|
||||||
|
gtid, loc_ref, new_taskdata));
|
||||||
return TASK_CURRENT_NOT_QUEUED;
|
return TASK_CURRENT_NOT_QUEUED;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
KA_TRACE(10, ("__kmpc_omp_task_with_deps(exit): T#%d ignored dependencies for task (serialized)"
|
KA_TRACE(10, ("__kmpc_omp_task_with_deps(exit): T#%d ignored dependencies "
|
||||||
"loc=%p task=%p\n", gtid, loc_ref, new_taskdata ) );
|
"for task (serialized)"
|
||||||
|
"loc=%p task=%p\n",
|
||||||
|
gtid, loc_ref, new_taskdata));
|
||||||
}
|
}
|
||||||
|
|
||||||
KA_TRACE(10, ("__kmpc_omp_task_with_deps(exit): T#%d task had no blocking dependencies : "
|
KA_TRACE(10, ("__kmpc_omp_task_with_deps(exit): T#%d task had no blocking "
|
||||||
"loc=%p task=%p, transferring to __kmpc_omp_task\n", gtid, loc_ref,
|
"dependencies : "
|
||||||
new_taskdata ) );
|
"loc=%p task=%p, transferring to __kmpc_omp_task\n",
|
||||||
|
gtid, loc_ref, new_taskdata));
|
||||||
|
|
||||||
return __kmpc_omp_task(loc_ref,gtid,new_task);
|
return __kmpc_omp_task(loc_ref, gtid, new_task);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -539,55 +571,64 @@ __kmpc_omp_task_with_deps( ident_t *loc_ref, kmp_int32 gtid, kmp_task_t * new_ta
|
||||||
|
|
||||||
Blocks the current task until all specifies dependencies have been fulfilled.
|
Blocks the current task until all specifies dependencies have been fulfilled.
|
||||||
*/
|
*/
|
||||||
void
|
void __kmpc_omp_wait_deps(ident_t *loc_ref, kmp_int32 gtid, kmp_int32 ndeps,
|
||||||
__kmpc_omp_wait_deps ( ident_t *loc_ref, kmp_int32 gtid, kmp_int32 ndeps, kmp_depend_info_t *dep_list,
|
kmp_depend_info_t *dep_list, kmp_int32 ndeps_noalias,
|
||||||
kmp_int32 ndeps_noalias, kmp_depend_info_t *noalias_dep_list )
|
kmp_depend_info_t *noalias_dep_list) {
|
||||||
{
|
KA_TRACE(10, ("__kmpc_omp_wait_deps(enter): T#%d loc=%p\n", gtid, loc_ref));
|
||||||
KA_TRACE(10, ("__kmpc_omp_wait_deps(enter): T#%d loc=%p\n", gtid, loc_ref) );
|
|
||||||
|
|
||||||
if ( ndeps == 0 && ndeps_noalias == 0 ) {
|
if (ndeps == 0 && ndeps_noalias == 0) {
|
||||||
KA_TRACE(10, ("__kmpc_omp_wait_deps(exit): T#%d has no dependencies to wait upon : loc=%p\n", gtid, loc_ref) );
|
KA_TRACE(10, ("__kmpc_omp_wait_deps(exit): T#%d has no dependencies to "
|
||||||
|
"wait upon : loc=%p\n",
|
||||||
|
gtid, loc_ref));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
kmp_info_t *thread = __kmp_threads[ gtid ];
|
kmp_info_t *thread = __kmp_threads[gtid];
|
||||||
kmp_taskdata_t * current_task = thread->th.th_current_task;
|
kmp_taskdata_t *current_task = thread->th.th_current_task;
|
||||||
|
|
||||||
// We can return immediately as:
|
// We can return immediately as:
|
||||||
// - dependences are not computed in serial teams (except if we have proxy tasks)
|
// - dependences are not computed in serial teams (except with proxy tasks)
|
||||||
// - if the dephash is not yet created it means we have nothing to wait for
|
// - if the dephash is not yet created it means we have nothing to wait for
|
||||||
bool ignore = current_task->td_flags.team_serial || current_task->td_flags.tasking_ser || current_task->td_flags.final;
|
bool ignore = current_task->td_flags.team_serial ||
|
||||||
|
current_task->td_flags.tasking_ser ||
|
||||||
|
current_task->td_flags.final;
|
||||||
#if OMP_45_ENABLED
|
#if OMP_45_ENABLED
|
||||||
ignore = ignore && thread->th.th_task_team != NULL && thread->th.th_task_team->tt.tt_found_proxy_tasks == FALSE;
|
ignore = ignore && thread->th.th_task_team != NULL &&
|
||||||
|
thread->th.th_task_team->tt.tt_found_proxy_tasks == FALSE;
|
||||||
#endif
|
#endif
|
||||||
ignore = ignore || current_task->td_dephash == NULL;
|
ignore = ignore || current_task->td_dephash == NULL;
|
||||||
|
|
||||||
if ( ignore ) {
|
if (ignore) {
|
||||||
KA_TRACE(10, ("__kmpc_omp_wait_deps(exit): T#%d has no blocking dependencies : loc=%p\n", gtid, loc_ref) );
|
KA_TRACE(10, ("__kmpc_omp_wait_deps(exit): T#%d has no blocking "
|
||||||
|
"dependencies : loc=%p\n",
|
||||||
|
gtid, loc_ref));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
kmp_depnode_t node;
|
kmp_depnode_t node;
|
||||||
__kmp_init_node(&node);
|
__kmp_init_node(&node);
|
||||||
|
|
||||||
if (!__kmp_check_deps( gtid, &node, NULL, current_task->td_dephash, DEP_BARRIER,
|
if (!__kmp_check_deps(gtid, &node, NULL, current_task->td_dephash,
|
||||||
ndeps, dep_list, ndeps_noalias, noalias_dep_list )) {
|
DEP_BARRIER, ndeps, dep_list, ndeps_noalias,
|
||||||
KA_TRACE(10, ("__kmpc_omp_wait_deps(exit): T#%d has no blocking dependencies : loc=%p\n", gtid, loc_ref) );
|
noalias_dep_list)) {
|
||||||
|
KA_TRACE(10, ("__kmpc_omp_wait_deps(exit): T#%d has no blocking "
|
||||||
|
"dependencies : loc=%p\n",
|
||||||
|
gtid, loc_ref));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int thread_finished = FALSE;
|
int thread_finished = FALSE;
|
||||||
kmp_flag_32 flag((volatile kmp_uint32 *)&(node.dn.npredecessors), 0U);
|
kmp_flag_32 flag((volatile kmp_uint32 *)&(node.dn.npredecessors), 0U);
|
||||||
while ( node.dn.npredecessors > 0 ) {
|
while (node.dn.npredecessors > 0) {
|
||||||
flag.execute_tasks(thread, gtid, FALSE, &thread_finished,
|
flag.execute_tasks(thread, gtid, FALSE, &thread_finished,
|
||||||
#if USE_ITT_BUILD
|
#if USE_ITT_BUILD
|
||||||
NULL,
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
__kmp_task_stealing_constraint );
|
__kmp_task_stealing_constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
KA_TRACE(10, ("__kmpc_omp_wait_deps(exit): T#%d finished waiting : loc=%p\n", gtid, loc_ref) );
|
KA_TRACE(10, ("__kmpc_omp_wait_deps(exit): T#%d finished waiting : loc=%p\n",
|
||||||
|
gtid, loc_ref));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* OMP_40_ENABLED */
|
#endif /* OMP_40_ENABLED */
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -14,51 +14,45 @@
|
||||||
|
|
||||||
|
|
||||||
#include "kmp.h"
|
#include "kmp.h"
|
||||||
#include "kmp_itt.h"
|
|
||||||
#include "kmp_i18n.h"
|
#include "kmp_i18n.h"
|
||||||
|
#include "kmp_itt.h"
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
|
|
||||||
#define USE_CHECKS_COMMON
|
#define USE_CHECKS_COMMON
|
||||||
|
|
||||||
#define KMP_INLINE_SUBR 1
|
#define KMP_INLINE_SUBR 1
|
||||||
|
|
||||||
|
void kmp_threadprivate_insert_private_data(int gtid, void *pc_addr,
|
||||||
/* ------------------------------------------------------------------------ */
|
void *data_addr, size_t pc_size);
|
||||||
/* ------------------------------------------------------------------------ */
|
struct private_common *kmp_threadprivate_insert(int gtid, void *pc_addr,
|
||||||
|
void *data_addr,
|
||||||
void
|
size_t pc_size);
|
||||||
kmp_threadprivate_insert_private_data( int gtid, void *pc_addr, void *data_addr, size_t pc_size );
|
|
||||||
struct private_common *
|
|
||||||
kmp_threadprivate_insert( int gtid, void *pc_addr, void *data_addr, size_t pc_size );
|
|
||||||
|
|
||||||
struct shared_table __kmp_threadprivate_d_table;
|
struct shared_table __kmp_threadprivate_d_table;
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
|
|
||||||
static
|
static
|
||||||
#ifdef KMP_INLINE_SUBR
|
#ifdef KMP_INLINE_SUBR
|
||||||
__forceinline
|
__forceinline
|
||||||
#endif
|
#endif
|
||||||
struct private_common *
|
struct private_common *
|
||||||
__kmp_threadprivate_find_task_common( struct common_table *tbl, int gtid, void *pc_addr )
|
__kmp_threadprivate_find_task_common(struct common_table *tbl, int gtid,
|
||||||
|
void *pc_addr)
|
||||||
|
|
||||||
{
|
{
|
||||||
struct private_common *tn;
|
struct private_common *tn;
|
||||||
|
|
||||||
#ifdef KMP_TASK_COMMON_DEBUG
|
#ifdef KMP_TASK_COMMON_DEBUG
|
||||||
KC_TRACE( 10, ( "__kmp_threadprivate_find_task_common: thread#%d, called with address %p\n",
|
KC_TRACE(10, ("__kmp_threadprivate_find_task_common: thread#%d, called with "
|
||||||
gtid, pc_addr ) );
|
"address %p\n",
|
||||||
|
gtid, pc_addr));
|
||||||
dump_list();
|
dump_list();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (tn = tbl->data[ KMP_HASH(pc_addr) ]; tn; tn = tn->next) {
|
for (tn = tbl->data[KMP_HASH(pc_addr)]; tn; tn = tn->next) {
|
||||||
if (tn->gbl_addr == pc_addr) {
|
if (tn->gbl_addr == pc_addr) {
|
||||||
#ifdef KMP_TASK_COMMON_DEBUG
|
#ifdef KMP_TASK_COMMON_DEBUG
|
||||||
KC_TRACE( 10, ( "__kmp_threadprivate_find_task_common: thread#%d, found node %p on list\n",
|
KC_TRACE(10, ("__kmp_threadprivate_find_task_common: thread#%d, found "
|
||||||
gtid, pc_addr ) );
|
"node %p on list\n",
|
||||||
|
gtid, pc_addr));
|
||||||
#endif
|
#endif
|
||||||
return tn;
|
return tn;
|
||||||
}
|
}
|
||||||
|
|
@ -68,18 +62,20 @@ __kmp_threadprivate_find_task_common( struct common_table *tbl, int gtid, void *
|
||||||
|
|
||||||
static
|
static
|
||||||
#ifdef KMP_INLINE_SUBR
|
#ifdef KMP_INLINE_SUBR
|
||||||
__forceinline
|
__forceinline
|
||||||
#endif
|
#endif
|
||||||
struct shared_common *
|
struct shared_common *
|
||||||
__kmp_find_shared_task_common( struct shared_table *tbl, int gtid, void *pc_addr )
|
__kmp_find_shared_task_common(struct shared_table *tbl, int gtid,
|
||||||
{
|
void *pc_addr) {
|
||||||
struct shared_common *tn;
|
struct shared_common *tn;
|
||||||
|
|
||||||
for (tn = tbl->data[ KMP_HASH(pc_addr) ]; tn; tn = tn->next) {
|
for (tn = tbl->data[KMP_HASH(pc_addr)]; tn; tn = tn->next) {
|
||||||
if (tn->gbl_addr == pc_addr) {
|
if (tn->gbl_addr == pc_addr) {
|
||||||
#ifdef KMP_TASK_COMMON_DEBUG
|
#ifdef KMP_TASK_COMMON_DEBUG
|
||||||
KC_TRACE( 10, ( "__kmp_find_shared_task_common: thread#%d, found node %p on list\n",
|
KC_TRACE(
|
||||||
gtid, pc_addr ) );
|
10,
|
||||||
|
("__kmp_find_shared_task_common: thread#%d, found node %p on list\n",
|
||||||
|
gtid, pc_addr));
|
||||||
#endif
|
#endif
|
||||||
return tn;
|
return tn;
|
||||||
}
|
}
|
||||||
|
|
@ -87,34 +83,29 @@ __kmp_find_shared_task_common( struct shared_table *tbl, int gtid, void *pc_addr
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a template for the data initialized storage. Either the template is
|
||||||
/*
|
// NULL indicating zero fill, or the template is a copy of the original data.
|
||||||
* Create a template for the data initialized storage.
|
static struct private_data *__kmp_init_common_data(void *pc_addr,
|
||||||
* Either the template is NULL indicating zero fill,
|
size_t pc_size) {
|
||||||
* or the template is a copy of the original data.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static struct private_data *
|
|
||||||
__kmp_init_common_data( void *pc_addr, size_t pc_size )
|
|
||||||
{
|
|
||||||
struct private_data *d;
|
struct private_data *d;
|
||||||
size_t i;
|
size_t i;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
d = (struct private_data *) __kmp_allocate( sizeof( struct private_data ) );
|
d = (struct private_data *)__kmp_allocate(sizeof(struct private_data));
|
||||||
/*
|
/*
|
||||||
d->data = 0; // AC: commented out because __kmp_allocate zeroes the memory
|
d->data = 0; // AC: commented out because __kmp_allocate zeroes the
|
||||||
|
memory
|
||||||
d->next = 0;
|
d->next = 0;
|
||||||
*/
|
*/
|
||||||
d->size = pc_size;
|
d->size = pc_size;
|
||||||
d->more = 1;
|
d->more = 1;
|
||||||
|
|
||||||
p = (char*)pc_addr;
|
p = (char *)pc_addr;
|
||||||
|
|
||||||
for (i = pc_size; i > 0; --i) {
|
for (i = pc_size; i > 0; --i) {
|
||||||
if (*p++ != '\0') {
|
if (*p++ != '\0') {
|
||||||
d->data = __kmp_allocate( pc_size );
|
d->data = __kmp_allocate(pc_size);
|
||||||
KMP_MEMCPY( d->data, pc_addr, pc_size );
|
KMP_MEMCPY(d->data, pc_addr, pc_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -122,35 +113,25 @@ __kmp_init_common_data( void *pc_addr, size_t pc_size )
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Initialize the data area from the template.
|
||||||
* Initialize the data area from the template.
|
static void __kmp_copy_common_data(void *pc_addr, struct private_data *d) {
|
||||||
*/
|
char *addr = (char *)pc_addr;
|
||||||
|
|
||||||
static void
|
|
||||||
__kmp_copy_common_data( void *pc_addr, struct private_data *d )
|
|
||||||
{
|
|
||||||
char *addr = (char *) pc_addr;
|
|
||||||
int i, offset;
|
int i, offset;
|
||||||
|
|
||||||
for (offset = 0; d != 0; d = d->next) {
|
for (offset = 0; d != 0; d = d->next) {
|
||||||
for (i = d->more; i > 0; --i) {
|
for (i = d->more; i > 0; --i) {
|
||||||
if (d->data == 0)
|
if (d->data == 0)
|
||||||
memset( & addr[ offset ], '\0', d->size );
|
memset(&addr[offset], '\0', d->size);
|
||||||
else
|
else
|
||||||
KMP_MEMCPY( & addr[ offset ], d->data, d->size );
|
KMP_MEMCPY(&addr[offset], d->data, d->size);
|
||||||
offset += d->size;
|
offset += d->size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
|
|
||||||
/* we are called from __kmp_serial_initialize() with __kmp_initz_lock held. */
|
/* we are called from __kmp_serial_initialize() with __kmp_initz_lock held. */
|
||||||
void
|
void __kmp_common_initialize(void) {
|
||||||
__kmp_common_initialize( void )
|
if (!TCR_4(__kmp_init_common)) {
|
||||||
{
|
|
||||||
if( ! TCR_4(__kmp_init_common) ) {
|
|
||||||
int q;
|
int q;
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
int gtid;
|
int gtid;
|
||||||
|
|
@ -160,17 +141,19 @@ __kmp_common_initialize( void )
|
||||||
|
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
/* verify the uber masters were initialized */
|
/* verify the uber masters were initialized */
|
||||||
for(gtid = 0 ; gtid < __kmp_threads_capacity; gtid++ )
|
for (gtid = 0; gtid < __kmp_threads_capacity; gtid++)
|
||||||
if( __kmp_root[gtid] ) {
|
if (__kmp_root[gtid]) {
|
||||||
KMP_DEBUG_ASSERT( __kmp_root[gtid]->r.r_uber_thread );
|
KMP_DEBUG_ASSERT(__kmp_root[gtid]->r.r_uber_thread);
|
||||||
for ( q = 0; q< KMP_HASH_TABLE_SIZE; ++q)
|
for (q = 0; q < KMP_HASH_TABLE_SIZE; ++q)
|
||||||
KMP_DEBUG_ASSERT( !__kmp_root[gtid]->r.r_uber_thread->th.th_pri_common->data[q] );
|
KMP_DEBUG_ASSERT(
|
||||||
/* __kmp_root[ gitd ]-> r.r_uber_thread -> th.th_pri_common -> data[ q ] = 0;*/
|
!__kmp_root[gtid]->r.r_uber_thread->th.th_pri_common->data[q]);
|
||||||
|
/* __kmp_root[ gitd ]-> r.r_uber_thread ->
|
||||||
|
* th.th_pri_common -> data[ q ] = 0;*/
|
||||||
}
|
}
|
||||||
#endif /* KMP_DEBUG */
|
#endif /* KMP_DEBUG */
|
||||||
|
|
||||||
for (q = 0; q < KMP_HASH_TABLE_SIZE; ++q)
|
for (q = 0; q < KMP_HASH_TABLE_SIZE; ++q)
|
||||||
__kmp_threadprivate_d_table.data[ q ] = 0;
|
__kmp_threadprivate_d_table.data[q] = 0;
|
||||||
|
|
||||||
TCW_4(__kmp_init_common, TRUE);
|
TCW_4(__kmp_init_common, TRUE);
|
||||||
}
|
}
|
||||||
|
|
@ -178,10 +161,8 @@ __kmp_common_initialize( void )
|
||||||
|
|
||||||
/* Call all destructors for threadprivate data belonging to all threads.
|
/* Call all destructors for threadprivate data belonging to all threads.
|
||||||
Currently unused! */
|
Currently unused! */
|
||||||
void
|
void __kmp_common_destroy(void) {
|
||||||
__kmp_common_destroy( void )
|
if (TCR_4(__kmp_init_common)) {
|
||||||
{
|
|
||||||
if( TCR_4(__kmp_init_common) ) {
|
|
||||||
int q;
|
int q;
|
||||||
|
|
||||||
TCW_4(__kmp_init_common, FALSE);
|
TCW_4(__kmp_init_common, FALSE);
|
||||||
|
|
@ -191,118 +172,118 @@ __kmp_common_destroy( void )
|
||||||
struct private_common *tn;
|
struct private_common *tn;
|
||||||
struct shared_common *d_tn;
|
struct shared_common *d_tn;
|
||||||
|
|
||||||
/* C++ destructors need to be called once per thread before exiting */
|
/* C++ destructors need to be called once per thread before exiting.
|
||||||
/* don't call destructors for master thread though unless we used copy constructor */
|
Don't call destructors for master thread though unless we used copy
|
||||||
|
constructor */
|
||||||
|
|
||||||
for (d_tn = __kmp_threadprivate_d_table.data[ q ]; d_tn; d_tn = d_tn->next) {
|
for (d_tn = __kmp_threadprivate_d_table.data[q]; d_tn;
|
||||||
|
d_tn = d_tn->next) {
|
||||||
if (d_tn->is_vec) {
|
if (d_tn->is_vec) {
|
||||||
if (d_tn->dt.dtorv != 0) {
|
if (d_tn->dt.dtorv != 0) {
|
||||||
for (gtid = 0; gtid < __kmp_all_nth; ++gtid) {
|
for (gtid = 0; gtid < __kmp_all_nth; ++gtid) {
|
||||||
if( __kmp_threads[gtid] ) {
|
if (__kmp_threads[gtid]) {
|
||||||
if( (__kmp_foreign_tp) ? (! KMP_INITIAL_GTID (gtid)) :
|
if ((__kmp_foreign_tp) ? (!KMP_INITIAL_GTID(gtid))
|
||||||
(! KMP_UBER_GTID (gtid)) ) {
|
: (!KMP_UBER_GTID(gtid))) {
|
||||||
tn = __kmp_threadprivate_find_task_common( __kmp_threads[ gtid ]->th.th_pri_common,
|
tn = __kmp_threadprivate_find_task_common(
|
||||||
gtid, d_tn->gbl_addr );
|
__kmp_threads[gtid]->th.th_pri_common, gtid,
|
||||||
|
d_tn->gbl_addr);
|
||||||
if (tn) {
|
if (tn) {
|
||||||
(*d_tn->dt.dtorv) (tn->par_addr, d_tn->vec_len);
|
(*d_tn->dt.dtorv)(tn->par_addr, d_tn->vec_len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (d_tn->obj_init != 0) {
|
if (d_tn->obj_init != 0) {
|
||||||
(*d_tn->dt.dtorv) (d_tn->obj_init, d_tn->vec_len);
|
(*d_tn->dt.dtorv)(d_tn->obj_init, d_tn->vec_len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (d_tn->dt.dtor != 0) {
|
if (d_tn->dt.dtor != 0) {
|
||||||
for (gtid = 0; gtid < __kmp_all_nth; ++gtid) {
|
for (gtid = 0; gtid < __kmp_all_nth; ++gtid) {
|
||||||
if( __kmp_threads[gtid] ) {
|
if (__kmp_threads[gtid]) {
|
||||||
if( (__kmp_foreign_tp) ? (! KMP_INITIAL_GTID (gtid)) :
|
if ((__kmp_foreign_tp) ? (!KMP_INITIAL_GTID(gtid))
|
||||||
(! KMP_UBER_GTID (gtid)) ) {
|
: (!KMP_UBER_GTID(gtid))) {
|
||||||
tn = __kmp_threadprivate_find_task_common( __kmp_threads[ gtid ]->th.th_pri_common,
|
tn = __kmp_threadprivate_find_task_common(
|
||||||
gtid, d_tn->gbl_addr );
|
__kmp_threads[gtid]->th.th_pri_common, gtid,
|
||||||
|
d_tn->gbl_addr);
|
||||||
if (tn) {
|
if (tn) {
|
||||||
(*d_tn->dt.dtor) (tn->par_addr);
|
(*d_tn->dt.dtor)(tn->par_addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (d_tn->obj_init != 0) {
|
if (d_tn->obj_init != 0) {
|
||||||
(*d_tn->dt.dtor) (d_tn->obj_init);
|
(*d_tn->dt.dtor)(d_tn->obj_init);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__kmp_threadprivate_d_table.data[ q ] = 0;
|
__kmp_threadprivate_d_table.data[q] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call all destructors for threadprivate data belonging to this thread */
|
/* Call all destructors for threadprivate data belonging to this thread */
|
||||||
void
|
void __kmp_common_destroy_gtid(int gtid) {
|
||||||
__kmp_common_destroy_gtid( int gtid )
|
|
||||||
{
|
|
||||||
struct private_common *tn;
|
struct private_common *tn;
|
||||||
struct shared_common *d_tn;
|
struct shared_common *d_tn;
|
||||||
|
|
||||||
KC_TRACE( 10, ("__kmp_common_destroy_gtid: T#%d called\n", gtid ) );
|
KC_TRACE(10, ("__kmp_common_destroy_gtid: T#%d called\n", gtid));
|
||||||
if( (__kmp_foreign_tp) ? (! KMP_INITIAL_GTID (gtid)) :
|
if ((__kmp_foreign_tp) ? (!KMP_INITIAL_GTID(gtid)) : (!KMP_UBER_GTID(gtid))) {
|
||||||
(! KMP_UBER_GTID (gtid)) ) {
|
|
||||||
|
|
||||||
if( TCR_4(__kmp_init_common) ) {
|
if (TCR_4(__kmp_init_common)) {
|
||||||
|
|
||||||
/* Cannot do this here since not all threads have destroyed their data */
|
/* Cannot do this here since not all threads have destroyed their data */
|
||||||
/* TCW_4(__kmp_init_common, FALSE); */
|
/* TCW_4(__kmp_init_common, FALSE); */
|
||||||
|
|
||||||
for (tn = __kmp_threads[ gtid ]->th.th_pri_head; tn; tn = tn->link) {
|
for (tn = __kmp_threads[gtid]->th.th_pri_head; tn; tn = tn->link) {
|
||||||
|
|
||||||
d_tn = __kmp_find_shared_task_common( &__kmp_threadprivate_d_table,
|
d_tn = __kmp_find_shared_task_common(&__kmp_threadprivate_d_table, gtid,
|
||||||
gtid, tn->gbl_addr );
|
tn->gbl_addr);
|
||||||
|
|
||||||
KMP_DEBUG_ASSERT( d_tn );
|
KMP_DEBUG_ASSERT(d_tn);
|
||||||
|
|
||||||
if (d_tn->is_vec) {
|
if (d_tn->is_vec) {
|
||||||
if (d_tn->dt.dtorv != 0) {
|
if (d_tn->dt.dtorv != 0) {
|
||||||
(void) (*d_tn->dt.dtorv) (tn->par_addr, d_tn->vec_len);
|
(void)(*d_tn->dt.dtorv)(tn->par_addr, d_tn->vec_len);
|
||||||
}
|
}
|
||||||
if (d_tn->obj_init != 0) {
|
if (d_tn->obj_init != 0) {
|
||||||
(void) (*d_tn->dt.dtorv) (d_tn->obj_init, d_tn->vec_len);
|
(void)(*d_tn->dt.dtorv)(d_tn->obj_init, d_tn->vec_len);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (d_tn->dt.dtor != 0) {
|
if (d_tn->dt.dtor != 0) {
|
||||||
(void) (*d_tn->dt.dtor) (tn->par_addr);
|
(void)(*d_tn->dt.dtor)(tn->par_addr);
|
||||||
}
|
}
|
||||||
if (d_tn->obj_init != 0) {
|
if (d_tn->obj_init != 0) {
|
||||||
(void) (*d_tn->dt.dtor) (d_tn->obj_init);
|
(void)(*d_tn->dt.dtor)(d_tn->obj_init);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
KC_TRACE( 30, ("__kmp_common_destroy_gtid: T#%d threadprivate destructors complete\n",
|
KC_TRACE(30, ("__kmp_common_destroy_gtid: T#%d threadprivate destructors "
|
||||||
gtid ) );
|
"complete\n",
|
||||||
|
gtid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
|
|
||||||
#ifdef KMP_TASK_COMMON_DEBUG
|
#ifdef KMP_TASK_COMMON_DEBUG
|
||||||
static void
|
static void dump_list(void) {
|
||||||
dump_list( void )
|
|
||||||
{
|
|
||||||
int p, q;
|
int p, q;
|
||||||
|
|
||||||
for (p = 0; p < __kmp_all_nth; ++p) {
|
for (p = 0; p < __kmp_all_nth; ++p) {
|
||||||
if( !__kmp_threads[p] ) continue;
|
if (!__kmp_threads[p])
|
||||||
|
continue;
|
||||||
for (q = 0; q < KMP_HASH_TABLE_SIZE; ++q) {
|
for (q = 0; q < KMP_HASH_TABLE_SIZE; ++q) {
|
||||||
if (__kmp_threads[ p ]->th.th_pri_common->data[ q ]) {
|
if (__kmp_threads[p]->th.th_pri_common->data[q]) {
|
||||||
struct private_common *tn;
|
struct private_common *tn;
|
||||||
|
|
||||||
KC_TRACE( 10, ( "\tdump_list: gtid:%d addresses\n", p ) );
|
KC_TRACE(10, ("\tdump_list: gtid:%d addresses\n", p));
|
||||||
|
|
||||||
for (tn = __kmp_threads[ p ]->th.th_pri_common->data[ q ]; tn; tn = tn->next) {
|
for (tn = __kmp_threads[p]->th.th_pri_common->data[q]; tn;
|
||||||
KC_TRACE( 10, ( "\tdump_list: THREADPRIVATE: Serial %p -> Parallel %p\n",
|
tn = tn->next) {
|
||||||
tn->gbl_addr, tn->par_addr ) );
|
KC_TRACE(10,
|
||||||
|
("\tdump_list: THREADPRIVATE: Serial %p -> Parallel %p\n",
|
||||||
|
tn->gbl_addr, tn->par_addr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -310,115 +291,109 @@ dump_list( void )
|
||||||
}
|
}
|
||||||
#endif /* KMP_TASK_COMMON_DEBUG */
|
#endif /* KMP_TASK_COMMON_DEBUG */
|
||||||
|
|
||||||
|
// NOTE: this routine is to be called only from the serial part of the program.
|
||||||
/*
|
void kmp_threadprivate_insert_private_data(int gtid, void *pc_addr,
|
||||||
* NOTE: this routine is to be called only from the serial part of the program.
|
void *data_addr, size_t pc_size) {
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
kmp_threadprivate_insert_private_data( int gtid, void *pc_addr, void *data_addr, size_t pc_size )
|
|
||||||
{
|
|
||||||
struct shared_common **lnk_tn, *d_tn;
|
struct shared_common **lnk_tn, *d_tn;
|
||||||
KMP_DEBUG_ASSERT( __kmp_threads[ gtid ] &&
|
KMP_DEBUG_ASSERT(__kmp_threads[gtid] &&
|
||||||
__kmp_threads[ gtid ] -> th.th_root -> r.r_active == 0 );
|
__kmp_threads[gtid]->th.th_root->r.r_active == 0);
|
||||||
|
|
||||||
d_tn = __kmp_find_shared_task_common( &__kmp_threadprivate_d_table,
|
d_tn = __kmp_find_shared_task_common(&__kmp_threadprivate_d_table, gtid,
|
||||||
gtid, pc_addr );
|
pc_addr);
|
||||||
|
|
||||||
if (d_tn == 0) {
|
if (d_tn == 0) {
|
||||||
d_tn = (struct shared_common *) __kmp_allocate( sizeof( struct shared_common ) );
|
d_tn = (struct shared_common *)__kmp_allocate(sizeof(struct shared_common));
|
||||||
|
|
||||||
d_tn->gbl_addr = pc_addr;
|
d_tn->gbl_addr = pc_addr;
|
||||||
d_tn->pod_init = __kmp_init_common_data( data_addr, pc_size );
|
d_tn->pod_init = __kmp_init_common_data(data_addr, pc_size);
|
||||||
/*
|
/*
|
||||||
d_tn->obj_init = 0; // AC: commented out because __kmp_allocate zeroes the memory
|
d_tn->obj_init = 0; // AC: commented out because __kmp_allocate
|
||||||
|
zeroes the memory
|
||||||
d_tn->ct.ctor = 0;
|
d_tn->ct.ctor = 0;
|
||||||
d_tn->cct.cctor = 0;;
|
d_tn->cct.cctor = 0;;
|
||||||
d_tn->dt.dtor = 0;
|
d_tn->dt.dtor = 0;
|
||||||
d_tn->is_vec = FALSE;
|
d_tn->is_vec = FALSE;
|
||||||
d_tn->vec_len = 0L;
|
d_tn->vec_len = 0L;
|
||||||
*/
|
*/
|
||||||
d_tn->cmn_size = pc_size;
|
d_tn->cmn_size = pc_size;
|
||||||
|
|
||||||
__kmp_acquire_lock( &__kmp_global_lock, gtid );
|
__kmp_acquire_lock(&__kmp_global_lock, gtid);
|
||||||
|
|
||||||
lnk_tn = &(__kmp_threadprivate_d_table.data[ KMP_HASH(pc_addr) ]);
|
lnk_tn = &(__kmp_threadprivate_d_table.data[KMP_HASH(pc_addr)]);
|
||||||
|
|
||||||
d_tn->next = *lnk_tn;
|
d_tn->next = *lnk_tn;
|
||||||
*lnk_tn = d_tn;
|
*lnk_tn = d_tn;
|
||||||
|
|
||||||
__kmp_release_lock( &__kmp_global_lock, gtid );
|
__kmp_release_lock(&__kmp_global_lock, gtid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct private_common *
|
struct private_common *kmp_threadprivate_insert(int gtid, void *pc_addr,
|
||||||
kmp_threadprivate_insert( int gtid, void *pc_addr, void *data_addr, size_t pc_size )
|
void *data_addr,
|
||||||
{
|
size_t pc_size) {
|
||||||
struct private_common *tn, **tt;
|
struct private_common *tn, **tt;
|
||||||
struct shared_common *d_tn;
|
struct shared_common *d_tn;
|
||||||
|
|
||||||
/* +++++++++ START OF CRITICAL SECTION +++++++++ */
|
/* +++++++++ START OF CRITICAL SECTION +++++++++ */
|
||||||
|
__kmp_acquire_lock(&__kmp_global_lock, gtid);
|
||||||
|
|
||||||
__kmp_acquire_lock( & __kmp_global_lock, gtid );
|
tn = (struct private_common *)__kmp_allocate(sizeof(struct private_common));
|
||||||
|
|
||||||
tn = (struct private_common *) __kmp_allocate( sizeof (struct private_common) );
|
|
||||||
|
|
||||||
tn->gbl_addr = pc_addr;
|
tn->gbl_addr = pc_addr;
|
||||||
|
|
||||||
d_tn = __kmp_find_shared_task_common( &__kmp_threadprivate_d_table,
|
d_tn = __kmp_find_shared_task_common(
|
||||||
gtid, pc_addr ); /* Only the MASTER data table exists. */
|
&__kmp_threadprivate_d_table, gtid,
|
||||||
|
pc_addr); /* Only the MASTER data table exists. */
|
||||||
|
|
||||||
if (d_tn != 0) {
|
if (d_tn != 0) {
|
||||||
/* This threadprivate variable has already been seen. */
|
/* This threadprivate variable has already been seen. */
|
||||||
|
|
||||||
if ( d_tn->pod_init == 0 && d_tn->obj_init == 0 ) {
|
if (d_tn->pod_init == 0 && d_tn->obj_init == 0) {
|
||||||
d_tn->cmn_size = pc_size;
|
d_tn->cmn_size = pc_size;
|
||||||
|
|
||||||
if (d_tn->is_vec) {
|
if (d_tn->is_vec) {
|
||||||
if (d_tn->ct.ctorv != 0) {
|
if (d_tn->ct.ctorv != 0) {
|
||||||
/* Construct from scratch so no prototype exists */
|
/* Construct from scratch so no prototype exists */
|
||||||
d_tn->obj_init = 0;
|
d_tn->obj_init = 0;
|
||||||
}
|
} else if (d_tn->cct.cctorv != 0) {
|
||||||
else if (d_tn->cct.cctorv != 0) {
|
/* Now data initialize the prototype since it was previously
|
||||||
/* Now data initialize the prototype since it was previously registered */
|
* registered */
|
||||||
d_tn->obj_init = (void *) __kmp_allocate( d_tn->cmn_size );
|
d_tn->obj_init = (void *)__kmp_allocate(d_tn->cmn_size);
|
||||||
(void) (*d_tn->cct.cctorv) (d_tn->obj_init, pc_addr, d_tn->vec_len);
|
(void)(*d_tn->cct.cctorv)(d_tn->obj_init, pc_addr, d_tn->vec_len);
|
||||||
}
|
} else {
|
||||||
else {
|
d_tn->pod_init = __kmp_init_common_data(data_addr, d_tn->cmn_size);
|
||||||
d_tn->pod_init = __kmp_init_common_data( data_addr, d_tn->cmn_size );
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (d_tn->ct.ctor != 0) {
|
if (d_tn->ct.ctor != 0) {
|
||||||
/* Construct from scratch so no prototype exists */
|
/* Construct from scratch so no prototype exists */
|
||||||
d_tn->obj_init = 0;
|
d_tn->obj_init = 0;
|
||||||
}
|
} else if (d_tn->cct.cctor != 0) {
|
||||||
else if (d_tn->cct.cctor != 0) {
|
/* Now data initialize the prototype since it was previously
|
||||||
/* Now data initialize the prototype since it was previously registered */
|
registered */
|
||||||
d_tn->obj_init = (void *) __kmp_allocate( d_tn->cmn_size );
|
d_tn->obj_init = (void *)__kmp_allocate(d_tn->cmn_size);
|
||||||
(void) (*d_tn->cct.cctor) (d_tn->obj_init, pc_addr);
|
(void)(*d_tn->cct.cctor)(d_tn->obj_init, pc_addr);
|
||||||
}
|
} else {
|
||||||
else {
|
d_tn->pod_init = __kmp_init_common_data(data_addr, d_tn->cmn_size);
|
||||||
d_tn->pod_init = __kmp_init_common_data( data_addr, d_tn->cmn_size );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
struct shared_common **lnk_tn;
|
struct shared_common **lnk_tn;
|
||||||
|
|
||||||
d_tn = (struct shared_common *) __kmp_allocate( sizeof( struct shared_common ) );
|
d_tn = (struct shared_common *)__kmp_allocate(sizeof(struct shared_common));
|
||||||
d_tn->gbl_addr = pc_addr;
|
d_tn->gbl_addr = pc_addr;
|
||||||
d_tn->cmn_size = pc_size;
|
d_tn->cmn_size = pc_size;
|
||||||
d_tn->pod_init = __kmp_init_common_data( data_addr, pc_size );
|
d_tn->pod_init = __kmp_init_common_data(data_addr, pc_size);
|
||||||
/*
|
/*
|
||||||
d_tn->obj_init = 0; // AC: commented out because __kmp_allocate zeroes the memory
|
d_tn->obj_init = 0; // AC: commented out because __kmp_allocate
|
||||||
|
zeroes the memory
|
||||||
d_tn->ct.ctor = 0;
|
d_tn->ct.ctor = 0;
|
||||||
d_tn->cct.cctor = 0;
|
d_tn->cct.cctor = 0;
|
||||||
d_tn->dt.dtor = 0;
|
d_tn->dt.dtor = 0;
|
||||||
d_tn->is_vec = FALSE;
|
d_tn->is_vec = FALSE;
|
||||||
d_tn->vec_len = 0L;
|
d_tn->vec_len = 0L;
|
||||||
*/
|
*/
|
||||||
lnk_tn = &(__kmp_threadprivate_d_table.data[ KMP_HASH(pc_addr) ]);
|
lnk_tn = &(__kmp_threadprivate_d_table.data[KMP_HASH(pc_addr)]);
|
||||||
|
|
||||||
d_tn->next = *lnk_tn;
|
d_tn->next = *lnk_tn;
|
||||||
*lnk_tn = d_tn;
|
*lnk_tn = d_tn;
|
||||||
|
|
@ -426,86 +401,85 @@ kmp_threadprivate_insert( int gtid, void *pc_addr, void *data_addr, size_t pc_si
|
||||||
|
|
||||||
tn->cmn_size = d_tn->cmn_size;
|
tn->cmn_size = d_tn->cmn_size;
|
||||||
|
|
||||||
if ( (__kmp_foreign_tp) ? (KMP_INITIAL_GTID (gtid)) : (KMP_UBER_GTID (gtid)) ) {
|
if ((__kmp_foreign_tp) ? (KMP_INITIAL_GTID(gtid)) : (KMP_UBER_GTID(gtid))) {
|
||||||
tn->par_addr = (void *) pc_addr;
|
tn->par_addr = (void *)pc_addr;
|
||||||
}
|
} else {
|
||||||
else {
|
tn->par_addr = (void *)__kmp_allocate(tn->cmn_size);
|
||||||
tn->par_addr = (void *) __kmp_allocate( tn->cmn_size );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__kmp_release_lock( & __kmp_global_lock, gtid );
|
__kmp_release_lock(&__kmp_global_lock, gtid);
|
||||||
|
/* +++++++++ END OF CRITICAL SECTION +++++++++ */
|
||||||
/* +++++++++ END OF CRITICAL SECTION +++++++++ */
|
|
||||||
|
|
||||||
#ifdef USE_CHECKS_COMMON
|
#ifdef USE_CHECKS_COMMON
|
||||||
if (pc_size > d_tn->cmn_size) {
|
if (pc_size > d_tn->cmn_size) {
|
||||||
KC_TRACE( 10, ( "__kmp_threadprivate_insert: THREADPRIVATE: %p (%"
|
KC_TRACE(
|
||||||
KMP_UINTPTR_SPEC " ,%" KMP_UINTPTR_SPEC ")\n",
|
10, ("__kmp_threadprivate_insert: THREADPRIVATE: %p (%" KMP_UINTPTR_SPEC
|
||||||
pc_addr, pc_size, d_tn->cmn_size ) );
|
" ,%" KMP_UINTPTR_SPEC ")\n",
|
||||||
KMP_FATAL( TPCommonBlocksInconsist );
|
pc_addr, pc_size, d_tn->cmn_size));
|
||||||
|
KMP_FATAL(TPCommonBlocksInconsist);
|
||||||
}
|
}
|
||||||
#endif /* USE_CHECKS_COMMON */
|
#endif /* USE_CHECKS_COMMON */
|
||||||
|
|
||||||
tt = &(__kmp_threads[ gtid ]->th.th_pri_common->data[ KMP_HASH(pc_addr) ]);
|
tt = &(__kmp_threads[gtid]->th.th_pri_common->data[KMP_HASH(pc_addr)]);
|
||||||
|
|
||||||
#ifdef KMP_TASK_COMMON_DEBUG
|
#ifdef KMP_TASK_COMMON_DEBUG
|
||||||
if (*tt != 0) {
|
if (*tt != 0) {
|
||||||
KC_TRACE( 10, ( "__kmp_threadprivate_insert: WARNING! thread#%d: collision on %p\n",
|
KC_TRACE(
|
||||||
gtid, pc_addr ) );
|
10,
|
||||||
|
("__kmp_threadprivate_insert: WARNING! thread#%d: collision on %p\n",
|
||||||
|
gtid, pc_addr));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
tn->next = *tt;
|
tn->next = *tt;
|
||||||
*tt = tn;
|
*tt = tn;
|
||||||
|
|
||||||
#ifdef KMP_TASK_COMMON_DEBUG
|
#ifdef KMP_TASK_COMMON_DEBUG
|
||||||
KC_TRACE( 10, ( "__kmp_threadprivate_insert: thread#%d, inserted node %p on list\n",
|
KC_TRACE(10,
|
||||||
gtid, pc_addr ) );
|
("__kmp_threadprivate_insert: thread#%d, inserted node %p on list\n",
|
||||||
dump_list( );
|
gtid, pc_addr));
|
||||||
|
dump_list();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Link the node into a simple list */
|
/* Link the node into a simple list */
|
||||||
|
|
||||||
tn->link = __kmp_threads[ gtid ]->th.th_pri_head;
|
tn->link = __kmp_threads[gtid]->th.th_pri_head;
|
||||||
__kmp_threads[ gtid ]->th.th_pri_head = tn;
|
__kmp_threads[gtid]->th.th_pri_head = tn;
|
||||||
|
|
||||||
#ifdef BUILD_TV
|
#ifdef BUILD_TV
|
||||||
__kmp_tv_threadprivate_store( __kmp_threads[ gtid ], tn->gbl_addr, tn->par_addr );
|
__kmp_tv_threadprivate_store(__kmp_threads[gtid], tn->gbl_addr, tn->par_addr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( (__kmp_foreign_tp) ? (KMP_INITIAL_GTID (gtid)) : (KMP_UBER_GTID (gtid)) )
|
if ((__kmp_foreign_tp) ? (KMP_INITIAL_GTID(gtid)) : (KMP_UBER_GTID(gtid)))
|
||||||
return tn;
|
return tn;
|
||||||
|
|
||||||
/*
|
/* if C++ object with copy constructor, use it;
|
||||||
* if C++ object with copy constructor, use it;
|
|
||||||
* else if C++ object with constructor, use it for the non-master copies only;
|
* else if C++ object with constructor, use it for the non-master copies only;
|
||||||
* else use pod_init and memcpy
|
* else use pod_init and memcpy
|
||||||
*
|
*
|
||||||
* C++ constructors need to be called once for each non-master thread on allocate
|
* C++ constructors need to be called once for each non-master thread on
|
||||||
* C++ copy constructors need to be called once for each thread on allocate
|
* allocate
|
||||||
*/
|
* C++ copy constructors need to be called once for each thread on allocate */
|
||||||
|
|
||||||
/*
|
/* C++ object with constructors/destructors; don't call constructors for
|
||||||
* C++ object with constructors/destructors;
|
master thread though */
|
||||||
* don't call constructors for master thread though
|
|
||||||
*/
|
|
||||||
if (d_tn->is_vec) {
|
if (d_tn->is_vec) {
|
||||||
if ( d_tn->ct.ctorv != 0) {
|
if (d_tn->ct.ctorv != 0) {
|
||||||
(void) (*d_tn->ct.ctorv) (tn->par_addr, d_tn->vec_len);
|
(void)(*d_tn->ct.ctorv)(tn->par_addr, d_tn->vec_len);
|
||||||
} else if (d_tn->cct.cctorv != 0) {
|
} else if (d_tn->cct.cctorv != 0) {
|
||||||
(void) (*d_tn->cct.cctorv) (tn->par_addr, d_tn->obj_init, d_tn->vec_len);
|
(void)(*d_tn->cct.cctorv)(tn->par_addr, d_tn->obj_init, d_tn->vec_len);
|
||||||
} else if (tn->par_addr != tn->gbl_addr) {
|
} else if (tn->par_addr != tn->gbl_addr) {
|
||||||
__kmp_copy_common_data( tn->par_addr, d_tn->pod_init );
|
__kmp_copy_common_data(tn->par_addr, d_tn->pod_init);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( d_tn->ct.ctor != 0 ) {
|
if (d_tn->ct.ctor != 0) {
|
||||||
(void) (*d_tn->ct.ctor) (tn->par_addr);
|
(void)(*d_tn->ct.ctor)(tn->par_addr);
|
||||||
} else if (d_tn->cct.cctor != 0) {
|
} else if (d_tn->cct.cctor != 0) {
|
||||||
(void) (*d_tn->cct.cctor) (tn->par_addr, d_tn->obj_init);
|
(void)(*d_tn->cct.cctor)(tn->par_addr, d_tn->obj_init);
|
||||||
} else if (tn->par_addr != tn->gbl_addr) {
|
} else if (tn->par_addr != tn->gbl_addr) {
|
||||||
__kmp_copy_common_data( tn->par_addr, d_tn->pod_init );
|
__kmp_copy_common_data(tn->par_addr, d_tn->pod_init);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* !BUILD_OPENMP_C
|
/* !BUILD_OPENMP_C
|
||||||
if (tn->par_addr != tn->gbl_addr)
|
if (tn->par_addr != tn->gbl_addr)
|
||||||
__kmp_copy_common_data( tn->par_addr, d_tn->pod_init ); */
|
__kmp_copy_common_data( tn->par_addr, d_tn->pod_init ); */
|
||||||
|
|
||||||
|
|
@ -528,89 +502,93 @@ kmp_threadprivate_insert( int gtid, void *pc_addr, void *data_addr, size_t pc_si
|
||||||
Register constructors and destructors for thread private data.
|
Register constructors and destructors for thread private data.
|
||||||
This function is called when executing in parallel, when we know the thread id.
|
This function is called when executing in parallel, when we know the thread id.
|
||||||
*/
|
*/
|
||||||
void
|
void __kmpc_threadprivate_register(ident_t *loc, void *data, kmpc_ctor ctor,
|
||||||
__kmpc_threadprivate_register(ident_t *loc, void *data, kmpc_ctor ctor, kmpc_cctor cctor, kmpc_dtor dtor)
|
kmpc_cctor cctor, kmpc_dtor dtor) {
|
||||||
{
|
|
||||||
struct shared_common *d_tn, **lnk_tn;
|
struct shared_common *d_tn, **lnk_tn;
|
||||||
|
|
||||||
KC_TRACE( 10, ("__kmpc_threadprivate_register: called\n" ) );
|
KC_TRACE(10, ("__kmpc_threadprivate_register: called\n"));
|
||||||
|
|
||||||
#ifdef USE_CHECKS_COMMON
|
#ifdef USE_CHECKS_COMMON
|
||||||
/* copy constructor must be zero for current code gen (Nov 2002 - jph) */
|
/* copy constructor must be zero for current code gen (Nov 2002 - jph) */
|
||||||
KMP_ASSERT( cctor == 0);
|
KMP_ASSERT(cctor == 0);
|
||||||
#endif /* USE_CHECKS_COMMON */
|
#endif /* USE_CHECKS_COMMON */
|
||||||
|
|
||||||
/* Only the global data table exists. */
|
/* Only the global data table exists. */
|
||||||
d_tn = __kmp_find_shared_task_common( &__kmp_threadprivate_d_table, -1, data );
|
d_tn = __kmp_find_shared_task_common(&__kmp_threadprivate_d_table, -1, data);
|
||||||
|
|
||||||
if (d_tn == 0) {
|
if (d_tn == 0) {
|
||||||
d_tn = (struct shared_common *) __kmp_allocate( sizeof( struct shared_common ) );
|
d_tn = (struct shared_common *)__kmp_allocate(sizeof(struct shared_common));
|
||||||
d_tn->gbl_addr = data;
|
d_tn->gbl_addr = data;
|
||||||
|
|
||||||
d_tn->ct.ctor = ctor;
|
d_tn->ct.ctor = ctor;
|
||||||
d_tn->cct.cctor = cctor;
|
d_tn->cct.cctor = cctor;
|
||||||
d_tn->dt.dtor = dtor;
|
d_tn->dt.dtor = dtor;
|
||||||
/*
|
/*
|
||||||
d_tn->is_vec = FALSE; // AC: commented out because __kmp_allocate zeroes the memory
|
d_tn->is_vec = FALSE; // AC: commented out because __kmp_allocate
|
||||||
|
zeroes the memory
|
||||||
d_tn->vec_len = 0L;
|
d_tn->vec_len = 0L;
|
||||||
d_tn->obj_init = 0;
|
d_tn->obj_init = 0;
|
||||||
d_tn->pod_init = 0;
|
d_tn->pod_init = 0;
|
||||||
*/
|
*/
|
||||||
lnk_tn = &(__kmp_threadprivate_d_table.data[ KMP_HASH(data) ]);
|
lnk_tn = &(__kmp_threadprivate_d_table.data[KMP_HASH(data)]);
|
||||||
|
|
||||||
d_tn->next = *lnk_tn;
|
d_tn->next = *lnk_tn;
|
||||||
*lnk_tn = d_tn;
|
*lnk_tn = d_tn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *__kmpc_threadprivate(ident_t *loc, kmp_int32 global_tid, void *data,
|
||||||
__kmpc_threadprivate(ident_t *loc, kmp_int32 global_tid, void *data, size_t size)
|
size_t size) {
|
||||||
{
|
|
||||||
void *ret;
|
void *ret;
|
||||||
struct private_common *tn;
|
struct private_common *tn;
|
||||||
|
|
||||||
KC_TRACE( 10, ("__kmpc_threadprivate: T#%d called\n", global_tid ) );
|
KC_TRACE(10, ("__kmpc_threadprivate: T#%d called\n", global_tid));
|
||||||
|
|
||||||
#ifdef USE_CHECKS_COMMON
|
#ifdef USE_CHECKS_COMMON
|
||||||
if (! __kmp_init_serial)
|
if (!__kmp_init_serial)
|
||||||
KMP_FATAL( RTLNotInitialized );
|
KMP_FATAL(RTLNotInitialized);
|
||||||
#endif /* USE_CHECKS_COMMON */
|
#endif /* USE_CHECKS_COMMON */
|
||||||
|
|
||||||
if ( ! __kmp_threads[global_tid] -> th.th_root -> r.r_active && ! __kmp_foreign_tp ) {
|
if (!__kmp_threads[global_tid]->th.th_root->r.r_active && !__kmp_foreign_tp) {
|
||||||
/* The parallel address will NEVER overlap with the data_address */
|
/* The parallel address will NEVER overlap with the data_address */
|
||||||
/* dkp: 3rd arg to kmp_threadprivate_insert_private_data() is the data_address; use data_address = data */
|
/* dkp: 3rd arg to kmp_threadprivate_insert_private_data() is the
|
||||||
|
* data_address; use data_address = data */
|
||||||
|
|
||||||
KC_TRACE( 20, ("__kmpc_threadprivate: T#%d inserting private data\n", global_tid ) );
|
KC_TRACE(20, ("__kmpc_threadprivate: T#%d inserting private data\n",
|
||||||
kmp_threadprivate_insert_private_data( global_tid, data, data, size );
|
global_tid));
|
||||||
|
kmp_threadprivate_insert_private_data(global_tid, data, data, size);
|
||||||
|
|
||||||
ret = data;
|
ret = data;
|
||||||
}
|
} else {
|
||||||
else {
|
KC_TRACE(
|
||||||
KC_TRACE( 50, ("__kmpc_threadprivate: T#%d try to find private data at address %p\n",
|
50,
|
||||||
global_tid, data ) );
|
("__kmpc_threadprivate: T#%d try to find private data at address %p\n",
|
||||||
tn = __kmp_threadprivate_find_task_common( __kmp_threads[ global_tid ]->th.th_pri_common, global_tid, data );
|
global_tid, data));
|
||||||
|
tn = __kmp_threadprivate_find_task_common(
|
||||||
|
__kmp_threads[global_tid]->th.th_pri_common, global_tid, data);
|
||||||
|
|
||||||
if ( tn ) {
|
if (tn) {
|
||||||
KC_TRACE( 20, ("__kmpc_threadprivate: T#%d found data\n", global_tid ) );
|
KC_TRACE(20, ("__kmpc_threadprivate: T#%d found data\n", global_tid));
|
||||||
#ifdef USE_CHECKS_COMMON
|
#ifdef USE_CHECKS_COMMON
|
||||||
if ((size_t) size > tn->cmn_size) {
|
if ((size_t)size > tn->cmn_size) {
|
||||||
KC_TRACE( 10, ( "THREADPRIVATE: %p (%" KMP_UINTPTR_SPEC " ,%" KMP_UINTPTR_SPEC ")\n",
|
KC_TRACE(10, ("THREADPRIVATE: %p (%" KMP_UINTPTR_SPEC
|
||||||
data, size, tn->cmn_size ) );
|
" ,%" KMP_UINTPTR_SPEC ")\n",
|
||||||
KMP_FATAL( TPCommonBlocksInconsist );
|
data, size, tn->cmn_size));
|
||||||
|
KMP_FATAL(TPCommonBlocksInconsist);
|
||||||
}
|
}
|
||||||
#endif /* USE_CHECKS_COMMON */
|
#endif /* USE_CHECKS_COMMON */
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* The parallel address will NEVER overlap with the data_address */
|
/* The parallel address will NEVER overlap with the data_address */
|
||||||
/* dkp: 3rd arg to kmp_threadprivate_insert() is the data_address; use data_address = data */
|
/* dkp: 3rd arg to kmp_threadprivate_insert() is the data_address; use
|
||||||
KC_TRACE( 20, ("__kmpc_threadprivate: T#%d inserting data\n", global_tid ) );
|
* data_address = data */
|
||||||
tn = kmp_threadprivate_insert( global_tid, data, data, size );
|
KC_TRACE(20, ("__kmpc_threadprivate: T#%d inserting data\n", global_tid));
|
||||||
|
tn = kmp_threadprivate_insert(global_tid, data, data, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = tn->par_addr;
|
ret = tn->par_addr;
|
||||||
}
|
}
|
||||||
KC_TRACE( 10, ("__kmpc_threadprivate: T#%d exiting; return value = %p\n",
|
KC_TRACE(10, ("__kmpc_threadprivate: T#%d exiting; return value = %p\n",
|
||||||
global_tid, ret ) );
|
global_tid, ret));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -627,60 +605,61 @@ __kmpc_threadprivate(ident_t *loc, kmp_int32 global_tid, void *data, size_t size
|
||||||
Allocate private storage for threadprivate data.
|
Allocate private storage for threadprivate data.
|
||||||
*/
|
*/
|
||||||
void *
|
void *
|
||||||
__kmpc_threadprivate_cached(
|
__kmpc_threadprivate_cached(ident_t *loc,
|
||||||
ident_t * loc,
|
|
||||||
kmp_int32 global_tid, // gtid.
|
kmp_int32 global_tid, // gtid.
|
||||||
void * data, // Pointer to original global variable.
|
void *data, // Pointer to original global variable.
|
||||||
size_t size, // Size of original global variable.
|
size_t size, // Size of original global variable.
|
||||||
void *** cache
|
void ***cache) {
|
||||||
) {
|
KC_TRACE(10, ("__kmpc_threadprivate_cached: T#%d called with cache: %p, "
|
||||||
KC_TRACE( 10, ("__kmpc_threadprivate_cached: T#%d called with cache: %p, address: %p, size: %"
|
"address: %p, size: %" KMP_SIZE_T_SPEC "\n",
|
||||||
KMP_SIZE_T_SPEC "\n",
|
global_tid, *cache, data, size));
|
||||||
global_tid, *cache, data, size ) );
|
|
||||||
|
|
||||||
if ( TCR_PTR(*cache) == 0) {
|
if (TCR_PTR(*cache) == 0) {
|
||||||
__kmp_acquire_lock( & __kmp_global_lock, global_tid );
|
__kmp_acquire_lock(&__kmp_global_lock, global_tid);
|
||||||
|
|
||||||
if ( TCR_PTR(*cache) == 0) {
|
if (TCR_PTR(*cache) == 0) {
|
||||||
__kmp_acquire_bootstrap_lock(&__kmp_tp_cached_lock);
|
__kmp_acquire_bootstrap_lock(&__kmp_tp_cached_lock);
|
||||||
__kmp_tp_cached = 1;
|
__kmp_tp_cached = 1;
|
||||||
__kmp_release_bootstrap_lock(&__kmp_tp_cached_lock);
|
__kmp_release_bootstrap_lock(&__kmp_tp_cached_lock);
|
||||||
void ** my_cache;
|
void **my_cache;
|
||||||
KMP_ITT_IGNORE(
|
KMP_ITT_IGNORE(
|
||||||
my_cache = (void**)
|
my_cache = (void **)__kmp_allocate(
|
||||||
__kmp_allocate(sizeof( void * ) * __kmp_tp_capacity + sizeof ( kmp_cached_addr_t ));
|
sizeof(void *) * __kmp_tp_capacity + sizeof(kmp_cached_addr_t)););
|
||||||
);
|
|
||||||
// No need to zero the allocated memory; __kmp_allocate does that.
|
// No need to zero the allocated memory; __kmp_allocate does that.
|
||||||
KC_TRACE( 50, ("__kmpc_threadprivate_cached: T#%d allocated cache at address %p\n",
|
KC_TRACE(
|
||||||
global_tid, my_cache ) );
|
50,
|
||||||
|
("__kmpc_threadprivate_cached: T#%d allocated cache at address %p\n",
|
||||||
|
global_tid, my_cache));
|
||||||
|
|
||||||
/* TODO: free all this memory in __kmp_common_destroy using __kmp_threadpriv_cache_list */
|
/* TODO: free all this memory in __kmp_common_destroy using
|
||||||
|
* __kmp_threadpriv_cache_list */
|
||||||
/* Add address of mycache to linked list for cleanup later */
|
/* Add address of mycache to linked list for cleanup later */
|
||||||
kmp_cached_addr_t *tp_cache_addr;
|
kmp_cached_addr_t *tp_cache_addr;
|
||||||
|
|
||||||
tp_cache_addr = (kmp_cached_addr_t *) & my_cache[__kmp_tp_capacity];
|
tp_cache_addr = (kmp_cached_addr_t *)&my_cache[__kmp_tp_capacity];
|
||||||
tp_cache_addr -> addr = my_cache;
|
tp_cache_addr->addr = my_cache;
|
||||||
tp_cache_addr -> next = __kmp_threadpriv_cache_list;
|
tp_cache_addr->next = __kmp_threadpriv_cache_list;
|
||||||
__kmp_threadpriv_cache_list = tp_cache_addr;
|
__kmp_threadpriv_cache_list = tp_cache_addr;
|
||||||
|
|
||||||
KMP_MB();
|
KMP_MB();
|
||||||
|
|
||||||
TCW_PTR( *cache, my_cache);
|
TCW_PTR(*cache, my_cache);
|
||||||
|
|
||||||
KMP_MB();
|
KMP_MB();
|
||||||
}
|
}
|
||||||
|
|
||||||
__kmp_release_lock( & __kmp_global_lock, global_tid );
|
__kmp_release_lock(&__kmp_global_lock, global_tid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *ret;
|
void *ret;
|
||||||
if ((ret = TCR_PTR((*cache)[ global_tid ])) == 0) {
|
if ((ret = TCR_PTR((*cache)[global_tid])) == 0) {
|
||||||
ret = __kmpc_threadprivate( loc, global_tid, data, (size_t) size);
|
ret = __kmpc_threadprivate(loc, global_tid, data, (size_t)size);
|
||||||
|
|
||||||
TCW_PTR( (*cache)[ global_tid ], ret);
|
TCW_PTR((*cache)[global_tid], ret);
|
||||||
}
|
}
|
||||||
KC_TRACE( 10, ("__kmpc_threadprivate_cached: T#%d exiting; return value = %p\n",
|
KC_TRACE(10,
|
||||||
global_tid, ret ) );
|
("__kmpc_threadprivate_cached: T#%d exiting; return value = %p\n",
|
||||||
|
global_tid, ret));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -695,37 +674,38 @@ __kmpc_threadprivate_cached(
|
||||||
@param vector_length length of the vector (bytes or elements?)
|
@param vector_length length of the vector (bytes or elements?)
|
||||||
Register vector constructors and destructors for thread private data.
|
Register vector constructors and destructors for thread private data.
|
||||||
*/
|
*/
|
||||||
void
|
void __kmpc_threadprivate_register_vec(ident_t *loc, void *data,
|
||||||
__kmpc_threadprivate_register_vec( ident_t *loc, void *data, kmpc_ctor_vec ctor,
|
kmpc_ctor_vec ctor, kmpc_cctor_vec cctor,
|
||||||
kmpc_cctor_vec cctor, kmpc_dtor_vec dtor,
|
kmpc_dtor_vec dtor,
|
||||||
size_t vector_length )
|
size_t vector_length) {
|
||||||
{
|
|
||||||
struct shared_common *d_tn, **lnk_tn;
|
struct shared_common *d_tn, **lnk_tn;
|
||||||
|
|
||||||
KC_TRACE( 10, ("__kmpc_threadprivate_register_vec: called\n" ) );
|
KC_TRACE(10, ("__kmpc_threadprivate_register_vec: called\n"));
|
||||||
|
|
||||||
#ifdef USE_CHECKS_COMMON
|
#ifdef USE_CHECKS_COMMON
|
||||||
/* copy constructor must be zero for current code gen (Nov 2002 - jph) */
|
/* copy constructor must be zero for current code gen (Nov 2002 - jph) */
|
||||||
KMP_ASSERT( cctor == 0);
|
KMP_ASSERT(cctor == 0);
|
||||||
#endif /* USE_CHECKS_COMMON */
|
#endif /* USE_CHECKS_COMMON */
|
||||||
|
|
||||||
d_tn = __kmp_find_shared_task_common( &__kmp_threadprivate_d_table,
|
d_tn = __kmp_find_shared_task_common(
|
||||||
-1, data ); /* Only the global data table exists. */
|
&__kmp_threadprivate_d_table, -1,
|
||||||
|
data); /* Only the global data table exists. */
|
||||||
|
|
||||||
if (d_tn == 0) {
|
if (d_tn == 0) {
|
||||||
d_tn = (struct shared_common *) __kmp_allocate( sizeof( struct shared_common ) );
|
d_tn = (struct shared_common *)__kmp_allocate(sizeof(struct shared_common));
|
||||||
d_tn->gbl_addr = data;
|
d_tn->gbl_addr = data;
|
||||||
|
|
||||||
d_tn->ct.ctorv = ctor;
|
d_tn->ct.ctorv = ctor;
|
||||||
d_tn->cct.cctorv = cctor;
|
d_tn->cct.cctorv = cctor;
|
||||||
d_tn->dt.dtorv = dtor;
|
d_tn->dt.dtorv = dtor;
|
||||||
d_tn->is_vec = TRUE;
|
d_tn->is_vec = TRUE;
|
||||||
d_tn->vec_len = (size_t) vector_length;
|
d_tn->vec_len = (size_t)vector_length;
|
||||||
/*
|
/*
|
||||||
d_tn->obj_init = 0; // AC: commented out because __kmp_allocate zeroes the memory
|
d_tn->obj_init = 0; // AC: commented out because __kmp_allocate
|
||||||
|
zeroes the memory
|
||||||
d_tn->pod_init = 0;
|
d_tn->pod_init = 0;
|
||||||
*/
|
*/
|
||||||
lnk_tn = &(__kmp_threadprivate_d_table.data[ KMP_HASH(data) ]);
|
lnk_tn = &(__kmp_threadprivate_d_table.data[KMP_HASH(data)]);
|
||||||
|
|
||||||
d_tn->next = *lnk_tn;
|
d_tn->next = *lnk_tn;
|
||||||
*lnk_tn = d_tn;
|
*lnk_tn = d_tn;
|
||||||
|
|
|
||||||
|
|
@ -14,34 +14,28 @@
|
||||||
|
|
||||||
|
|
||||||
#include "kmp.h"
|
#include "kmp.h"
|
||||||
#include "kmp_wrapper_getpid.h"
|
|
||||||
#include "kmp_str.h"
|
|
||||||
#include <float.h>
|
|
||||||
#include "kmp_i18n.h"
|
#include "kmp_i18n.h"
|
||||||
|
#include "kmp_str.h"
|
||||||
/* ------------------------------------------------------------------------ */
|
#include "kmp_wrapper_getpid.h"
|
||||||
/* ------------------------------------------------------------------------ */
|
#include <float.h>
|
||||||
|
|
||||||
static const char *unknown = "unknown";
|
static const char *unknown = "unknown";
|
||||||
|
|
||||||
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
||||||
|
|
||||||
/* NOTE: If called before serial_initialize (i.e. from runtime_initialize), then */
|
/* NOTE: If called before serial_initialize (i.e. from runtime_initialize), then
|
||||||
/* the debugging package has not been initialized yet, and only "0" will print */
|
the debugging package has not been initialized yet, and only "0" will print
|
||||||
/* debugging output since the environment variables have not been read. */
|
debugging output since the environment variables have not been read. */
|
||||||
|
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
static int trace_level = 5;
|
static int trace_level = 5;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/* LOG_ID_BITS = ( 1 + floor( log_2( max( log_per_phy - 1, 1 ))))
|
||||||
* LOG_ID_BITS = ( 1 + floor( log_2( max( log_per_phy - 1, 1 ))))
|
|
||||||
* APIC_ID = (PHY_ID << LOG_ID_BITS) | LOG_ID
|
* APIC_ID = (PHY_ID << LOG_ID_BITS) | LOG_ID
|
||||||
* PHY_ID = APIC_ID >> LOG_ID_BITS
|
* PHY_ID = APIC_ID >> LOG_ID_BITS
|
||||||
*/
|
*/
|
||||||
int
|
int __kmp_get_physical_id(int log_per_phy, int apic_id) {
|
||||||
__kmp_get_physical_id( int log_per_phy, int apic_id )
|
|
||||||
{
|
|
||||||
int index_lsb, index_msb, temp;
|
int index_lsb, index_msb, temp;
|
||||||
|
|
||||||
if (log_per_phy > 1) {
|
if (log_per_phy > 1) {
|
||||||
|
|
@ -49,44 +43,43 @@ __kmp_get_physical_id( int log_per_phy, int apic_id )
|
||||||
index_msb = 31;
|
index_msb = 31;
|
||||||
|
|
||||||
temp = log_per_phy;
|
temp = log_per_phy;
|
||||||
while ( (temp & 1) == 0 ) {
|
while ((temp & 1) == 0) {
|
||||||
temp >>= 1;
|
temp >>= 1;
|
||||||
index_lsb++;
|
index_lsb++;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = log_per_phy;
|
temp = log_per_phy;
|
||||||
while ( (temp & 0x80000000)==0 ) {
|
while ((temp & 0x80000000) == 0) {
|
||||||
temp <<= 1;
|
temp <<= 1;
|
||||||
index_msb--;
|
index_msb--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If >1 bits were set in log_per_phy, choose next higher power of 2 */
|
/* If >1 bits were set in log_per_phy, choose next higher power of 2 */
|
||||||
if (index_lsb != index_msb) index_msb++;
|
if (index_lsb != index_msb)
|
||||||
|
index_msb++;
|
||||||
|
|
||||||
return ( (int) (apic_id >> index_msb) );
|
return ((int)(apic_id >> index_msb));
|
||||||
}
|
}
|
||||||
|
|
||||||
return apic_id;
|
return apic_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LOG_ID_BITS = ( 1 + floor( log_2( max( log_per_phy - 1, 1 ))))
|
* LOG_ID_BITS = ( 1 + floor( log_2( max( log_per_phy - 1, 1 ))))
|
||||||
* APIC_ID = (PHY_ID << LOG_ID_BITS) | LOG_ID
|
* APIC_ID = (PHY_ID << LOG_ID_BITS) | LOG_ID
|
||||||
* LOG_ID = APIC_ID & (( 1 << LOG_ID_BITS ) - 1 )
|
* LOG_ID = APIC_ID & (( 1 << LOG_ID_BITS ) - 1 )
|
||||||
*/
|
*/
|
||||||
int
|
int __kmp_get_logical_id(int log_per_phy, int apic_id) {
|
||||||
__kmp_get_logical_id( int log_per_phy, int apic_id )
|
|
||||||
{
|
|
||||||
unsigned current_bit;
|
unsigned current_bit;
|
||||||
int bits_seen;
|
int bits_seen;
|
||||||
|
|
||||||
if (log_per_phy <= 1) return ( 0 );
|
if (log_per_phy <= 1)
|
||||||
|
return (0);
|
||||||
|
|
||||||
bits_seen = 0;
|
bits_seen = 0;
|
||||||
|
|
||||||
for (current_bit = 1; log_per_phy != 0; current_bit <<= 1) {
|
for (current_bit = 1; log_per_phy != 0; current_bit <<= 1) {
|
||||||
if ( log_per_phy & current_bit ) {
|
if (log_per_phy & current_bit) {
|
||||||
log_per_phy &= ~current_bit;
|
log_per_phy &= ~current_bit;
|
||||||
bits_seen++;
|
bits_seen++;
|
||||||
}
|
}
|
||||||
|
|
@ -97,30 +90,29 @@ __kmp_get_logical_id( int log_per_phy, int apic_id )
|
||||||
current_bit >>= 1;
|
current_bit >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( (int) ((current_bit - 1) & apic_id) );
|
return ((int)((current_bit - 1) & apic_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static kmp_uint64 __kmp_parse_frequency( // R: Frequency in Hz.
|
||||||
static
|
char const *frequency // I: Float number and unit: MHz, GHz, or TGz.
|
||||||
kmp_uint64
|
) {
|
||||||
__kmp_parse_frequency( // R: Frequency in Hz.
|
|
||||||
char const * frequency // I: Float number and unit: MHz, GHz, or TGz.
|
|
||||||
) {
|
|
||||||
|
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
char const * unit = NULL;
|
char const *unit = NULL;
|
||||||
kmp_uint64 result = 0; /* Zero is a better unknown value than all ones. */
|
kmp_uint64 result = 0; /* Zero is a better unknown value than all ones. */
|
||||||
|
|
||||||
if ( frequency == NULL ) {
|
if (frequency == NULL) {
|
||||||
return result;
|
return result;
|
||||||
}; // if
|
}; // if
|
||||||
value = strtod( frequency, (char * *) & unit ); // strtod() does not like "char const *".
|
value = strtod(frequency,
|
||||||
if ( 0 < value && value <= DBL_MAX ) { // Good value (not overflow, underflow, etc).
|
(char **)&unit); // strtod() does not like "char const *".
|
||||||
if ( strcmp( unit, "MHz" ) == 0 ) {
|
if (0 < value &&
|
||||||
|
value <= DBL_MAX) { // Good value (not overflow, underflow, etc).
|
||||||
|
if (strcmp(unit, "MHz") == 0) {
|
||||||
value = value * 1.0E+6;
|
value = value * 1.0E+6;
|
||||||
} else if ( strcmp( unit, "GHz" ) == 0 ) {
|
} else if (strcmp(unit, "GHz") == 0) {
|
||||||
value = value * 1.0E+9;
|
value = value * 1.0E+9;
|
||||||
} else if ( strcmp( unit, "THz" ) == 0 ) {
|
} else if (strcmp(unit, "THz") == 0) {
|
||||||
value = value * 1.0E+12;
|
value = value * 1.0E+12;
|
||||||
} else { // Wrong unit.
|
} else { // Wrong unit.
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -131,9 +123,7 @@ __kmp_parse_frequency( // R: Frequency in Hz.
|
||||||
|
|
||||||
}; // func __kmp_parse_cpu_frequency
|
}; // func __kmp_parse_cpu_frequency
|
||||||
|
|
||||||
void
|
void __kmp_query_cpuid(kmp_cpuinfo_t *p) {
|
||||||
__kmp_query_cpuid( kmp_cpuinfo_t *p )
|
|
||||||
{
|
|
||||||
struct kmp_cpuid buf;
|
struct kmp_cpuid buf;
|
||||||
int max_arg;
|
int max_arg;
|
||||||
int log_per_phy;
|
int log_per_phy;
|
||||||
|
|
@ -145,10 +135,11 @@ __kmp_query_cpuid( kmp_cpuinfo_t *p )
|
||||||
|
|
||||||
p->sse2 = 1; // Assume SSE2 by default.
|
p->sse2 = 1; // Assume SSE2 by default.
|
||||||
|
|
||||||
__kmp_x86_cpuid( 0, 0, &buf );
|
__kmp_x86_cpuid(0, 0, &buf);
|
||||||
|
|
||||||
KA_TRACE( trace_level, ("INFO: CPUID %d: EAX=0x%08X EBX=0x%08X ECX=0x%08X EDX=0x%08X\n",
|
KA_TRACE(trace_level,
|
||||||
0, buf.eax, buf.ebx, buf.ecx, buf.edx ) );
|
("INFO: CPUID %d: EAX=0x%08X EBX=0x%08X ECX=0x%08X EDX=0x%08X\n", 0,
|
||||||
|
buf.eax, buf.ebx, buf.ecx, buf.edx));
|
||||||
|
|
||||||
max_arg = buf.eax;
|
max_arg = buf.eax;
|
||||||
|
|
||||||
|
|
@ -156,93 +147,96 @@ __kmp_query_cpuid( kmp_cpuinfo_t *p )
|
||||||
|
|
||||||
if (max_arg >= 1) {
|
if (max_arg >= 1) {
|
||||||
int i;
|
int i;
|
||||||
kmp_uint32 t, data[ 4 ];
|
kmp_uint32 t, data[4];
|
||||||
|
|
||||||
__kmp_x86_cpuid( 1, 0, &buf );
|
__kmp_x86_cpuid(1, 0, &buf);
|
||||||
KA_TRACE( trace_level, ("INFO: CPUID %d: EAX=0x%08X EBX=0x%08X ECX=0x%08X EDX=0x%08X\n",
|
KA_TRACE(trace_level,
|
||||||
1, buf.eax, buf.ebx, buf.ecx, buf.edx ) );
|
("INFO: CPUID %d: EAX=0x%08X EBX=0x%08X ECX=0x%08X EDX=0x%08X\n",
|
||||||
|
1, buf.eax, buf.ebx, buf.ecx, buf.edx));
|
||||||
|
|
||||||
{
|
{
|
||||||
#define get_value(reg,lo,mask) ( ( ( reg ) >> ( lo ) ) & ( mask ) )
|
#define get_value(reg, lo, mask) (((reg) >> (lo)) & (mask))
|
||||||
|
|
||||||
p->signature = buf.eax;
|
p->signature = buf.eax;
|
||||||
p->family = get_value( buf.eax, 20, 0xff ) + get_value( buf.eax, 8, 0x0f );
|
p->family = get_value(buf.eax, 20, 0xff) + get_value(buf.eax, 8, 0x0f);
|
||||||
p->model = ( get_value( buf.eax, 16, 0x0f ) << 4 ) + get_value( buf.eax, 4, 0x0f );
|
p->model =
|
||||||
p->stepping = get_value( buf.eax, 0, 0x0f );
|
(get_value(buf.eax, 16, 0x0f) << 4) + get_value(buf.eax, 4, 0x0f);
|
||||||
|
p->stepping = get_value(buf.eax, 0, 0x0f);
|
||||||
|
|
||||||
#undef get_value
|
#undef get_value
|
||||||
|
|
||||||
KA_TRACE( trace_level, (" family = %d, model = %d, stepping = %d\n", p->family, p->model, p->stepping ) );
|
KA_TRACE(trace_level, (" family = %d, model = %d, stepping = %d\n",
|
||||||
|
p->family, p->model, p->stepping));
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( t = buf.ebx, i = 0; i < 4; t >>= 8, ++i ) {
|
for (t = buf.ebx, i = 0; i < 4; t >>= 8, ++i) {
|
||||||
data[ i ] = (t & 0xff);
|
data[i] = (t & 0xff);
|
||||||
}; // for
|
}; // for
|
||||||
|
|
||||||
p->sse2 = ( buf.edx >> 26 ) & 1;
|
p->sse2 = (buf.edx >> 26) & 1;
|
||||||
|
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
|
|
||||||
if ( (buf.edx >> 4) & 1 ) {
|
if ((buf.edx >> 4) & 1) {
|
||||||
/* TSC - Timestamp Counter Available */
|
/* TSC - Timestamp Counter Available */
|
||||||
KA_TRACE( trace_level, (" TSC" ) );
|
KA_TRACE(trace_level, (" TSC"));
|
||||||
}
|
}
|
||||||
if ( (buf.edx >> 8) & 1 ) {
|
if ((buf.edx >> 8) & 1) {
|
||||||
/* CX8 - CMPXCHG8B Instruction Available */
|
/* CX8 - CMPXCHG8B Instruction Available */
|
||||||
KA_TRACE( trace_level, (" CX8" ) );
|
KA_TRACE(trace_level, (" CX8"));
|
||||||
}
|
}
|
||||||
if ( (buf.edx >> 9) & 1 ) {
|
if ((buf.edx >> 9) & 1) {
|
||||||
/* APIC - Local APIC Present (multi-processor operation support */
|
/* APIC - Local APIC Present (multi-processor operation support */
|
||||||
KA_TRACE( trace_level, (" APIC" ) );
|
KA_TRACE(trace_level, (" APIC"));
|
||||||
}
|
}
|
||||||
if ( (buf.edx >> 15) & 1 ) {
|
if ((buf.edx >> 15) & 1) {
|
||||||
/* CMOV - Conditional MOVe Instruction Available */
|
/* CMOV - Conditional MOVe Instruction Available */
|
||||||
KA_TRACE( trace_level, (" CMOV" ) );
|
KA_TRACE(trace_level, (" CMOV"));
|
||||||
}
|
}
|
||||||
if ( (buf.edx >> 18) & 1 ) {
|
if ((buf.edx >> 18) & 1) {
|
||||||
/* PSN - Processor Serial Number Available */
|
/* PSN - Processor Serial Number Available */
|
||||||
KA_TRACE( trace_level, (" PSN" ) );
|
KA_TRACE(trace_level, (" PSN"));
|
||||||
}
|
}
|
||||||
if ( (buf.edx >> 19) & 1 ) {
|
if ((buf.edx >> 19) & 1) {
|
||||||
/* CLFULSH - Cache Flush Instruction Available */
|
/* CLFULSH - Cache Flush Instruction Available */
|
||||||
cflush_size = data[ 1 ] * 8; /* Bits 15-08: CLFLUSH line size = 8 (64 bytes) */
|
cflush_size =
|
||||||
KA_TRACE( trace_level, (" CLFLUSH(%db)", cflush_size ) );
|
data[1] * 8; /* Bits 15-08: CLFLUSH line size = 8 (64 bytes) */
|
||||||
|
KA_TRACE(trace_level, (" CLFLUSH(%db)", cflush_size));
|
||||||
}
|
}
|
||||||
if ( (buf.edx >> 21) & 1 ) {
|
if ((buf.edx >> 21) & 1) {
|
||||||
/* DTES - Debug Trace & EMON Store */
|
/* DTES - Debug Trace & EMON Store */
|
||||||
KA_TRACE( trace_level, (" DTES" ) );
|
KA_TRACE(trace_level, (" DTES"));
|
||||||
}
|
}
|
||||||
if ( (buf.edx >> 22) & 1 ) {
|
if ((buf.edx >> 22) & 1) {
|
||||||
/* ACPI - ACPI Support Available */
|
/* ACPI - ACPI Support Available */
|
||||||
KA_TRACE( trace_level, (" ACPI" ) );
|
KA_TRACE(trace_level, (" ACPI"));
|
||||||
}
|
}
|
||||||
if ( (buf.edx >> 23) & 1 ) {
|
if ((buf.edx >> 23) & 1) {
|
||||||
/* MMX - Multimedia Extensions */
|
/* MMX - Multimedia Extensions */
|
||||||
KA_TRACE( trace_level, (" MMX" ) );
|
KA_TRACE(trace_level, (" MMX"));
|
||||||
}
|
}
|
||||||
if ( (buf.edx >> 25) & 1 ) {
|
if ((buf.edx >> 25) & 1) {
|
||||||
/* SSE - SSE Instructions */
|
/* SSE - SSE Instructions */
|
||||||
KA_TRACE( trace_level, (" SSE" ) );
|
KA_TRACE(trace_level, (" SSE"));
|
||||||
}
|
}
|
||||||
if ( (buf.edx >> 26) & 1 ) {
|
if ((buf.edx >> 26) & 1) {
|
||||||
/* SSE2 - SSE2 Instructions */
|
/* SSE2 - SSE2 Instructions */
|
||||||
KA_TRACE( trace_level, (" SSE2" ) );
|
KA_TRACE(trace_level, (" SSE2"));
|
||||||
}
|
}
|
||||||
if ( (buf.edx >> 27) & 1 ) {
|
if ((buf.edx >> 27) & 1) {
|
||||||
/* SLFSNP - Self-Snooping Cache */
|
/* SLFSNP - Self-Snooping Cache */
|
||||||
KA_TRACE( trace_level, (" SLFSNP" ) );
|
KA_TRACE(trace_level, (" SLFSNP"));
|
||||||
}
|
}
|
||||||
#endif /* KMP_DEBUG */
|
#endif /* KMP_DEBUG */
|
||||||
|
|
||||||
if ( (buf.edx >> 28) & 1 ) {
|
if ((buf.edx >> 28) & 1) {
|
||||||
/* Bits 23-16: Logical Processors per Physical Processor (1 for P4) */
|
/* Bits 23-16: Logical Processors per Physical Processor (1 for P4) */
|
||||||
log_per_phy = data[ 2 ];
|
log_per_phy = data[2];
|
||||||
p->apic_id = data[ 3 ]; /* Bits 31-24: Processor Initial APIC ID (X) */
|
p->apic_id = data[3]; /* Bits 31-24: Processor Initial APIC ID (X) */
|
||||||
KA_TRACE( trace_level, (" HT(%d TPUs)", log_per_phy ) );
|
KA_TRACE(trace_level, (" HT(%d TPUs)", log_per_phy));
|
||||||
|
|
||||||
if( log_per_phy > 1 ) {
|
if (log_per_phy > 1) {
|
||||||
/* default to 1k FOR JT-enabled processors (4k on OS X*) */
|
/* default to 1k FOR JT-enabled processors (4k on OS X*) */
|
||||||
#if KMP_OS_DARWIN
|
#if KMP_OS_DARWIN
|
||||||
p->cpu_stackoffset = 4 * 1024;
|
p->cpu_stackoffset = 4 * 1024;
|
||||||
#else
|
#else
|
||||||
|
|
@ -250,87 +244,79 @@ __kmp_query_cpuid( kmp_cpuinfo_t *p )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
p->physical_id = __kmp_get_physical_id( log_per_phy, p->apic_id );
|
p->physical_id = __kmp_get_physical_id(log_per_phy, p->apic_id);
|
||||||
p->logical_id = __kmp_get_logical_id( log_per_phy, p->apic_id );
|
p->logical_id = __kmp_get_logical_id(log_per_phy, p->apic_id);
|
||||||
}
|
}
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
if ( (buf.edx >> 29) & 1 ) {
|
if ((buf.edx >> 29) & 1) {
|
||||||
/* ATHROTL - Automatic Throttle Control */
|
/* ATHROTL - Automatic Throttle Control */
|
||||||
KA_TRACE( trace_level, (" ATHROTL" ) );
|
KA_TRACE(trace_level, (" ATHROTL"));
|
||||||
}
|
}
|
||||||
KA_TRACE( trace_level, (" ]\n" ) );
|
KA_TRACE(trace_level, (" ]\n"));
|
||||||
|
|
||||||
for (i = 2; i <= max_arg; ++i) {
|
for (i = 2; i <= max_arg; ++i) {
|
||||||
__kmp_x86_cpuid( i, 0, &buf );
|
__kmp_x86_cpuid(i, 0, &buf);
|
||||||
KA_TRACE( trace_level,
|
KA_TRACE(trace_level,
|
||||||
( "INFO: CPUID %d: EAX=0x%08X EBX=0x%08X ECX=0x%08X EDX=0x%08X\n",
|
("INFO: CPUID %d: EAX=0x%08X EBX=0x%08X ECX=0x%08X EDX=0x%08X\n",
|
||||||
i, buf.eax, buf.ebx, buf.ecx, buf.edx ) );
|
i, buf.eax, buf.ebx, buf.ecx, buf.edx));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if KMP_USE_ADAPTIVE_LOCKS
|
#if KMP_USE_ADAPTIVE_LOCKS
|
||||||
p->rtm = 0;
|
p->rtm = 0;
|
||||||
if (max_arg > 7)
|
if (max_arg > 7) {
|
||||||
{
|
|
||||||
/* RTM bit CPUID.07:EBX, bit 11 */
|
/* RTM bit CPUID.07:EBX, bit 11 */
|
||||||
__kmp_x86_cpuid(7, 0, &buf);
|
__kmp_x86_cpuid(7, 0, &buf);
|
||||||
p->rtm = (buf.ebx >> 11) & 1;
|
p->rtm = (buf.ebx >> 11) & 1;
|
||||||
KA_TRACE( trace_level, (" RTM" ) );
|
KA_TRACE(trace_level, (" RTM"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}; // if
|
}; // if
|
||||||
|
|
||||||
{ // Parse CPU brand string for frequency, saving the string for later.
|
{ // Parse CPU brand string for frequency, saving the string for later.
|
||||||
int i;
|
int i;
|
||||||
kmp_cpuid_t * base = (kmp_cpuid_t *)&p->name[0];
|
kmp_cpuid_t *base = (kmp_cpuid_t *)&p->name[0];
|
||||||
|
|
||||||
// Get CPU brand string.
|
// Get CPU brand string.
|
||||||
for ( i = 0; i < 3; ++ i ) {
|
for (i = 0; i < 3; ++i) {
|
||||||
__kmp_x86_cpuid( 0x80000002 + i, 0, base+i );
|
__kmp_x86_cpuid(0x80000002 + i, 0, base + i);
|
||||||
}; // for
|
}; // for
|
||||||
p->name[ sizeof(p->name) - 1 ] = 0; // Just in case. ;-)
|
p->name[sizeof(p->name) - 1] = 0; // Just in case. ;-)
|
||||||
KA_TRACE( trace_level, ( "cpu brand string: \"%s\"\n", &p->name[0] ) );
|
KA_TRACE(trace_level, ("cpu brand string: \"%s\"\n", &p->name[0]));
|
||||||
|
|
||||||
// Parse frequency.
|
// Parse frequency.
|
||||||
p->frequency = __kmp_parse_frequency( strrchr( &p->name[0], ' ' ) );
|
p->frequency = __kmp_parse_frequency(strrchr(&p->name[0], ' '));
|
||||||
KA_TRACE( trace_level, ( "cpu frequency from brand string: %" KMP_UINT64_SPEC "\n", p->frequency ) );
|
KA_TRACE(trace_level,
|
||||||
|
("cpu frequency from brand string: %" KMP_UINT64_SPEC "\n",
|
||||||
|
p->frequency));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* KMP_ARCH_X86 || KMP_ARCH_X86_64 */
|
#endif /* KMP_ARCH_X86 || KMP_ARCH_X86_64 */
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------ */
|
void __kmp_expand_host_name(char *buffer, size_t size) {
|
||||||
/* ------------------------------------------------------------------------------------ */
|
|
||||||
|
|
||||||
void
|
|
||||||
__kmp_expand_host_name( char *buffer, size_t size )
|
|
||||||
{
|
|
||||||
KMP_DEBUG_ASSERT(size >= sizeof(unknown));
|
KMP_DEBUG_ASSERT(size >= sizeof(unknown));
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
{
|
{
|
||||||
DWORD s = size;
|
DWORD s = size;
|
||||||
|
|
||||||
if (! GetComputerNameA( buffer, & s ))
|
if (!GetComputerNameA(buffer, &s))
|
||||||
KMP_STRCPY_S( buffer, size, unknown );
|
KMP_STRCPY_S(buffer, size, unknown);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
buffer[size - 2] = 0;
|
buffer[size - 2] = 0;
|
||||||
if (gethostname( buffer, size ) || buffer[size - 2] != 0)
|
if (gethostname(buffer, size) || buffer[size - 2] != 0)
|
||||||
KMP_STRCPY_S( buffer, size, unknown );
|
KMP_STRCPY_S(buffer, size, unknown);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Expand the meta characters in the filename:
|
/* Expand the meta characters in the filename:
|
||||||
*
|
|
||||||
* Currently defined characters are:
|
* Currently defined characters are:
|
||||||
*
|
|
||||||
* %H the hostname
|
* %H the hostname
|
||||||
* %P the number of threads used.
|
* %P the number of threads used.
|
||||||
* %I the unique identifier for this run.
|
* %I the unique identifier for this run.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void __kmp_expand_file_name(char *result, size_t rlen, char *pattern) {
|
||||||
__kmp_expand_file_name( char *result, size_t rlen, char *pattern )
|
|
||||||
{
|
|
||||||
char *pos = result, *end = result + rlen - 1;
|
char *pos = result, *end = result + rlen - 1;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
int default_cpu_width = 1;
|
int default_cpu_width = 1;
|
||||||
|
|
@ -340,7 +326,8 @@ __kmp_expand_file_name( char *result, size_t rlen, char *pattern )
|
||||||
*end = 0;
|
*end = 0;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = __kmp_xproc; i >= 10; i /= 10, ++default_cpu_width);
|
for (i = __kmp_xproc; i >= 10; i /= 10, ++default_cpu_width)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pattern != NULL) {
|
if (pattern != NULL) {
|
||||||
|
|
@ -367,51 +354,45 @@ __kmp_expand_file_name( char *result, size_t rlen, char *pattern )
|
||||||
|
|
||||||
switch (*pattern) {
|
switch (*pattern) {
|
||||||
case 'H':
|
case 'H':
|
||||||
case 'h':
|
case 'h': {
|
||||||
{
|
__kmp_expand_host_name(buffer, sizeof(buffer));
|
||||||
__kmp_expand_host_name( buffer, sizeof( buffer ) );
|
KMP_STRNCPY(pos, buffer, end - pos + 1);
|
||||||
KMP_STRNCPY( pos, buffer, end - pos + 1);
|
if (*end == 0) {
|
||||||
if(*end == 0) {
|
while (*pos)
|
||||||
while ( *pos )
|
|
||||||
++pos;
|
++pos;
|
||||||
++pattern;
|
++pattern;
|
||||||
} else
|
} else
|
||||||
pos = end;
|
pos = end;
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case 'P':
|
case 'P':
|
||||||
case 'p':
|
case 'p': {
|
||||||
{
|
snp_result = KMP_SNPRINTF(pos, end - pos + 1, "%0*d", cpu_width,
|
||||||
snp_result = KMP_SNPRINTF( pos, end - pos + 1, "%0*d", cpu_width, __kmp_dflt_team_nth );
|
__kmp_dflt_team_nth);
|
||||||
if(snp_result >= 0 && snp_result <= end - pos) {
|
if (snp_result >= 0 && snp_result <= end - pos) {
|
||||||
while ( *pos )
|
while (*pos)
|
||||||
++pos;
|
++pos;
|
||||||
++pattern;
|
++pattern;
|
||||||
} else
|
} else
|
||||||
pos = end;
|
pos = end;
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case 'I':
|
case 'I':
|
||||||
case 'i':
|
case 'i': {
|
||||||
{
|
|
||||||
pid_t id = getpid();
|
pid_t id = getpid();
|
||||||
snp_result = KMP_SNPRINTF( pos, end - pos + 1, "%0*d", width, id );
|
snp_result = KMP_SNPRINTF(pos, end - pos + 1, "%0*d", width, id);
|
||||||
if(snp_result >= 0 && snp_result <= end - pos) {
|
if (snp_result >= 0 && snp_result <= end - pos) {
|
||||||
while ( *pos )
|
while (*pos)
|
||||||
++pos;
|
++pos;
|
||||||
++pattern;
|
++pattern;
|
||||||
} else
|
} else
|
||||||
pos = end;
|
pos = end;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case '%':
|
case '%': {
|
||||||
{
|
|
||||||
*pos++ = '%';
|
*pos++ = '%';
|
||||||
++pattern;
|
++pattern;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
*pos++ = '%';
|
*pos++ = '%';
|
||||||
pattern = old_pattern + 1;
|
pattern = old_pattern + 1;
|
||||||
break;
|
break;
|
||||||
|
|
@ -420,10 +401,9 @@ __kmp_expand_file_name( char *result, size_t rlen, char *pattern )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* TODO: How do we get rid of this? */
|
/* TODO: How do we get rid of this? */
|
||||||
if(*pattern != '\0')
|
if (*pattern != '\0')
|
||||||
KMP_FATAL( FileNameTooLong );
|
KMP_FATAL(FileNameTooLong);
|
||||||
}
|
}
|
||||||
|
|
||||||
*pos = '\0';
|
*pos = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,64 +21,65 @@
|
||||||
#define KMP_VERSION_BUILD 20140926
|
#define KMP_VERSION_BUILD 20140926
|
||||||
|
|
||||||
// Helper macros to convert value of macro to string literal.
|
// Helper macros to convert value of macro to string literal.
|
||||||
#define _stringer( x ) #x
|
#define _stringer(x) #x
|
||||||
#define stringer( x ) _stringer( x )
|
#define stringer(x) _stringer(x)
|
||||||
|
|
||||||
// Detect compiler.
|
// Detect compiler.
|
||||||
#if KMP_COMPILER_ICC
|
#if KMP_COMPILER_ICC
|
||||||
#if __INTEL_COMPILER == 1010
|
#if __INTEL_COMPILER == 1010
|
||||||
#define KMP_COMPILER "Intel C++ Compiler 10.1"
|
#define KMP_COMPILER "Intel C++ Compiler 10.1"
|
||||||
#elif __INTEL_COMPILER == 1100
|
#elif __INTEL_COMPILER == 1100
|
||||||
#define KMP_COMPILER "Intel C++ Compiler 11.0"
|
#define KMP_COMPILER "Intel C++ Compiler 11.0"
|
||||||
#elif __INTEL_COMPILER == 1110
|
#elif __INTEL_COMPILER == 1110
|
||||||
#define KMP_COMPILER "Intel C++ Compiler 11.1"
|
#define KMP_COMPILER "Intel C++ Compiler 11.1"
|
||||||
#elif __INTEL_COMPILER == 1200
|
#elif __INTEL_COMPILER == 1200
|
||||||
#define KMP_COMPILER "Intel C++ Compiler 12.0"
|
#define KMP_COMPILER "Intel C++ Compiler 12.0"
|
||||||
#elif __INTEL_COMPILER == 1210
|
#elif __INTEL_COMPILER == 1210
|
||||||
#define KMP_COMPILER "Intel C++ Compiler 12.1"
|
#define KMP_COMPILER "Intel C++ Compiler 12.1"
|
||||||
#elif __INTEL_COMPILER == 1300
|
#elif __INTEL_COMPILER == 1300
|
||||||
#define KMP_COMPILER "Intel C++ Compiler 13.0"
|
#define KMP_COMPILER "Intel C++ Compiler 13.0"
|
||||||
#elif __INTEL_COMPILER == 1310
|
#elif __INTEL_COMPILER == 1310
|
||||||
#define KMP_COMPILER "Intel C++ Compiler 13.1"
|
#define KMP_COMPILER "Intel C++ Compiler 13.1"
|
||||||
#elif __INTEL_COMPILER == 1400
|
#elif __INTEL_COMPILER == 1400
|
||||||
#define KMP_COMPILER "Intel C++ Compiler 14.0"
|
#define KMP_COMPILER "Intel C++ Compiler 14.0"
|
||||||
#elif __INTEL_COMPILER == 1410
|
#elif __INTEL_COMPILER == 1410
|
||||||
#define KMP_COMPILER "Intel C++ Compiler 14.1"
|
#define KMP_COMPILER "Intel C++ Compiler 14.1"
|
||||||
#elif __INTEL_COMPILER == 1500
|
#elif __INTEL_COMPILER == 1500
|
||||||
#define KMP_COMPILER "Intel C++ Compiler 15.0"
|
#define KMP_COMPILER "Intel C++ Compiler 15.0"
|
||||||
#elif __INTEL_COMPILER == 1600
|
#elif __INTEL_COMPILER == 1600
|
||||||
#define KMP_COMPILER "Intel C++ Compiler 16.0"
|
#define KMP_COMPILER "Intel C++ Compiler 16.0"
|
||||||
#elif __INTEL_COMPILER == 1700
|
#elif __INTEL_COMPILER == 1700
|
||||||
#define KMP_COMPILER "Intel C++ Compiler 17.0"
|
#define KMP_COMPILER "Intel C++ Compiler 17.0"
|
||||||
#elif __INTEL_COMPILER == 9998
|
#elif __INTEL_COMPILER == 9998
|
||||||
#define KMP_COMPILER "Intel C++ Compiler mainline"
|
#define KMP_COMPILER "Intel C++ Compiler mainline"
|
||||||
#elif __INTEL_COMPILER == 9999
|
#elif __INTEL_COMPILER == 9999
|
||||||
#define KMP_COMPILER "Intel C++ Compiler mainline"
|
#define KMP_COMPILER "Intel C++ Compiler mainline"
|
||||||
#endif
|
#endif
|
||||||
#elif KMP_COMPILER_CLANG
|
#elif KMP_COMPILER_CLANG
|
||||||
#define KMP_COMPILER "Clang " stringer( __clang_major__ ) "." stringer( __clang_minor__ )
|
#define KMP_COMPILER \
|
||||||
|
"Clang " stringer(__clang_major__) "." stringer(__clang_minor__)
|
||||||
#elif KMP_COMPILER_GCC
|
#elif KMP_COMPILER_GCC
|
||||||
#define KMP_COMPILER "GCC " stringer( __GNUC__ ) "." stringer( __GNUC_MINOR__ )
|
#define KMP_COMPILER "GCC " stringer(__GNUC__) "." stringer(__GNUC_MINOR__)
|
||||||
#elif KMP_COMPILER_MSVC
|
#elif KMP_COMPILER_MSVC
|
||||||
#define KMP_COMPILER "MSVC " stringer( _MSC_FULL_VER )
|
#define KMP_COMPILER "MSVC " stringer(_MSC_FULL_VER)
|
||||||
#endif
|
#endif
|
||||||
#ifndef KMP_COMPILER
|
#ifndef KMP_COMPILER
|
||||||
#warning "Unknown compiler"
|
#warning "Unknown compiler"
|
||||||
#define KMP_COMPILER "unknown compiler"
|
#define KMP_COMPILER "unknown compiler"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Detect librray type (perf, stub).
|
// Detect librray type (perf, stub).
|
||||||
#ifdef KMP_STUB
|
#ifdef KMP_STUB
|
||||||
#define KMP_LIB_TYPE "stub"
|
#define KMP_LIB_TYPE "stub"
|
||||||
#else
|
#else
|
||||||
#define KMP_LIB_TYPE "performance"
|
#define KMP_LIB_TYPE "performance"
|
||||||
#endif // KMP_LIB_TYPE
|
#endif // KMP_LIB_TYPE
|
||||||
|
|
||||||
// Detect link type (static, dynamic).
|
// Detect link type (static, dynamic).
|
||||||
#ifdef KMP_DYNAMIC_LIB
|
#ifdef KMP_DYNAMIC_LIB
|
||||||
#define KMP_LINK_TYPE "dynamic"
|
#define KMP_LINK_TYPE "dynamic"
|
||||||
#else
|
#else
|
||||||
#define KMP_LINK_TYPE "static"
|
#define KMP_LINK_TYPE "static"
|
||||||
#endif // KMP_LINK_TYPE
|
#endif // KMP_LINK_TYPE
|
||||||
|
|
||||||
// Finally, define strings.
|
// Finally, define strings.
|
||||||
|
|
@ -89,125 +90,116 @@ int const __kmp_version_major = KMP_VERSION_MAJOR;
|
||||||
int const __kmp_version_minor = KMP_VERSION_MINOR;
|
int const __kmp_version_minor = KMP_VERSION_MINOR;
|
||||||
int const __kmp_version_build = KMP_VERSION_BUILD;
|
int const __kmp_version_build = KMP_VERSION_BUILD;
|
||||||
int const __kmp_openmp_version =
|
int const __kmp_openmp_version =
|
||||||
#if OMP_50_ENABLED
|
#if OMP_50_ENABLED
|
||||||
201611;
|
201611;
|
||||||
#elif OMP_45_ENABLED
|
#elif OMP_45_ENABLED
|
||||||
201511;
|
201511;
|
||||||
#elif OMP_40_ENABLED
|
#elif OMP_40_ENABLED
|
||||||
201307;
|
201307;
|
||||||
#else
|
#else
|
||||||
201107;
|
201107;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Do NOT change the format of this string! Intel(R) Thread Profiler checks for a
|
/* Do NOT change the format of this string! Intel(R) Thread Profiler checks for
|
||||||
specific format some changes in the recognition routine there need to
|
a specific format some changes in the recognition routine there need to be
|
||||||
be made before this is changed.
|
made before this is changed. */
|
||||||
*/
|
char const __kmp_copyright[] = KMP_VERSION_PREFIX KMP_LIBRARY
|
||||||
char const __kmp_copyright[] =
|
" ver. " stringer(KMP_VERSION_MAJOR) "." stringer(
|
||||||
KMP_VERSION_PREFIX KMP_LIBRARY
|
KMP_VERSION_MINOR) "." stringer(KMP_VERSION_BUILD) " " KMP_COPYRIGHT;
|
||||||
" ver. " stringer( KMP_VERSION_MAJOR ) "." stringer( KMP_VERSION_MINOR )
|
|
||||||
"." stringer( KMP_VERSION_BUILD ) " "
|
|
||||||
KMP_COPYRIGHT;
|
|
||||||
|
|
||||||
char const __kmp_version_copyright[] = KMP_VERSION_PREFIX KMP_COPYRIGHT;
|
char const __kmp_version_copyright[] = KMP_VERSION_PREFIX KMP_COPYRIGHT;
|
||||||
char const __kmp_version_lib_ver[] = KMP_VERSION_PREFIX "version: " stringer( KMP_VERSION_MAJOR ) "." stringer( KMP_VERSION_MINOR ) "." stringer( KMP_VERSION_BUILD );
|
char const __kmp_version_lib_ver[] =
|
||||||
char const __kmp_version_lib_type[] = KMP_VERSION_PREFIX "library type: " KMP_LIB_TYPE;
|
KMP_VERSION_PREFIX "version: " stringer(KMP_VERSION_MAJOR) "." stringer(
|
||||||
char const __kmp_version_link_type[] = KMP_VERSION_PREFIX "link type: " KMP_LINK_TYPE;
|
KMP_VERSION_MINOR) "." stringer(KMP_VERSION_BUILD);
|
||||||
char const __kmp_version_build_time[] = KMP_VERSION_PREFIX "build time: " "no_timestamp";
|
char const __kmp_version_lib_type[] =
|
||||||
|
KMP_VERSION_PREFIX "library type: " KMP_LIB_TYPE;
|
||||||
|
char const __kmp_version_link_type[] =
|
||||||
|
KMP_VERSION_PREFIX "link type: " KMP_LINK_TYPE;
|
||||||
|
char const __kmp_version_build_time[] = KMP_VERSION_PREFIX "build time: "
|
||||||
|
"no_timestamp";
|
||||||
#if KMP_MIC2
|
#if KMP_MIC2
|
||||||
char const __kmp_version_target_env[] = KMP_VERSION_PREFIX "target environment: MIC2";
|
char const __kmp_version_target_env[] =
|
||||||
|
KMP_VERSION_PREFIX "target environment: MIC2";
|
||||||
#endif
|
#endif
|
||||||
char const __kmp_version_build_compiler[] = KMP_VERSION_PREFIX "build compiler: " KMP_COMPILER;
|
char const __kmp_version_build_compiler[] =
|
||||||
|
KMP_VERSION_PREFIX "build compiler: " KMP_COMPILER;
|
||||||
|
|
||||||
//
|
|
||||||
// Called at serial initialization time.
|
// Called at serial initialization time.
|
||||||
//
|
|
||||||
static int __kmp_version_1_printed = FALSE;
|
static int __kmp_version_1_printed = FALSE;
|
||||||
|
|
||||||
void
|
void __kmp_print_version_1(void) {
|
||||||
__kmp_print_version_1( void )
|
if (__kmp_version_1_printed) {
|
||||||
{
|
|
||||||
if ( __kmp_version_1_printed ) {
|
|
||||||
return;
|
return;
|
||||||
}; // if
|
}; // if
|
||||||
__kmp_version_1_printed = TRUE;
|
__kmp_version_1_printed = TRUE;
|
||||||
|
|
||||||
#ifndef KMP_STUB
|
#ifndef KMP_STUB
|
||||||
kmp_str_buf_t buffer;
|
kmp_str_buf_t buffer;
|
||||||
__kmp_str_buf_init( & buffer );
|
__kmp_str_buf_init(&buffer);
|
||||||
// Print version strings skipping initial magic.
|
// Print version strings skipping initial magic.
|
||||||
__kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_lib_ver[ KMP_VERSION_MAGIC_LEN ] );
|
__kmp_str_buf_print(&buffer, "%s\n",
|
||||||
__kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_lib_type[ KMP_VERSION_MAGIC_LEN ] );
|
&__kmp_version_lib_ver[KMP_VERSION_MAGIC_LEN]);
|
||||||
__kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_link_type[ KMP_VERSION_MAGIC_LEN ] );
|
__kmp_str_buf_print(&buffer, "%s\n",
|
||||||
__kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_build_time[ KMP_VERSION_MAGIC_LEN ] );
|
&__kmp_version_lib_type[KMP_VERSION_MAGIC_LEN]);
|
||||||
#if KMP_MIC
|
__kmp_str_buf_print(&buffer, "%s\n",
|
||||||
__kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_target_env[ KMP_VERSION_MAGIC_LEN ] );
|
&__kmp_version_link_type[KMP_VERSION_MAGIC_LEN]);
|
||||||
#endif
|
__kmp_str_buf_print(&buffer, "%s\n",
|
||||||
__kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_build_compiler[ KMP_VERSION_MAGIC_LEN ] );
|
&__kmp_version_build_time[KMP_VERSION_MAGIC_LEN]);
|
||||||
#if defined(KMP_GOMP_COMPAT)
|
#if KMP_MIC
|
||||||
__kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_alt_comp[ KMP_VERSION_MAGIC_LEN ] );
|
__kmp_str_buf_print(&buffer, "%s\n",
|
||||||
#endif /* defined(KMP_GOMP_COMPAT) */
|
&__kmp_version_target_env[KMP_VERSION_MAGIC_LEN]);
|
||||||
__kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_omp_api[ KMP_VERSION_MAGIC_LEN ] );
|
#endif
|
||||||
__kmp_str_buf_print( & buffer, "%sdynamic error checking: %s\n", KMP_VERSION_PREF_STR, ( __kmp_env_consistency_check ? "yes" : "no" ) );
|
__kmp_str_buf_print(&buffer, "%s\n",
|
||||||
#ifdef KMP_DEBUG
|
&__kmp_version_build_compiler[KMP_VERSION_MAGIC_LEN]);
|
||||||
for ( int i = bs_plain_barrier; i < bs_last_barrier; ++ i ) {
|
#if defined(KMP_GOMP_COMPAT)
|
||||||
__kmp_str_buf_print(
|
__kmp_str_buf_print(&buffer, "%s\n",
|
||||||
& buffer,
|
&__kmp_version_alt_comp[KMP_VERSION_MAGIC_LEN]);
|
||||||
"%s%s barrier branch bits: gather=%u, release=%u\n",
|
#endif /* defined(KMP_GOMP_COMPAT) */
|
||||||
|
__kmp_str_buf_print(&buffer, "%s\n",
|
||||||
|
&__kmp_version_omp_api[KMP_VERSION_MAGIC_LEN]);
|
||||||
|
__kmp_str_buf_print(&buffer, "%sdynamic error checking: %s\n",
|
||||||
KMP_VERSION_PREF_STR,
|
KMP_VERSION_PREF_STR,
|
||||||
__kmp_barrier_type_name[ i ],
|
(__kmp_env_consistency_check ? "yes" : "no"));
|
||||||
__kmp_barrier_gather_branch_bits[ i ],
|
#ifdef KMP_DEBUG
|
||||||
__kmp_barrier_release_branch_bits[ i ]
|
for (int i = bs_plain_barrier; i < bs_last_barrier; ++i) {
|
||||||
); // __kmp_str_buf_print
|
__kmp_str_buf_print(
|
||||||
|
&buffer, "%s%s barrier branch bits: gather=%u, release=%u\n",
|
||||||
|
KMP_VERSION_PREF_STR, __kmp_barrier_type_name[i],
|
||||||
|
__kmp_barrier_gather_branch_bits[i],
|
||||||
|
__kmp_barrier_release_branch_bits[i]); // __kmp_str_buf_print
|
||||||
}; // for i
|
}; // for i
|
||||||
for ( int i = bs_plain_barrier; i < bs_last_barrier; ++ i ) {
|
for (int i = bs_plain_barrier; i < bs_last_barrier; ++i) {
|
||||||
__kmp_str_buf_print(
|
__kmp_str_buf_print(
|
||||||
& buffer,
|
&buffer, "%s%s barrier pattern: gather=%s, release=%s\n",
|
||||||
"%s%s barrier pattern: gather=%s, release=%s\n",
|
KMP_VERSION_PREF_STR, __kmp_barrier_type_name[i],
|
||||||
KMP_VERSION_PREF_STR,
|
__kmp_barrier_pattern_name[__kmp_barrier_gather_pattern[i]],
|
||||||
__kmp_barrier_type_name[ i ],
|
__kmp_barrier_pattern_name
|
||||||
__kmp_barrier_pattern_name[ __kmp_barrier_gather_pattern[ i ] ],
|
[__kmp_barrier_release_pattern[i]]); // __kmp_str_buf_print
|
||||||
__kmp_barrier_pattern_name[ __kmp_barrier_release_pattern[ i ] ]
|
|
||||||
); // __kmp_str_buf_print
|
|
||||||
}; // for i
|
}; // for i
|
||||||
__kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_lock[ KMP_VERSION_MAGIC_LEN ] );
|
__kmp_str_buf_print(&buffer, "%s\n",
|
||||||
#endif
|
&__kmp_version_lock[KMP_VERSION_MAGIC_LEN]);
|
||||||
|
#endif
|
||||||
__kmp_str_buf_print(
|
__kmp_str_buf_print(
|
||||||
& buffer,
|
&buffer, "%sthread affinity support: %s\n", KMP_VERSION_PREF_STR,
|
||||||
"%sthread affinity support: %s\n",
|
#if KMP_AFFINITY_SUPPORTED
|
||||||
KMP_VERSION_PREF_STR,
|
(KMP_AFFINITY_CAPABLE()
|
||||||
#if KMP_AFFINITY_SUPPORTED
|
? (__kmp_affinity_type == affinity_none ? "not used" : "yes")
|
||||||
(
|
: "no")
|
||||||
KMP_AFFINITY_CAPABLE()
|
#else
|
||||||
?
|
|
||||||
(
|
|
||||||
__kmp_affinity_type == affinity_none
|
|
||||||
?
|
|
||||||
"not used"
|
|
||||||
:
|
|
||||||
"yes"
|
|
||||||
)
|
|
||||||
:
|
|
||||||
"no"
|
"no"
|
||||||
)
|
#endif
|
||||||
#else
|
|
||||||
"no"
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
__kmp_printf( "%s", buffer.str );
|
__kmp_printf("%s", buffer.str);
|
||||||
__kmp_str_buf_free( & buffer );
|
__kmp_str_buf_free(&buffer);
|
||||||
K_DIAG( 1, ( "KMP_VERSION is true\n" ) );
|
K_DIAG(1, ("KMP_VERSION is true\n"));
|
||||||
#endif // KMP_STUB
|
#endif // KMP_STUB
|
||||||
} // __kmp_print_version_1
|
} // __kmp_print_version_1
|
||||||
|
|
||||||
//
|
|
||||||
// Called at parallel initialization time.
|
// Called at parallel initialization time.
|
||||||
//
|
|
||||||
static int __kmp_version_2_printed = FALSE;
|
static int __kmp_version_2_printed = FALSE;
|
||||||
|
|
||||||
void
|
void __kmp_print_version_2(void) {
|
||||||
__kmp_print_version_2( void ) {
|
if (__kmp_version_2_printed) {
|
||||||
if ( __kmp_version_2_printed ) {
|
|
||||||
return;
|
return;
|
||||||
}; // if
|
}; // if
|
||||||
__kmp_version_2_printed = TRUE;
|
__kmp_version_2_printed = TRUE;
|
||||||
|
|
|
||||||
|
|
@ -17,20 +17,20 @@
|
||||||
#define KMP_VERSION_H
|
#define KMP_VERSION_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#ifndef KMP_VERSION_MAJOR
|
#ifndef KMP_VERSION_MAJOR
|
||||||
#error KMP_VERSION_MAJOR macro is not defined.
|
#error KMP_VERSION_MAJOR macro is not defined.
|
||||||
#endif
|
#endif
|
||||||
#define KMP_VERSION_MINOR 0
|
#define KMP_VERSION_MINOR 0
|
||||||
/*
|
/* Using "magic" prefix in all the version strings is rather convenient to get
|
||||||
Using "magic" prefix in all the version strings is rather convenient to get static version info
|
static version info from binaries by using standard utilities "strings" and
|
||||||
from binaries by using standard utilities "strings" and "grep", e. g.:
|
"grep", e. g.:
|
||||||
$ strings libomp.so | grep "@(#)"
|
$ strings libomp.so | grep "@(#)"
|
||||||
gives clean list of all version strings in the library. Leading zero helps to keep version
|
gives clean list of all version strings in the library. Leading zero helps
|
||||||
string separate from printable characters which may occurs just before version string.
|
to keep version string separate from printable characters which may occurs
|
||||||
*/
|
just before version string. */
|
||||||
#define KMP_VERSION_MAGIC_STR "\x00@(#) "
|
#define KMP_VERSION_MAGIC_STR "\x00@(#) "
|
||||||
#define KMP_VERSION_MAGIC_LEN 6 // Length of KMP_VERSION_MAGIC_STR.
|
#define KMP_VERSION_MAGIC_LEN 6 // Length of KMP_VERSION_MAGIC_STR.
|
||||||
#define KMP_VERSION_PREF_STR "Intel(R) OMP "
|
#define KMP_VERSION_PREF_STR "Intel(R) OMP "
|
||||||
|
|
@ -41,7 +41,8 @@ extern int const __kmp_version_major;
|
||||||
extern int const __kmp_version_minor;
|
extern int const __kmp_version_minor;
|
||||||
extern int const __kmp_version_build;
|
extern int const __kmp_version_build;
|
||||||
extern int const __kmp_openmp_version;
|
extern int const __kmp_openmp_version;
|
||||||
extern char const __kmp_copyright[]; // Old variable, kept for compatibility with ITC and ITP.
|
extern char const
|
||||||
|
__kmp_copyright[]; // Old variable, kept for compatibility with ITC and ITP.
|
||||||
extern char const __kmp_version_copyright[];
|
extern char const __kmp_version_copyright[];
|
||||||
extern char const __kmp_version_lib_ver[];
|
extern char const __kmp_version_lib_ver[];
|
||||||
extern char const __kmp_version_lib_type[];
|
extern char const __kmp_version_lib_type[];
|
||||||
|
|
@ -58,11 +59,11 @@ extern char const __kmp_version_ftnstdcall[];
|
||||||
extern char const __kmp_version_ftncdecl[];
|
extern char const __kmp_version_ftncdecl[];
|
||||||
extern char const __kmp_version_ftnextra[];
|
extern char const __kmp_version_ftnextra[];
|
||||||
|
|
||||||
void __kmp_print_version_1( void );
|
void __kmp_print_version_1(void);
|
||||||
void __kmp_print_version_2( void );
|
void __kmp_print_version_2(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif /* KMP_VERSION_H */
|
#endif /* KMP_VERSION_H */
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,10 @@
|
||||||
|
|
||||||
#include "kmp_wait_release.h"
|
#include "kmp_wait_release.h"
|
||||||
|
|
||||||
void __kmp_wait_64(kmp_info_t *this_thr, kmp_flag_64 *flag, int final_spin
|
void __kmp_wait_64(kmp_info_t *this_thr, kmp_flag_64 *flag,
|
||||||
USE_ITT_BUILD_ARG(void * itt_sync_obj) )
|
int final_spin USE_ITT_BUILD_ARG(void *itt_sync_obj)) {
|
||||||
{
|
__kmp_wait_template(this_thr, flag,
|
||||||
__kmp_wait_template(this_thr, flag, final_spin
|
final_spin USE_ITT_BUILD_ARG(itt_sync_obj));
|
||||||
USE_ITT_BUILD_ARG(itt_sync_obj) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void __kmp_release_64(kmp_flag_64 *flag) {
|
void __kmp_release_64(kmp_flag_64 *flag) { __kmp_release_template(flag); }
|
||||||
__kmp_release_template(flag);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@
|
||||||
@defgroup WAIT_RELEASE Wait/Release operations
|
@defgroup WAIT_RELEASE Wait/Release operations
|
||||||
|
|
||||||
The definitions and functions here implement the lowest level thread
|
The definitions and functions here implement the lowest level thread
|
||||||
synchronizations of suspending a thread and awaking it. They are used
|
synchronizations of suspending a thread and awaking it. They are used to build
|
||||||
to build higher level operations such as barriers and fork/join.
|
higher level operations such as barriers and fork/join.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -45,17 +45,18 @@ enum flag_type {
|
||||||
/*!
|
/*!
|
||||||
* Base class for wait/release volatile flag
|
* Base class for wait/release volatile flag
|
||||||
*/
|
*/
|
||||||
template <typename P>
|
template <typename P> class kmp_flag {
|
||||||
class kmp_flag {
|
volatile P
|
||||||
volatile P * loc; /**< Pointer to the flag storage that is modified by another thread */
|
*loc; /**< Pointer to the flag storage that is modified by another thread
|
||||||
|
*/
|
||||||
flag_type t; /**< "Type" of the flag in loc */
|
flag_type t; /**< "Type" of the flag in loc */
|
||||||
public:
|
public:
|
||||||
typedef P flag_t;
|
typedef P flag_t;
|
||||||
kmp_flag(volatile P *p, flag_type ft) : loc(p), t(ft) {}
|
kmp_flag(volatile P *p, flag_type ft) : loc(p), t(ft) {}
|
||||||
/*!
|
/*!
|
||||||
* @result the pointer to the actual flag
|
* @result the pointer to the actual flag
|
||||||
*/
|
*/
|
||||||
volatile P * get() { return loc; }
|
volatile P *get() { return loc; }
|
||||||
/*!
|
/*!
|
||||||
* @param new_loc in set loc to point at new_loc
|
* @param new_loc in set loc to point at new_loc
|
||||||
*/
|
*/
|
||||||
|
|
@ -79,18 +80,20 @@ class kmp_flag {
|
||||||
bool is_sleeping();
|
bool is_sleeping();
|
||||||
bool is_any_sleeping();
|
bool is_any_sleeping();
|
||||||
bool is_sleeping_val(P old_loc);
|
bool is_sleeping_val(P old_loc);
|
||||||
int execute_tasks(kmp_info_t *this_thr, kmp_int32 gtid, int final_spin, int *thread_finished
|
int execute_tasks(kmp_info_t *this_thr, kmp_int32 gtid, int final_spin,
|
||||||
USE_ITT_BUILD_ARG(void * itt_sync_obj), kmp_int32 is_constrained);
|
int *thread_finished
|
||||||
|
USE_ITT_BUILD_ARG(void * itt_sync_obj), kmp_int32
|
||||||
|
is_constrained);
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Spin wait loop that first does pause, then yield, then sleep. A thread that calls __kmp_wait_*
|
/* Spin wait loop that first does pause, then yield, then sleep. A thread that
|
||||||
must make certain that another thread calls __kmp_release to wake it back up to prevent deadlocks! */
|
calls __kmp_wait_* must make certain that another thread calls __kmp_release
|
||||||
|
to wake it back up to prevent deadlocks! */
|
||||||
template <class C>
|
template <class C>
|
||||||
static inline void
|
static inline void
|
||||||
__kmp_wait_template(kmp_info_t *this_thr, C *flag, int final_spin
|
__kmp_wait_template(kmp_info_t *this_thr, C *flag,
|
||||||
USE_ITT_BUILD_ARG(void * itt_sync_obj) )
|
int final_spin USE_ITT_BUILD_ARG(void *itt_sync_obj)) {
|
||||||
{
|
|
||||||
// NOTE: We may not belong to a team at this point.
|
// NOTE: We may not belong to a team at this point.
|
||||||
volatile typename C::flag_t *spin = flag->get();
|
volatile typename C::flag_t *spin = flag->get();
|
||||||
kmp_uint32 spins;
|
kmp_uint32 spins;
|
||||||
|
|
@ -98,7 +101,7 @@ __kmp_wait_template(kmp_info_t *this_thr, C *flag, int final_spin
|
||||||
int th_gtid;
|
int th_gtid;
|
||||||
int tasks_completed = FALSE;
|
int tasks_completed = FALSE;
|
||||||
int oversubscribed;
|
int oversubscribed;
|
||||||
#if ! KMP_USE_MONITOR
|
#if !KMP_USE_MONITOR
|
||||||
kmp_uint64 poll_count;
|
kmp_uint64 poll_count;
|
||||||
kmp_uint64 hibernate_goal;
|
kmp_uint64 hibernate_goal;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -109,15 +112,15 @@ __kmp_wait_template(kmp_info_t *this_thr, C *flag, int final_spin
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
th_gtid = this_thr->th.th_info.ds.ds_gtid;
|
th_gtid = this_thr->th.th_info.ds.ds_gtid;
|
||||||
KA_TRACE(20, ("__kmp_wait_sleep: T#%d waiting for flag(%p)\n", th_gtid, flag));
|
KA_TRACE(20,
|
||||||
|
("__kmp_wait_sleep: T#%d waiting for flag(%p)\n", th_gtid, flag));
|
||||||
#if KMP_STATS_ENABLED
|
#if KMP_STATS_ENABLED
|
||||||
stats_state_e thread_state = KMP_GET_THREAD_STATE();
|
stats_state_e thread_state = KMP_GET_THREAD_STATE();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OMPT_SUPPORT && OMPT_BLAME
|
#if OMPT_SUPPORT && OMPT_BLAME
|
||||||
ompt_state_t ompt_state = this_thr->th.ompt_thread_info.state;
|
ompt_state_t ompt_state = this_thr->th.ompt_thread_info.state;
|
||||||
if (ompt_enabled &&
|
if (ompt_enabled && ompt_state != ompt_state_undefined) {
|
||||||
ompt_state != ompt_state_undefined) {
|
|
||||||
if (ompt_state == ompt_state_idle) {
|
if (ompt_state == ompt_state_idle) {
|
||||||
if (ompt_callbacks.ompt_callback(ompt_event_idle_begin)) {
|
if (ompt_callbacks.ompt_callback(ompt_event_idle_begin)) {
|
||||||
ompt_callbacks.ompt_callback(ompt_event_idle_begin)(th_gtid + 1);
|
ompt_callbacks.ompt_callback(ompt_event_idle_begin)(th_gtid + 1);
|
||||||
|
|
@ -127,10 +130,11 @@ __kmp_wait_template(kmp_info_t *this_thr, C *flag, int final_spin
|
||||||
ompt_state == ompt_state_wait_barrier_implicit ||
|
ompt_state == ompt_state_wait_barrier_implicit ||
|
||||||
ompt_state == ompt_state_wait_barrier_explicit);
|
ompt_state == ompt_state_wait_barrier_explicit);
|
||||||
|
|
||||||
ompt_lw_taskteam_t* team = this_thr->th.th_team->t.ompt_serialized_team_info;
|
ompt_lw_taskteam_t *team =
|
||||||
|
this_thr->th.th_team->t.ompt_serialized_team_info;
|
||||||
ompt_parallel_id_t pId;
|
ompt_parallel_id_t pId;
|
||||||
ompt_task_id_t tId;
|
ompt_task_id_t tId;
|
||||||
if (team){
|
if (team) {
|
||||||
pId = team->ompt_team_info.parallel_id;
|
pId = team->ompt_team_info.parallel_id;
|
||||||
tId = team->ompt_task_info.task_id;
|
tId = team->ompt_task_info.task_id;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -147,11 +151,12 @@ __kmp_wait_template(kmp_info_t *this_thr, C *flag, int final_spin
|
||||||
|
|
||||||
if (__kmp_dflt_blocktime != KMP_MAX_BLOCKTIME) {
|
if (__kmp_dflt_blocktime != KMP_MAX_BLOCKTIME) {
|
||||||
#if KMP_USE_MONITOR
|
#if KMP_USE_MONITOR
|
||||||
// The worker threads cannot rely on the team struct existing at this point.
|
// The worker threads cannot rely on the team struct existing at this point.
|
||||||
// Use the bt values cached in the thread struct instead.
|
// Use the bt values cached in the thread struct instead.
|
||||||
#ifdef KMP_ADJUST_BLOCKTIME
|
#ifdef KMP_ADJUST_BLOCKTIME
|
||||||
if (__kmp_zero_bt && !this_thr->th.th_team_bt_set)
|
if (__kmp_zero_bt && !this_thr->th.th_team_bt_set)
|
||||||
// Force immediate suspend if not set by user and more threads than available procs
|
// Force immediate suspend if not set by user and more threads than
|
||||||
|
// available procs
|
||||||
hibernate = 0;
|
hibernate = 0;
|
||||||
else
|
else
|
||||||
hibernate = this_thr->th.th_team_bt_intervals;
|
hibernate = this_thr->th.th_team_bt_intervals;
|
||||||
|
|
@ -159,9 +164,10 @@ __kmp_wait_template(kmp_info_t *this_thr, C *flag, int final_spin
|
||||||
hibernate = this_thr->th.th_team_bt_intervals;
|
hibernate = this_thr->th.th_team_bt_intervals;
|
||||||
#endif /* KMP_ADJUST_BLOCKTIME */
|
#endif /* KMP_ADJUST_BLOCKTIME */
|
||||||
|
|
||||||
/* If the blocktime is nonzero, we want to make sure that we spin wait for the entirety
|
/* If the blocktime is nonzero, we want to make sure that we spin wait for
|
||||||
of the specified #intervals, plus up to one interval more. This increment make
|
the entirety of the specified #intervals, plus up to one interval more.
|
||||||
certain that this thread doesn't go to sleep too soon. */
|
This increment make certain that this thread doesn't go to sleep too
|
||||||
|
soon. */
|
||||||
if (hibernate != 0)
|
if (hibernate != 0)
|
||||||
hibernate++;
|
hibernate++;
|
||||||
|
|
||||||
|
|
@ -182,24 +188,25 @@ __kmp_wait_template(kmp_info_t *this_thr, C *flag, int final_spin
|
||||||
// Main wait spin loop
|
// Main wait spin loop
|
||||||
while (flag->notdone_check()) {
|
while (flag->notdone_check()) {
|
||||||
int in_pool;
|
int in_pool;
|
||||||
kmp_task_team_t * task_team = NULL;
|
kmp_task_team_t *task_team = NULL;
|
||||||
if (__kmp_tasking_mode != tskm_immediate_exec) {
|
if (__kmp_tasking_mode != tskm_immediate_exec) {
|
||||||
task_team = this_thr->th.th_task_team;
|
task_team = this_thr->th.th_task_team;
|
||||||
/* If the thread's task team pointer is NULL, it means one of 3 things:
|
/* If the thread's task team pointer is NULL, it means one of 3 things:
|
||||||
1) A newly-created thread is first being released by __kmp_fork_barrier(), and
|
1) A newly-created thread is first being released by
|
||||||
its task team has not been set up yet.
|
__kmp_fork_barrier(), and its task team has not been set up yet.
|
||||||
2) All tasks have been executed to completion.
|
2) All tasks have been executed to completion.
|
||||||
3) Tasking is off for this region. This could be because we are in a serialized region
|
3) Tasking is off for this region. This could be because we are in a
|
||||||
(perhaps the outer one), or else tasking was manually disabled (KMP_TASKING=0). */
|
serialized region (perhaps the outer one), or else tasking was manually
|
||||||
|
disabled (KMP_TASKING=0). */
|
||||||
if (task_team != NULL) {
|
if (task_team != NULL) {
|
||||||
if (TCR_SYNC_4(task_team->tt.tt_active)) {
|
if (TCR_SYNC_4(task_team->tt.tt_active)) {
|
||||||
if (KMP_TASKING_ENABLED(task_team))
|
if (KMP_TASKING_ENABLED(task_team))
|
||||||
flag->execute_tasks(this_thr, th_gtid, final_spin, &tasks_completed
|
flag->execute_tasks(
|
||||||
USE_ITT_BUILD_ARG(itt_sync_obj), 0);
|
this_thr, th_gtid, final_spin,
|
||||||
|
&tasks_completed USE_ITT_BUILD_ARG(itt_sync_obj), 0);
|
||||||
else
|
else
|
||||||
this_thr->th.th_reap_state = KMP_SAFE_TO_REAP;
|
this_thr->th.th_reap_state = KMP_SAFE_TO_REAP;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
KMP_DEBUG_ASSERT(!KMP_MASTER_TID(this_thr->th.th_info.ds.ds_tid));
|
KMP_DEBUG_ASSERT(!KMP_MASTER_TID(this_thr->th.th_info.ds.ds_tid));
|
||||||
this_thr->th.th_task_team = NULL;
|
this_thr->th.th_task_team = NULL;
|
||||||
this_thr->th.th_reap_state = KMP_SAFE_TO_REAP;
|
this_thr->th.th_reap_state = KMP_SAFE_TO_REAP;
|
||||||
|
|
@ -216,13 +223,13 @@ __kmp_wait_template(kmp_info_t *this_thr, C *flag, int final_spin
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are oversubscribed, or have waited a bit (and KMP_LIBRARY=throughput), then yield
|
// If we are oversubscribed, or have waited a bit (and
|
||||||
|
// KMP_LIBRARY=throughput), then yield
|
||||||
KMP_YIELD(oversubscribed);
|
KMP_YIELD(oversubscribed);
|
||||||
// TODO: Should it be number of cores instead of thread contexts? Like:
|
// TODO: Should it be number of cores instead of thread contexts? Like:
|
||||||
// KMP_YIELD(TCR_4(__kmp_nth) > __kmp_ncores);
|
// KMP_YIELD(TCR_4(__kmp_nth) > __kmp_ncores);
|
||||||
// Need performance improvement data to make the change...
|
// Need performance improvement data to make the change...
|
||||||
KMP_YIELD_SPIN(spins);
|
KMP_YIELD_SPIN(spins);
|
||||||
|
|
||||||
// Check if this thread was transferred from a team
|
// Check if this thread was transferred from a team
|
||||||
// to the thread pool (or vice-versa) while spinning.
|
// to the thread pool (or vice-versa) while spinning.
|
||||||
in_pool = !!TCR_4(this_thr->th.th_in_pool);
|
in_pool = !!TCR_4(this_thr->th.th_in_pool);
|
||||||
|
|
@ -231,13 +238,14 @@ __kmp_wait_template(kmp_info_t *this_thr, C *flag, int final_spin
|
||||||
KMP_TEST_THEN_INC32((kmp_int32 *)&__kmp_thread_pool_active_nth);
|
KMP_TEST_THEN_INC32((kmp_int32 *)&__kmp_thread_pool_active_nth);
|
||||||
this_thr->th.th_active_in_pool = TRUE;
|
this_thr->th.th_active_in_pool = TRUE;
|
||||||
/* Here, we cannot assert that:
|
/* Here, we cannot assert that:
|
||||||
KMP_DEBUG_ASSERT(TCR_4(__kmp_thread_pool_active_nth) <= __kmp_thread_pool_nth);
|
KMP_DEBUG_ASSERT(TCR_4(__kmp_thread_pool_active_nth) <=
|
||||||
__kmp_thread_pool_nth is inc/dec'd by the master thread while the fork/join
|
__kmp_thread_pool_nth);
|
||||||
lock is held, whereas __kmp_thread_pool_active_nth is inc/dec'd asynchronously
|
__kmp_thread_pool_nth is inc/dec'd by the master thread while the
|
||||||
by the workers. The two can get out of sync for brief periods of time. */
|
fork/join lock is held, whereas __kmp_thread_pool_active_nth is
|
||||||
}
|
inc/dec'd asynchronously by the workers. The two can get out of sync
|
||||||
else { // Recently transferred from pool to team
|
for brief periods of time. */
|
||||||
KMP_TEST_THEN_DEC32((kmp_int32 *) &__kmp_thread_pool_active_nth);
|
} else { // Recently transferred from pool to team
|
||||||
|
KMP_TEST_THEN_DEC32((kmp_int32 *)&__kmp_thread_pool_active_nth);
|
||||||
KMP_DEBUG_ASSERT(TCR_4(__kmp_thread_pool_active_nth) >= 0);
|
KMP_DEBUG_ASSERT(TCR_4(__kmp_thread_pool_active_nth) >= 0);
|
||||||
this_thr->th.th_active_in_pool = FALSE;
|
this_thr->th.th_active_in_pool = FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -246,7 +254,8 @@ __kmp_wait_template(kmp_info_t *this_thr, C *flag, int final_spin
|
||||||
#if KMP_STATS_ENABLED
|
#if KMP_STATS_ENABLED
|
||||||
// Check if thread has been signalled to idle state
|
// Check if thread has been signalled to idle state
|
||||||
// This indicates that the logical "join-barrier" has finished
|
// This indicates that the logical "join-barrier" has finished
|
||||||
if (this_thr->th.th_stats->isIdle() && KMP_GET_THREAD_STATE() == FORK_JOIN_BARRIER) {
|
if (this_thr->th.th_stats->isIdle() &&
|
||||||
|
KMP_GET_THREAD_STATE() == FORK_JOIN_BARRIER) {
|
||||||
KMP_SET_THREAD_STATE(IDLE);
|
KMP_SET_THREAD_STATE(IDLE);
|
||||||
KMP_PUSH_PARTITIONED_TIMER(OMP_idle);
|
KMP_PUSH_PARTITIONED_TIMER(OMP_idle);
|
||||||
}
|
}
|
||||||
|
|
@ -270,24 +279,21 @@ __kmp_wait_template(kmp_info_t *this_thr, C *flag, int final_spin
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
KF_TRACE(50, ("__kmp_wait_sleep: T#%d suspend time reached\n", th_gtid));
|
KF_TRACE(50, ("__kmp_wait_sleep: T#%d suspend time reached\n", th_gtid));
|
||||||
|
|
||||||
flag->suspend(th_gtid);
|
flag->suspend(th_gtid);
|
||||||
|
|
||||||
if (TCR_4(__kmp_global.g.g_done)) {
|
if (TCR_4(__kmp_global.g.g_done)) {
|
||||||
if (__kmp_global.g.g_abort)
|
if (__kmp_global.g.g_abort)
|
||||||
__kmp_abort_thread();
|
__kmp_abort_thread();
|
||||||
break;
|
break;
|
||||||
}
|
} else if (__kmp_tasking_mode != tskm_immediate_exec &&
|
||||||
else if (__kmp_tasking_mode != tskm_immediate_exec
|
this_thr->th.th_reap_state == KMP_SAFE_TO_REAP) {
|
||||||
&& this_thr->th.th_reap_state == KMP_SAFE_TO_REAP) {
|
|
||||||
this_thr->th.th_reap_state = KMP_NOT_SAFE_TO_REAP;
|
this_thr->th.th_reap_state = KMP_NOT_SAFE_TO_REAP;
|
||||||
}
|
}
|
||||||
// TODO: If thread is done with work and times out, disband/free
|
// TODO: If thread is done with work and times out, disband/free
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OMPT_SUPPORT && OMPT_BLAME
|
#if OMPT_SUPPORT && OMPT_BLAME
|
||||||
if (ompt_enabled &&
|
if (ompt_enabled && ompt_state != ompt_state_undefined) {
|
||||||
ompt_state != ompt_state_undefined) {
|
|
||||||
if (ompt_state == ompt_state_idle) {
|
if (ompt_state == ompt_state_idle) {
|
||||||
if (ompt_callbacks.ompt_callback(ompt_event_idle_end)) {
|
if (ompt_callbacks.ompt_callback(ompt_event_idle_end)) {
|
||||||
ompt_callbacks.ompt_callback(ompt_event_idle_end)(th_gtid + 1);
|
ompt_callbacks.ompt_callback(ompt_event_idle_end)(th_gtid + 1);
|
||||||
|
|
@ -297,10 +303,11 @@ __kmp_wait_template(kmp_info_t *this_thr, C *flag, int final_spin
|
||||||
ompt_state == ompt_state_wait_barrier_implicit ||
|
ompt_state == ompt_state_wait_barrier_implicit ||
|
||||||
ompt_state == ompt_state_wait_barrier_explicit);
|
ompt_state == ompt_state_wait_barrier_explicit);
|
||||||
|
|
||||||
ompt_lw_taskteam_t* team = this_thr->th.th_team->t.ompt_serialized_team_info;
|
ompt_lw_taskteam_t *team =
|
||||||
|
this_thr->th.th_team->t.ompt_serialized_team_info;
|
||||||
ompt_parallel_id_t pId;
|
ompt_parallel_id_t pId;
|
||||||
ompt_task_id_t tId;
|
ompt_task_id_t tId;
|
||||||
if (team){
|
if (team) {
|
||||||
pId = team->ompt_team_info.parallel_id;
|
pId = team->ompt_team_info.parallel_id;
|
||||||
tId = team->ompt_task_info.task_id;
|
tId = team->ompt_task_info.task_id;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -323,13 +330,11 @@ __kmp_wait_template(kmp_info_t *this_thr, C *flag, int final_spin
|
||||||
KMP_FSYNC_SPIN_ACQUIRED(spin);
|
KMP_FSYNC_SPIN_ACQUIRED(spin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release any threads specified as waiting on the flag by releasing the flag and resume the waiting thread
|
/* Release any threads specified as waiting on the flag by releasing the flag
|
||||||
if indicated by the sleep bit(s). A thread that calls __kmp_wait_template must call this function to wake
|
and resume the waiting thread if indicated by the sleep bit(s). A thread that
|
||||||
up the potentially sleeping thread and prevent deadlocks! */
|
calls __kmp_wait_template must call this function to wake up the potentially
|
||||||
template <class C>
|
sleeping thread and prevent deadlocks! */
|
||||||
static inline void
|
template <class C> static inline void __kmp_release_template(C *flag) {
|
||||||
__kmp_release_template(C *flag)
|
|
||||||
{
|
|
||||||
#ifdef KMP_DEBUG
|
#ifdef KMP_DEBUG
|
||||||
int gtid = TCR_4(__kmp_init_gtid) ? __kmp_get_gtid() : -1;
|
int gtid = TCR_4(__kmp_init_gtid) ? __kmp_get_gtid() : -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -339,17 +344,21 @@ __kmp_release_template(C *flag)
|
||||||
|
|
||||||
flag->internal_release();
|
flag->internal_release();
|
||||||
|
|
||||||
KF_TRACE(100, ("__kmp_release: T#%d set new spin=%d\n", gtid, flag->get(), *(flag->get())));
|
KF_TRACE(100, ("__kmp_release: T#%d set new spin=%d\n", gtid, flag->get(),
|
||||||
|
*(flag->get())));
|
||||||
|
|
||||||
if (__kmp_dflt_blocktime != KMP_MAX_BLOCKTIME) {
|
if (__kmp_dflt_blocktime != KMP_MAX_BLOCKTIME) {
|
||||||
// Only need to check sleep stuff if infinite block time not set
|
// Only need to check sleep stuff if infinite block time not set.
|
||||||
if (flag->is_any_sleeping()) { // Are *any* of the threads that wait on this flag sleeping?
|
// Are *any* threads waiting on flag sleeping?
|
||||||
for (unsigned int i=0; i<flag->get_num_waiters(); ++i) {
|
if (flag->is_any_sleeping()) {
|
||||||
kmp_info_t * waiter = flag->get_waiter(i); // if a sleeping waiter exists at i, sets current_waiter to i inside the flag
|
for (unsigned int i = 0; i < flag->get_num_waiters(); ++i) {
|
||||||
|
// if sleeping waiter exists at i, sets current_waiter to i inside flag
|
||||||
|
kmp_info_t *waiter = flag->get_waiter(i);
|
||||||
if (waiter) {
|
if (waiter) {
|
||||||
int wait_gtid = waiter->th.th_info.ds.ds_gtid;
|
int wait_gtid = waiter->th.th_info.ds.ds_gtid;
|
||||||
// Wake up thread if needed
|
// Wake up thread if needed
|
||||||
KF_TRACE(50, ("__kmp_release: T#%d waking up thread T#%d since sleep flag(%p) set\n",
|
KF_TRACE(50, ("__kmp_release: T#%d waking up thread T#%d since sleep "
|
||||||
|
"flag(%p) set\n",
|
||||||
gtid, wait_gtid, flag->get()));
|
gtid, wait_gtid, flag->get()));
|
||||||
flag->resume(wait_gtid); // unsets flag's current_waiter when done
|
flag->resume(wait_gtid); // unsets flag's current_waiter when done
|
||||||
}
|
}
|
||||||
|
|
@ -358,47 +367,62 @@ __kmp_release_template(C *flag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FlagType>
|
template <typename FlagType> struct flag_traits {};
|
||||||
struct flag_traits {};
|
|
||||||
|
|
||||||
template <>
|
template <> struct flag_traits<kmp_uint32> {
|
||||||
struct flag_traits<kmp_uint32> {
|
|
||||||
typedef kmp_uint32 flag_t;
|
typedef kmp_uint32 flag_t;
|
||||||
static const flag_type t = flag32;
|
static const flag_type t = flag32;
|
||||||
static inline flag_t tcr(flag_t f) { return TCR_4(f); }
|
static inline flag_t tcr(flag_t f) { return TCR_4(f); }
|
||||||
static inline flag_t test_then_add4(volatile flag_t *f) { return KMP_TEST_THEN_ADD4_32((volatile kmp_int32 *)f); }
|
static inline flag_t test_then_add4(volatile flag_t *f) {
|
||||||
static inline flag_t test_then_or(volatile flag_t *f, flag_t v) { return KMP_TEST_THEN_OR32((volatile kmp_int32 *)f, v); }
|
return KMP_TEST_THEN_ADD4_32((volatile kmp_int32 *)f);
|
||||||
static inline flag_t test_then_and(volatile flag_t *f, flag_t v) { return KMP_TEST_THEN_AND32((volatile kmp_int32 *)f, v); }
|
}
|
||||||
|
static inline flag_t test_then_or(volatile flag_t *f, flag_t v) {
|
||||||
|
return KMP_TEST_THEN_OR32((volatile kmp_int32 *)f, v);
|
||||||
|
}
|
||||||
|
static inline flag_t test_then_and(volatile flag_t *f, flag_t v) {
|
||||||
|
return KMP_TEST_THEN_AND32((volatile kmp_int32 *)f, v);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <> struct flag_traits<kmp_uint64> {
|
||||||
struct flag_traits<kmp_uint64> {
|
|
||||||
typedef kmp_uint64 flag_t;
|
typedef kmp_uint64 flag_t;
|
||||||
static const flag_type t = flag64;
|
static const flag_type t = flag64;
|
||||||
static inline flag_t tcr(flag_t f) { return TCR_8(f); }
|
static inline flag_t tcr(flag_t f) { return TCR_8(f); }
|
||||||
static inline flag_t test_then_add4(volatile flag_t *f) { return KMP_TEST_THEN_ADD4_64((volatile kmp_int64 *)f); }
|
static inline flag_t test_then_add4(volatile flag_t *f) {
|
||||||
static inline flag_t test_then_or(volatile flag_t *f, flag_t v) { return KMP_TEST_THEN_OR64((volatile kmp_int64 *)f, v); }
|
return KMP_TEST_THEN_ADD4_64((volatile kmp_int64 *)f);
|
||||||
static inline flag_t test_then_and(volatile flag_t *f, flag_t v) { return KMP_TEST_THEN_AND64((volatile kmp_int64 *)f, v); }
|
}
|
||||||
|
static inline flag_t test_then_or(volatile flag_t *f, flag_t v) {
|
||||||
|
return KMP_TEST_THEN_OR64((volatile kmp_int64 *)f, v);
|
||||||
|
}
|
||||||
|
static inline flag_t test_then_and(volatile flag_t *f, flag_t v) {
|
||||||
|
return KMP_TEST_THEN_AND64((volatile kmp_int64 *)f, v);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename FlagType>
|
template <typename FlagType> class kmp_basic_flag : public kmp_flag<FlagType> {
|
||||||
class kmp_basic_flag : public kmp_flag<FlagType> {
|
|
||||||
typedef flag_traits<FlagType> traits_type;
|
typedef flag_traits<FlagType> traits_type;
|
||||||
FlagType checker; /**< Value to compare flag to to check if flag has been released. */
|
FlagType checker; /**< Value to compare flag to to check if flag has been
|
||||||
kmp_info_t * waiting_threads[1]; /**< Array of threads sleeping on this thread. */
|
released. */
|
||||||
kmp_uint32 num_waiting_threads; /**< Number of threads sleeping on this thread. */
|
kmp_info_t
|
||||||
public:
|
*waiting_threads[1]; /**< Array of threads sleeping on this thread. */
|
||||||
kmp_basic_flag(volatile FlagType *p) : kmp_flag<FlagType>(p, traits_type::t), num_waiting_threads(0) {}
|
kmp_uint32
|
||||||
kmp_basic_flag(volatile FlagType *p, kmp_info_t *thr) : kmp_flag<FlagType>(p, traits_type::t), num_waiting_threads(1) {
|
num_waiting_threads; /**< Number of threads sleeping on this thread. */
|
||||||
|
public:
|
||||||
|
kmp_basic_flag(volatile FlagType *p)
|
||||||
|
: kmp_flag<FlagType>(p, traits_type::t), num_waiting_threads(0) {}
|
||||||
|
kmp_basic_flag(volatile FlagType *p, kmp_info_t *thr)
|
||||||
|
: kmp_flag<FlagType>(p, traits_type::t), num_waiting_threads(1) {
|
||||||
waiting_threads[0] = thr;
|
waiting_threads[0] = thr;
|
||||||
}
|
}
|
||||||
kmp_basic_flag(volatile FlagType *p, FlagType c) : kmp_flag<FlagType>(p, traits_type::t), checker(c), num_waiting_threads(0) {}
|
kmp_basic_flag(volatile FlagType *p, FlagType c)
|
||||||
|
: kmp_flag<FlagType>(p, traits_type::t), checker(c),
|
||||||
|
num_waiting_threads(0) {}
|
||||||
/*!
|
/*!
|
||||||
* param i in index into waiting_threads
|
* param i in index into waiting_threads
|
||||||
* @result the thread that is waiting at index i
|
* @result the thread that is waiting at index i
|
||||||
*/
|
*/
|
||||||
kmp_info_t * get_waiter(kmp_uint32 i) {
|
kmp_info_t *get_waiter(kmp_uint32 i) {
|
||||||
KMP_DEBUG_ASSERT(i<num_waiting_threads);
|
KMP_DEBUG_ASSERT(i < num_waiting_threads);
|
||||||
return waiting_threads[i];
|
return waiting_threads[i];
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -436,27 +460,33 @@ class kmp_basic_flag : public kmp_flag<FlagType> {
|
||||||
* Trigger all waiting threads to run by modifying flag to release state.
|
* Trigger all waiting threads to run by modifying flag to release state.
|
||||||
*/
|
*/
|
||||||
void internal_release() {
|
void internal_release() {
|
||||||
(void) traits_type::test_then_add4((volatile FlagType *)this->get());
|
(void)traits_type::test_then_add4((volatile FlagType *)this->get());
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
* @result Actual flag value before sleep bit(s) set.
|
* @result Actual flag value before sleep bit(s) set.
|
||||||
* Notes that there is at least one thread sleeping on the flag by setting sleep bit(s).
|
* Notes that there is at least one thread sleeping on the flag by setting
|
||||||
|
* sleep bit(s).
|
||||||
*/
|
*/
|
||||||
FlagType set_sleeping() {
|
FlagType set_sleeping() {
|
||||||
return traits_type::test_then_or((volatile FlagType *)this->get(), KMP_BARRIER_SLEEP_STATE);
|
return traits_type::test_then_or((volatile FlagType *)this->get(),
|
||||||
|
KMP_BARRIER_SLEEP_STATE);
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
* @result Actual flag value before sleep bit(s) cleared.
|
* @result Actual flag value before sleep bit(s) cleared.
|
||||||
* Notes that there are no longer threads sleeping on the flag by clearing sleep bit(s).
|
* Notes that there are no longer threads sleeping on the flag by clearing
|
||||||
|
* sleep bit(s).
|
||||||
*/
|
*/
|
||||||
FlagType unset_sleeping() {
|
FlagType unset_sleeping() {
|
||||||
return traits_type::test_then_and((volatile FlagType *)this->get(), ~KMP_BARRIER_SLEEP_STATE);
|
return traits_type::test_then_and((volatile FlagType *)this->get(),
|
||||||
|
~KMP_BARRIER_SLEEP_STATE);
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
* @param old_loc in old value of flag
|
* @param old_loc in old value of flag
|
||||||
* Test whether there are threads sleeping on the flag's old value in old_loc.
|
* Test whether there are threads sleeping on the flag's old value in old_loc.
|
||||||
*/
|
*/
|
||||||
bool is_sleeping_val(FlagType old_loc) { return old_loc & KMP_BARRIER_SLEEP_STATE; }
|
bool is_sleeping_val(FlagType old_loc) {
|
||||||
|
return old_loc & KMP_BARRIER_SLEEP_STATE;
|
||||||
|
}
|
||||||
/*!
|
/*!
|
||||||
* Test whether there are threads sleeping on the flag.
|
* Test whether there are threads sleeping on the flag.
|
||||||
*/
|
*/
|
||||||
|
|
@ -467,42 +497,50 @@ class kmp_basic_flag : public kmp_flag<FlagType> {
|
||||||
};
|
};
|
||||||
|
|
||||||
class kmp_flag_32 : public kmp_basic_flag<kmp_uint32> {
|
class kmp_flag_32 : public kmp_basic_flag<kmp_uint32> {
|
||||||
public:
|
public:
|
||||||
kmp_flag_32(volatile kmp_uint32 *p) : kmp_basic_flag<kmp_uint32>(p) {}
|
kmp_flag_32(volatile kmp_uint32 *p) : kmp_basic_flag<kmp_uint32>(p) {}
|
||||||
kmp_flag_32(volatile kmp_uint32 *p, kmp_info_t *thr) : kmp_basic_flag<kmp_uint32>(p, thr) {}
|
kmp_flag_32(volatile kmp_uint32 *p, kmp_info_t *thr)
|
||||||
kmp_flag_32(volatile kmp_uint32 *p, kmp_uint32 c) : kmp_basic_flag<kmp_uint32>(p, c) {}
|
: kmp_basic_flag<kmp_uint32>(p, thr) {}
|
||||||
|
kmp_flag_32(volatile kmp_uint32 *p, kmp_uint32 c)
|
||||||
|
: kmp_basic_flag<kmp_uint32>(p, c) {}
|
||||||
void suspend(int th_gtid) { __kmp_suspend_32(th_gtid, this); }
|
void suspend(int th_gtid) { __kmp_suspend_32(th_gtid, this); }
|
||||||
void resume(int th_gtid) { __kmp_resume_32(th_gtid, this); }
|
void resume(int th_gtid) { __kmp_resume_32(th_gtid, this); }
|
||||||
int execute_tasks(kmp_info_t *this_thr, kmp_int32 gtid, int final_spin, int *thread_finished
|
int execute_tasks(kmp_info_t *this_thr, kmp_int32 gtid, int final_spin,
|
||||||
USE_ITT_BUILD_ARG(void * itt_sync_obj), kmp_int32 is_constrained) {
|
int *thread_finished USE_ITT_BUILD_ARG(void *itt_sync_obj),
|
||||||
return __kmp_execute_tasks_32(this_thr, gtid, this, final_spin, thread_finished
|
kmp_int32 is_constrained) {
|
||||||
USE_ITT_BUILD_ARG(itt_sync_obj), is_constrained);
|
return __kmp_execute_tasks_32(
|
||||||
|
this_thr, gtid, this, final_spin,
|
||||||
|
thread_finished USE_ITT_BUILD_ARG(itt_sync_obj), is_constrained);
|
||||||
}
|
}
|
||||||
void wait(kmp_info_t *this_thr, int final_spin
|
void wait(kmp_info_t *this_thr,
|
||||||
USE_ITT_BUILD_ARG(void * itt_sync_obj)) {
|
int final_spin USE_ITT_BUILD_ARG(void *itt_sync_obj)) {
|
||||||
__kmp_wait_template(this_thr, this, final_spin
|
__kmp_wait_template(this_thr, this,
|
||||||
USE_ITT_BUILD_ARG(itt_sync_obj));
|
final_spin USE_ITT_BUILD_ARG(itt_sync_obj));
|
||||||
}
|
}
|
||||||
void release() { __kmp_release_template(this); }
|
void release() { __kmp_release_template(this); }
|
||||||
flag_type get_ptr_type() { return flag32; }
|
flag_type get_ptr_type() { return flag32; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class kmp_flag_64 : public kmp_basic_flag<kmp_uint64> {
|
class kmp_flag_64 : public kmp_basic_flag<kmp_uint64> {
|
||||||
public:
|
public:
|
||||||
kmp_flag_64(volatile kmp_uint64 *p) : kmp_basic_flag<kmp_uint64>(p) {}
|
kmp_flag_64(volatile kmp_uint64 *p) : kmp_basic_flag<kmp_uint64>(p) {}
|
||||||
kmp_flag_64(volatile kmp_uint64 *p, kmp_info_t *thr) : kmp_basic_flag<kmp_uint64>(p, thr) {}
|
kmp_flag_64(volatile kmp_uint64 *p, kmp_info_t *thr)
|
||||||
kmp_flag_64(volatile kmp_uint64 *p, kmp_uint64 c) : kmp_basic_flag<kmp_uint64>(p, c) {}
|
: kmp_basic_flag<kmp_uint64>(p, thr) {}
|
||||||
|
kmp_flag_64(volatile kmp_uint64 *p, kmp_uint64 c)
|
||||||
|
: kmp_basic_flag<kmp_uint64>(p, c) {}
|
||||||
void suspend(int th_gtid) { __kmp_suspend_64(th_gtid, this); }
|
void suspend(int th_gtid) { __kmp_suspend_64(th_gtid, this); }
|
||||||
void resume(int th_gtid) { __kmp_resume_64(th_gtid, this); }
|
void resume(int th_gtid) { __kmp_resume_64(th_gtid, this); }
|
||||||
int execute_tasks(kmp_info_t *this_thr, kmp_int32 gtid, int final_spin, int *thread_finished
|
int execute_tasks(kmp_info_t *this_thr, kmp_int32 gtid, int final_spin,
|
||||||
USE_ITT_BUILD_ARG(void * itt_sync_obj), kmp_int32 is_constrained) {
|
int *thread_finished USE_ITT_BUILD_ARG(void *itt_sync_obj),
|
||||||
return __kmp_execute_tasks_64(this_thr, gtid, this, final_spin, thread_finished
|
kmp_int32 is_constrained) {
|
||||||
USE_ITT_BUILD_ARG(itt_sync_obj), is_constrained);
|
return __kmp_execute_tasks_64(
|
||||||
|
this_thr, gtid, this, final_spin,
|
||||||
|
thread_finished USE_ITT_BUILD_ARG(itt_sync_obj), is_constrained);
|
||||||
}
|
}
|
||||||
void wait(kmp_info_t *this_thr, int final_spin
|
void wait(kmp_info_t *this_thr,
|
||||||
USE_ITT_BUILD_ARG(void * itt_sync_obj)) {
|
int final_spin USE_ITT_BUILD_ARG(void *itt_sync_obj)) {
|
||||||
__kmp_wait_template(this_thr, this, final_spin
|
__kmp_wait_template(this_thr, this,
|
||||||
USE_ITT_BUILD_ARG(itt_sync_obj));
|
final_spin USE_ITT_BUILD_ARG(itt_sync_obj));
|
||||||
}
|
}
|
||||||
void release() { __kmp_release_template(this); }
|
void release() { __kmp_release_template(this); }
|
||||||
flag_type get_ptr_type() { return flag64; }
|
flag_type get_ptr_type() { return flag64; }
|
||||||
|
|
@ -511,35 +549,47 @@ class kmp_flag_64 : public kmp_basic_flag<kmp_uint64> {
|
||||||
// Hierarchical 64-bit on-core barrier instantiation
|
// Hierarchical 64-bit on-core barrier instantiation
|
||||||
class kmp_flag_oncore : public kmp_flag<kmp_uint64> {
|
class kmp_flag_oncore : public kmp_flag<kmp_uint64> {
|
||||||
kmp_uint64 checker;
|
kmp_uint64 checker;
|
||||||
kmp_info_t * waiting_threads[1];
|
kmp_info_t *waiting_threads[1];
|
||||||
kmp_uint32 num_waiting_threads;
|
kmp_uint32 num_waiting_threads;
|
||||||
kmp_uint32 offset; /**< Portion of flag that is of interest for an operation. */
|
kmp_uint32
|
||||||
|
offset; /**< Portion of flag that is of interest for an operation. */
|
||||||
bool flag_switch; /**< Indicates a switch in flag location. */
|
bool flag_switch; /**< Indicates a switch in flag location. */
|
||||||
enum barrier_type bt; /**< Barrier type. */
|
enum barrier_type bt; /**< Barrier type. */
|
||||||
kmp_info_t * this_thr; /**< Thread that may be redirected to different flag location. */
|
kmp_info_t *this_thr; /**< Thread that may be redirected to different flag
|
||||||
|
location. */
|
||||||
#if USE_ITT_BUILD
|
#if USE_ITT_BUILD
|
||||||
void *itt_sync_obj; /**< ITT object that must be passed to new flag location. */
|
void *
|
||||||
|
itt_sync_obj; /**< ITT object that must be passed to new flag location. */
|
||||||
#endif
|
#endif
|
||||||
unsigned char& byteref(volatile kmp_uint64* loc, size_t offset) { return ((unsigned char *)loc)[offset]; }
|
unsigned char &byteref(volatile kmp_uint64 *loc, size_t offset) {
|
||||||
|
return ((unsigned char *)loc)[offset];
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
kmp_flag_oncore(volatile kmp_uint64 *p)
|
kmp_flag_oncore(volatile kmp_uint64 *p)
|
||||||
: kmp_flag<kmp_uint64>(p, flag_oncore), num_waiting_threads(0), flag_switch(false) {}
|
: kmp_flag<kmp_uint64>(p, flag_oncore), num_waiting_threads(0),
|
||||||
|
flag_switch(false) {}
|
||||||
kmp_flag_oncore(volatile kmp_uint64 *p, kmp_uint32 idx)
|
kmp_flag_oncore(volatile kmp_uint64 *p, kmp_uint32 idx)
|
||||||
: kmp_flag<kmp_uint64>(p, flag_oncore), num_waiting_threads(0), offset(idx), flag_switch(false) {}
|
: kmp_flag<kmp_uint64>(p, flag_oncore), num_waiting_threads(0),
|
||||||
kmp_flag_oncore(volatile kmp_uint64 *p, kmp_uint64 c, kmp_uint32 idx, enum barrier_type bar_t,
|
offset(idx), flag_switch(false) {}
|
||||||
kmp_info_t * thr
|
kmp_flag_oncore(volatile kmp_uint64 *p, kmp_uint64 c, kmp_uint32 idx,
|
||||||
|
enum barrier_type bar_t, kmp_info_t *thr
|
||||||
#if USE_ITT_BUILD
|
#if USE_ITT_BUILD
|
||||||
, void *itt
|
,
|
||||||
|
void *itt
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
: kmp_flag<kmp_uint64>(p, flag_oncore), checker(c), num_waiting_threads(0), offset(idx),
|
: kmp_flag<kmp_uint64>(p, flag_oncore), checker(c),
|
||||||
flag_switch(false), bt(bar_t), this_thr(thr)
|
num_waiting_threads(0), offset(idx), flag_switch(false), bt(bar_t),
|
||||||
|
this_thr(thr)
|
||||||
#if USE_ITT_BUILD
|
#if USE_ITT_BUILD
|
||||||
, itt_sync_obj(itt)
|
,
|
||||||
|
itt_sync_obj(itt)
|
||||||
#endif
|
#endif
|
||||||
{}
|
{
|
||||||
kmp_info_t * get_waiter(kmp_uint32 i) {
|
}
|
||||||
KMP_DEBUG_ASSERT(i<num_waiting_threads);
|
kmp_info_t *get_waiter(kmp_uint32 i) {
|
||||||
|
KMP_DEBUG_ASSERT(i < num_waiting_threads);
|
||||||
return waiting_threads[i];
|
return waiting_threads[i];
|
||||||
}
|
}
|
||||||
kmp_uint32 get_num_waiters() { return num_waiting_threads; }
|
kmp_uint32 get_num_waiters() { return num_waiting_threads; }
|
||||||
|
|
@ -547,20 +597,24 @@ public:
|
||||||
waiting_threads[0] = thr;
|
waiting_threads[0] = thr;
|
||||||
num_waiting_threads = 1;
|
num_waiting_threads = 1;
|
||||||
}
|
}
|
||||||
bool done_check_val(kmp_uint64 old_loc) { return byteref(&old_loc,offset) == checker; }
|
bool done_check_val(kmp_uint64 old_loc) {
|
||||||
|
return byteref(&old_loc, offset) == checker;
|
||||||
|
}
|
||||||
bool done_check() { return done_check_val(*get()); }
|
bool done_check() { return done_check_val(*get()); }
|
||||||
bool notdone_check() {
|
bool notdone_check() {
|
||||||
// Calculate flag_switch
|
// Calculate flag_switch
|
||||||
if (this_thr->th.th_bar[bt].bb.wait_flag == KMP_BARRIER_SWITCH_TO_OWN_FLAG)
|
if (this_thr->th.th_bar[bt].bb.wait_flag == KMP_BARRIER_SWITCH_TO_OWN_FLAG)
|
||||||
flag_switch = true;
|
flag_switch = true;
|
||||||
if (byteref(get(),offset) != 1 && !flag_switch)
|
if (byteref(get(), offset) != 1 && !flag_switch)
|
||||||
return true;
|
return true;
|
||||||
else if (flag_switch) {
|
else if (flag_switch) {
|
||||||
this_thr->th.th_bar[bt].bb.wait_flag = KMP_BARRIER_SWITCHING;
|
this_thr->th.th_bar[bt].bb.wait_flag = KMP_BARRIER_SWITCHING;
|
||||||
kmp_flag_64 flag(&this_thr->th.th_bar[bt].bb.b_go, (kmp_uint64)KMP_BARRIER_STATE_BUMP);
|
kmp_flag_64 flag(&this_thr->th.th_bar[bt].bb.b_go,
|
||||||
|
(kmp_uint64)KMP_BARRIER_STATE_BUMP);
|
||||||
__kmp_wait_64(this_thr, &flag, TRUE
|
__kmp_wait_64(this_thr, &flag, TRUE
|
||||||
#if USE_ITT_BUILD
|
#if USE_ITT_BUILD
|
||||||
, itt_sync_obj
|
,
|
||||||
|
itt_sync_obj
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -568,49 +622,61 @@ public:
|
||||||
}
|
}
|
||||||
void internal_release() {
|
void internal_release() {
|
||||||
if (__kmp_dflt_blocktime == KMP_MAX_BLOCKTIME) {
|
if (__kmp_dflt_blocktime == KMP_MAX_BLOCKTIME) {
|
||||||
byteref(get(),offset) = 1;
|
byteref(get(), offset) = 1;
|
||||||
}
|
} else {
|
||||||
else {
|
kmp_uint64 mask = 0;
|
||||||
kmp_uint64 mask=0;
|
byteref(&mask, offset) = 1;
|
||||||
byteref(&mask,offset) = 1;
|
(void)KMP_TEST_THEN_OR64((volatile kmp_int64 *)get(), mask);
|
||||||
(void) KMP_TEST_THEN_OR64((volatile kmp_int64 *)get(), mask);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
kmp_uint64 set_sleeping() {
|
kmp_uint64 set_sleeping() {
|
||||||
return KMP_TEST_THEN_OR64((kmp_int64 volatile *)get(), KMP_BARRIER_SLEEP_STATE);
|
return KMP_TEST_THEN_OR64((kmp_int64 volatile *)get(),
|
||||||
|
KMP_BARRIER_SLEEP_STATE);
|
||||||
}
|
}
|
||||||
kmp_uint64 unset_sleeping() {
|
kmp_uint64 unset_sleeping() {
|
||||||
return KMP_TEST_THEN_AND64((kmp_int64 volatile *)get(), ~KMP_BARRIER_SLEEP_STATE);
|
return KMP_TEST_THEN_AND64((kmp_int64 volatile *)get(),
|
||||||
|
~KMP_BARRIER_SLEEP_STATE);
|
||||||
|
}
|
||||||
|
bool is_sleeping_val(kmp_uint64 old_loc) {
|
||||||
|
return old_loc & KMP_BARRIER_SLEEP_STATE;
|
||||||
}
|
}
|
||||||
bool is_sleeping_val(kmp_uint64 old_loc) { return old_loc & KMP_BARRIER_SLEEP_STATE; }
|
|
||||||
bool is_sleeping() { return is_sleeping_val(*get()); }
|
bool is_sleeping() { return is_sleeping_val(*get()); }
|
||||||
bool is_any_sleeping() { return is_sleeping_val(*get()); }
|
bool is_any_sleeping() { return is_sleeping_val(*get()); }
|
||||||
void wait(kmp_info_t *this_thr, int final_spin) {
|
void wait(kmp_info_t *this_thr, int final_spin) {
|
||||||
__kmp_wait_template<kmp_flag_oncore>(this_thr, this, final_spin
|
__kmp_wait_template<kmp_flag_oncore>(
|
||||||
USE_ITT_BUILD_ARG(itt_sync_obj));
|
this_thr, this, final_spin USE_ITT_BUILD_ARG(itt_sync_obj));
|
||||||
}
|
}
|
||||||
void release() { __kmp_release_template(this); }
|
void release() { __kmp_release_template(this); }
|
||||||
void suspend(int th_gtid) { __kmp_suspend_oncore(th_gtid, this); }
|
void suspend(int th_gtid) { __kmp_suspend_oncore(th_gtid, this); }
|
||||||
void resume(int th_gtid) { __kmp_resume_oncore(th_gtid, this); }
|
void resume(int th_gtid) { __kmp_resume_oncore(th_gtid, this); }
|
||||||
int execute_tasks(kmp_info_t *this_thr, kmp_int32 gtid, int final_spin, int *thread_finished
|
int execute_tasks(kmp_info_t *this_thr, kmp_int32 gtid, int final_spin,
|
||||||
USE_ITT_BUILD_ARG(void * itt_sync_obj), kmp_int32 is_constrained) {
|
int *thread_finished USE_ITT_BUILD_ARG(void *itt_sync_obj),
|
||||||
return __kmp_execute_tasks_oncore(this_thr, gtid, this, final_spin, thread_finished
|
kmp_int32 is_constrained) {
|
||||||
USE_ITT_BUILD_ARG(itt_sync_obj), is_constrained);
|
return __kmp_execute_tasks_oncore(
|
||||||
|
this_thr, gtid, this, final_spin,
|
||||||
|
thread_finished USE_ITT_BUILD_ARG(itt_sync_obj), is_constrained);
|
||||||
}
|
}
|
||||||
kmp_uint8 *get_stolen() { return NULL; }
|
kmp_uint8 *get_stolen() { return NULL; }
|
||||||
enum barrier_type get_bt() { return bt; }
|
enum barrier_type get_bt() { return bt; }
|
||||||
flag_type get_ptr_type() { return flag_oncore; }
|
flag_type get_ptr_type() { return flag_oncore; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used to wake up threads, volatile void* flag is usually the th_sleep_loc associated
|
// Used to wake up threads, volatile void* flag is usually the th_sleep_loc
|
||||||
// with int gtid.
|
// associated with int gtid.
|
||||||
static inline void __kmp_null_resume_wrapper(int gtid, volatile void *flag) {
|
static inline void __kmp_null_resume_wrapper(int gtid, volatile void *flag) {
|
||||||
if (!flag) return;
|
if (!flag)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (((kmp_flag_64 *)flag)->get_type()) {
|
switch (((kmp_flag_64 *)flag)->get_type()) {
|
||||||
case flag32: __kmp_resume_32(gtid, NULL); break;
|
case flag32:
|
||||||
case flag64: __kmp_resume_64(gtid, NULL); break;
|
__kmp_resume_32(gtid, NULL);
|
||||||
case flag_oncore: __kmp_resume_oncore(gtid, NULL); break;
|
break;
|
||||||
|
case flag64:
|
||||||
|
__kmp_resume_64(gtid, NULL);
|
||||||
|
break;
|
||||||
|
case flag_oncore:
|
||||||
|
__kmp_resume_oncore(gtid, NULL);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,40 +18,43 @@
|
||||||
|
|
||||||
#if KMP_OS_UNIX
|
#if KMP_OS_UNIX
|
||||||
|
|
||||||
// On Unix-like systems (Linux* OS and OS X*) getpid() is declared in standard headers.
|
// On Unix-like systems (Linux* OS and OS X*) getpid() is declared in standard
|
||||||
#include <sys/types.h>
|
// headers.
|
||||||
#include <unistd.h>
|
#include <sys/syscall.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/types.h>
|
||||||
#if KMP_OS_DARWIN
|
#include <unistd.h>
|
||||||
//OS X
|
#if KMP_OS_DARWIN
|
||||||
#define __kmp_gettid() syscall(SYS_thread_selfid)
|
// OS X
|
||||||
#elif defined(SYS_gettid)
|
#define __kmp_gettid() syscall(SYS_thread_selfid)
|
||||||
// Hopefully other Unix systems define SYS_gettid syscall for getting os thread id
|
#elif defined(SYS_gettid)
|
||||||
#define __kmp_gettid() syscall(SYS_gettid)
|
// Hopefully other Unix systems define SYS_gettid syscall for getting os thread
|
||||||
#else
|
// id
|
||||||
#warning No gettid found, use getpid instead
|
#define __kmp_gettid() syscall(SYS_gettid)
|
||||||
#define __kmp_gettid() getpid()
|
#else
|
||||||
#endif
|
#warning No gettid found, use getpid instead
|
||||||
|
#define __kmp_gettid() getpid()
|
||||||
|
#endif
|
||||||
|
|
||||||
#elif KMP_OS_WINDOWS
|
#elif KMP_OS_WINDOWS
|
||||||
|
|
||||||
// On Windows* OS _getpid() returns int (not pid_t) and is declared in "process.h".
|
// On Windows* OS _getpid() returns int (not pid_t) and is declared in
|
||||||
#include <process.h>
|
// "process.h".
|
||||||
// Let us simulate Unix.
|
#include <process.h>
|
||||||
typedef int pid_t;
|
// Let us simulate Unix.
|
||||||
#define getpid _getpid
|
typedef int pid_t;
|
||||||
#define __kmp_gettid() GetCurrentThreadId()
|
#define getpid _getpid
|
||||||
|
#define __kmp_gettid() GetCurrentThreadId()
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#error Unknown or unsupported OS.
|
#error Unknown or unsupported OS.
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/* TODO: All the libomp source code uses pid_t type for storing the result of
|
||||||
TODO: All the libomp source code uses pid_t type for storing the result of getpid(), it is good.
|
getpid(), it is good. But often it printed as "%d", that is not good, because
|
||||||
But often it printed as "%d", that is not good, because it ignores pid_t definition (may pid_t
|
it ignores pid_t definition (may pid_t be longer that int?). It seems all pid
|
||||||
be longer that int?). It seems all pid prints should be rewritten as
|
prints should be rewritten as:
|
||||||
|
|
||||||
printf( "%" KMP_UINT64_SPEC, (kmp_uint64) pid );
|
printf( "%" KMP_UINT64_SPEC, (kmp_uint64) pid );
|
||||||
|
|
||||||
|
|
@ -59,9 +62,8 @@
|
||||||
|
|
||||||
printf( "%" KMP_UINT32_SPEC, (kmp_uint32) pid );
|
printf( "%" KMP_UINT32_SPEC, (kmp_uint32) pid );
|
||||||
|
|
||||||
(kmp_uint32, kmp_uint64, KMP_UINT64_SPEC, and KMP_UNIT32_SPEC are defined in "kmp_os.h".)
|
(kmp_uint32, kmp_uint64, KMP_UINT64_SPEC, and KMP_UNIT32_SPEC are defined in
|
||||||
|
"kmp_os.h".) */
|
||||||
*/
|
|
||||||
|
|
||||||
#endif // KMP_WRAPPER_GETPID_H
|
#endif // KMP_WRAPPER_GETPID_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,20 +17,17 @@
|
||||||
#ifndef KMP_WRAPPER_MALLOC_H
|
#ifndef KMP_WRAPPER_MALLOC_H
|
||||||
#define KMP_WRAPPER_MALLOC_H
|
#define KMP_WRAPPER_MALLOC_H
|
||||||
|
|
||||||
/*
|
/* This header serves for 3 purposes:
|
||||||
This header serves for 3 purposes:
|
|
||||||
|
|
||||||
1. Declaring standard memory allocation rourines in OS-independent way.
|
1. Declaring standard memory allocation rourines in OS-independent way.
|
||||||
2. Passing source location info through memory allocation wrappers.
|
2. Passing source location info through memory allocation wrappers.
|
||||||
3. Enabling native memory debugging capabilities.
|
3. Enabling native memory debugging capabilities.
|
||||||
|
|
||||||
|
|
||||||
1. Declaring standard memory allocation rourines in OS-independent way.
|
1. Declaring standard memory allocation rourines in OS-independent way.
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
On Linux* OS, alloca() function is declared in <alloca.h> header, while on
|
||||||
On Linux* OS, alloca() function is declared in <alloca.h> header, while on Windows* OS there is no
|
Windows* OS there is no <alloca.h> header, function _alloca() (note
|
||||||
<alloca.h> header, function _alloca() (note underscore!) is declared in <malloc.h>. This header
|
underscore!) is declared in <malloc.h>. This header eliminates these
|
||||||
eliminates these differences, so client code incluiding "kmp_wrapper_malloc.h" can rely on
|
differences, so client code incluiding "kmp_wrapper_malloc.h" can rely on
|
||||||
following routines:
|
following routines:
|
||||||
|
|
||||||
malloc
|
malloc
|
||||||
|
|
@ -39,40 +36,38 @@
|
||||||
free
|
free
|
||||||
alloca
|
alloca
|
||||||
|
|
||||||
in OS-independent way. It also enables memory tracking capabilities in debug build. (Currently
|
in OS-independent way. It also enables memory tracking capabilities in debug
|
||||||
it is available only on Windows* OS.)
|
build. (Currently it is available only on Windows* OS.)
|
||||||
|
|
||||||
|
|
||||||
2. Passing source location info through memory allocation wrappers.
|
2. Passing source location info through memory allocation wrappers.
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
|
Some tools may help debugging memory errors, for example, report memory
|
||||||
Some tools may help debugging memory errors, for example, report memory leaks. However, memory
|
leaks. However, memory allocation wrappers may hinder source location.
|
||||||
allocation wrappers may hinder source location.
|
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
void * aligned_malloc( int size ) {
|
void * aligned_malloc( int size ) {
|
||||||
void * ptr = malloc( size ); // All the memory leaks will be reported at this line.
|
void * ptr = malloc( size ); // All the memory leaks will be reported at
|
||||||
|
// this line.
|
||||||
// some adjustments...
|
// some adjustments...
|
||||||
return ptr;
|
return ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
ptr = aligned_malloc( size ); // Memory leak will *not* be detected here. :-(
|
ptr = aligned_malloc( size ); // Memory leak will *not* be detected here. :-(
|
||||||
|
|
||||||
To overcome the problem, information about original source location should be passed through all
|
To overcome the problem, information about original source location should
|
||||||
the memory allocation wrappers, for example:
|
be passed through all the memory allocation wrappers, for example:
|
||||||
|
|
||||||
void * aligned_malloc( int size, char const * file, int line ) {
|
void * aligned_malloc( int size, char const * file, int line ) {
|
||||||
void * ptr = _malloc_dbg( size, file, line );
|
void * ptr = _malloc_dbg( size, file, line );
|
||||||
// some adjustments...
|
// some adjustments...
|
||||||
return ptr;
|
return ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
void * ptr = aligned_malloc( size, __FILE__, __LINE__ );
|
void * ptr = aligned_malloc( size, __FILE__, __LINE__ );
|
||||||
|
|
||||||
This is a good idea for debug, but passing additional arguments impacts performance. Disabling
|
This is a good idea for debug, but passing additional arguments impacts
|
||||||
extra arguments in release version of the software introduces too many conditional compilation,
|
performance. Disabling extra arguments in release version of the software
|
||||||
which makes code unreadable. This header defines few macros and functions facilitating it:
|
introduces too many conditional compilation, which makes code unreadable.
|
||||||
|
This header defines few macros and functions facilitating it:
|
||||||
|
|
||||||
void * _aligned_malloc( int size KMP_SRC_LOC_DECL ) {
|
void * _aligned_malloc( int size KMP_SRC_LOC_DECL ) {
|
||||||
void * ptr = malloc_src_loc( size KMP_SRC_LOC_PARM );
|
void * ptr = malloc_src_loc( size KMP_SRC_LOC_PARM );
|
||||||
|
|
@ -82,17 +77,15 @@
|
||||||
#define aligned_malloc( size ) _aligned_malloc( (size) KMP_SRC_LOC_CURR )
|
#define aligned_malloc( size ) _aligned_malloc( (size) KMP_SRC_LOC_CURR )
|
||||||
// Use macro instead of direct call to function.
|
// Use macro instead of direct call to function.
|
||||||
|
|
||||||
void * ptr = aligned_malloc( size ); // Bingo! Memory leak will be reported at this line.
|
void * ptr = aligned_malloc( size ); // Bingo! Memory leak will be
|
||||||
|
// reported at this line.
|
||||||
|
|
||||||
3. Enabling native memory debugging capabilities.
|
3. Enabling native memory debugging capabilities.
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
Some platforms may offer memory debugging capabilities. For example, debug
|
||||||
Some platforms may offer memory debugging capabilities. For example, debug version of Microsoft
|
version of Microsoft RTL tracks all memory allocations and can report memory
|
||||||
RTL tracks all memory allocations and can report memory leaks. This header enables this, and
|
leaks. This header enables this, and makes report more useful (see "Passing
|
||||||
makes report more useful (see "Passing source location info through memory allocation
|
source location info through memory allocation wrappers").
|
||||||
wrappers").
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
@ -101,102 +94,101 @@
|
||||||
|
|
||||||
// Include alloca() declaration.
|
// Include alloca() declaration.
|
||||||
#if KMP_OS_WINDOWS
|
#if KMP_OS_WINDOWS
|
||||||
#include <malloc.h> // Windows* OS: _alloca() declared in "malloc.h".
|
#include <malloc.h> // Windows* OS: _alloca() declared in "malloc.h".
|
||||||
#define alloca _alloca // Allow to use alloca() with no underscore.
|
#define alloca _alloca // Allow to use alloca() with no underscore.
|
||||||
#elif KMP_OS_FREEBSD || KMP_OS_NETBSD
|
#elif KMP_OS_FREEBSD || KMP_OS_NETBSD
|
||||||
// Declared in "stdlib.h".
|
// Declared in "stdlib.h".
|
||||||
#elif KMP_OS_UNIX
|
#elif KMP_OS_UNIX
|
||||||
#include <alloca.h> // Linux* OS and OS X*: alloc() declared in "alloca".
|
#include <alloca.h> // Linux* OS and OS X*: alloc() declared in "alloca".
|
||||||
#else
|
#else
|
||||||
#error Unknown or unsupported OS.
|
#error Unknown or unsupported OS.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/* KMP_SRC_LOC_DECL -- Declaring source location paramemters, to be used in
|
||||||
KMP_SRC_LOC_DECL -- Declaring source location paramemters, to be used in function declaration.
|
function declaration.
|
||||||
KMP_SRC_LOC_PARM -- Source location paramemters, to be used to pass parameters to underlying
|
KMP_SRC_LOC_PARM -- Source location paramemters, to be used to pass
|
||||||
levels.
|
parameters to underlying levels.
|
||||||
KMP_SRC_LOC_CURR -- Source location arguments describing current location, to be used at
|
KMP_SRC_LOC_CURR -- Source location arguments describing current location,
|
||||||
top-level.
|
to be used at top-level.
|
||||||
|
|
||||||
Typical usage:
|
Typical usage:
|
||||||
|
|
||||||
void * _aligned_malloc( int size KMP_SRC_LOC_DECL ) {
|
void * _aligned_malloc( int size KMP_SRC_LOC_DECL ) {
|
||||||
// Note: Comma is missed before KMP_SRC_LOC_DECL.
|
// Note: Comma is missed before KMP_SRC_LOC_DECL.
|
||||||
KE_TRACE( 25, ( "called from %s:%d\n", KMP_SRC_LOC_PARM ) );
|
KE_TRACE( 25, ( "called from %s:%d\n", KMP_SRC_LOC_PARM ) );
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
#define aligned_malloc( size ) _aligned_malloc( (size) KMP_SRC_LOC_CURR )
|
#define aligned_malloc( size ) _aligned_malloc( (size) KMP_SRC_LOC_CURR )
|
||||||
// Use macro instead of direct call to function -- macro passes info about current
|
// Use macro instead of direct call to function -- macro passes info
|
||||||
// source location to the func.
|
// about current source location to the func.
|
||||||
*/
|
*/
|
||||||
#if KMP_DEBUG
|
#if KMP_DEBUG
|
||||||
#define KMP_SRC_LOC_DECL , char const * _file_, int _line_
|
#define KMP_SRC_LOC_DECL , char const *_file_, int _line_
|
||||||
#define KMP_SRC_LOC_PARM , _file_, _line_
|
#define KMP_SRC_LOC_PARM , _file_, _line_
|
||||||
#define KMP_SRC_LOC_CURR , __FILE__, __LINE__
|
#define KMP_SRC_LOC_CURR , __FILE__, __LINE__
|
||||||
#else
|
#else
|
||||||
#define KMP_SRC_LOC_DECL
|
#define KMP_SRC_LOC_DECL
|
||||||
#define KMP_SRC_LOC_PARM
|
#define KMP_SRC_LOC_PARM
|
||||||
#define KMP_SRC_LOC_CURR
|
#define KMP_SRC_LOC_CURR
|
||||||
#endif // KMP_DEBUG
|
#endif // KMP_DEBUG
|
||||||
|
|
||||||
/*
|
/* malloc_src_loc() and free_src_loc() are pseudo-functions (really macros)
|
||||||
malloc_src_loc() and free_src_loc() are pseudo-functions (really macros) with accepts extra
|
with accepts extra arguments (source location info) in debug mode. They
|
||||||
arguments (source location info) in debug mode. They should be used in place of malloc() and
|
should be used in place of malloc() and free(), this allows enabling native
|
||||||
free(), this allows enabling native memory debugging capabilities (if any).
|
memory debugging capabilities (if any).
|
||||||
|
|
||||||
Typical usage:
|
Typical usage:
|
||||||
|
|
||||||
ptr = malloc_src_loc( size KMP_SRC_LOC_PARM );
|
ptr = malloc_src_loc( size KMP_SRC_LOC_PARM );
|
||||||
// Inside memory allocation wrapper, or
|
// Inside memory allocation wrapper, or
|
||||||
ptr = malloc_src_loc( size KMP_SRC_LOC_CURR );
|
ptr = malloc_src_loc( size KMP_SRC_LOC_CURR );
|
||||||
// Outside of memory allocation wrapper.
|
// Outside of memory allocation wrapper.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#define malloc_src_loc( args ) _malloc_src_loc( args )
|
#define malloc_src_loc(args) _malloc_src_loc(args)
|
||||||
#define free_src_loc( args ) _free_src_loc( args )
|
#define free_src_loc(args) _free_src_loc(args)
|
||||||
/*
|
/* Depending on build mode (debug or release), malloc_src_loc is declared with
|
||||||
Depending on build mode (debug or release), malloc_src_loc is declared with 1 or 3
|
1 or 3 parameters, but calls to malloc_src_loc() are always the same:
|
||||||
parameters, but calls to malloc_src_loc() are always the same:
|
|
||||||
|
|
||||||
... malloc_src_loc( size KMP_SRC_LOC_PARM ); // or KMP_SRC_LOC_CURR
|
... malloc_src_loc( size KMP_SRC_LOC_PARM ); // or KMP_SRC_LOC_CURR
|
||||||
|
|
||||||
Compiler issues warning/error "too few arguments in macro invocation". Declaring two
|
Compiler issues warning/error "too few arguments in macro invocation".
|
||||||
macroses, malloc_src_loc() and _malloc_src_loc() overcomes the problem.
|
Declaring two macros, malloc_src_loc() and _malloc_src_loc(), overcomes the
|
||||||
*/
|
problem. */
|
||||||
|
|
||||||
#if KMP_DEBUG
|
#if KMP_DEBUG
|
||||||
|
|
||||||
#if KMP_OS_WINDOWS && _DEBUG
|
#if KMP_OS_WINDOWS && _DEBUG
|
||||||
// KMP_DEBUG != _DEBUG. MS debug RTL is available only if _DEBUG is defined.
|
// KMP_DEBUG != _DEBUG. MS debug RTL is available only if _DEBUG is defined.
|
||||||
|
|
||||||
// Windows* OS has native memory debugging capabilities. Enable them.
|
// Windows* OS has native memory debugging capabilities. Enable them.
|
||||||
|
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
|
|
||||||
#define KMP_MEM_BLOCK _CLIENT_BLOCK
|
#define KMP_MEM_BLOCK _CLIENT_BLOCK
|
||||||
#define malloc( size ) _malloc_dbg( (size), KMP_MEM_BLOCK, __FILE__, __LINE__ )
|
#define malloc(size) _malloc_dbg((size), KMP_MEM_BLOCK, __FILE__, __LINE__)
|
||||||
#define calloc( num, size ) _calloc_dbg( (num), (size), KMP_MEM_BLOCK, __FILE__, __LINE__ )
|
#define calloc(num, size) \
|
||||||
#define realloc( ptr, size ) _realloc_dbg( (ptr), (size), KMP_MEM_BLOCK, __FILE__, __LINE__ )
|
_calloc_dbg((num), (size), KMP_MEM_BLOCK, __FILE__, __LINE__)
|
||||||
#define free( ptr ) _free_dbg( (ptr), KMP_MEM_BLOCK )
|
#define realloc(ptr, size) \
|
||||||
|
_realloc_dbg((ptr), (size), KMP_MEM_BLOCK, __FILE__, __LINE__)
|
||||||
|
#define free(ptr) _free_dbg((ptr), KMP_MEM_BLOCK)
|
||||||
|
|
||||||
#define _malloc_src_loc( size, file, line ) _malloc_dbg( (size), KMP_MEM_BLOCK, (file), (line) )
|
#define _malloc_src_loc(size, file, line) \
|
||||||
#define _free_src_loc( ptr, file, line ) _free_dbg( (ptr), KMP_MEM_BLOCK )
|
_malloc_dbg((size), KMP_MEM_BLOCK, (file), (line))
|
||||||
|
#define _free_src_loc(ptr, file, line) _free_dbg((ptr), KMP_MEM_BLOCK)
|
||||||
#else
|
|
||||||
|
|
||||||
// Linux* OS, OS X*, or non-debug Windows* OS.
|
|
||||||
|
|
||||||
#define _malloc_src_loc( size, file, line ) malloc( (size) )
|
|
||||||
#define _free_src_loc( ptr, file, line ) free( (ptr) )
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// In release build malloc_src_loc() and free_src_loc() do not have extra parameters.
|
// Linux* OS, OS X*, or non-debug Windows* OS.
|
||||||
#define _malloc_src_loc( size ) malloc( (size) )
|
|
||||||
#define _free_src_loc( ptr ) free( (ptr) )
|
#define _malloc_src_loc(size, file, line) malloc((size))
|
||||||
|
#define _free_src_loc(ptr, file, line) free((ptr))
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
// In release build malloc_src_loc() and free_src_loc() do not have extra
|
||||||
|
// parameters.
|
||||||
|
#define _malloc_src_loc(size) malloc((size))
|
||||||
|
#define _free_src_loc(ptr) free((ptr))
|
||||||
|
|
||||||
#endif // KMP_DEBUG
|
#endif // KMP_DEBUG
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,9 @@
|
||||||
* and the level of their implementation by a runtime system.
|
* and the level of their implementation by a runtime system.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#define _ompt_tokenpaste_helper(x,y) x ## y
|
#define _ompt_tokenpaste_helper(x, y) x##y
|
||||||
#define _ompt_tokenpaste(x,y) _ompt_tokenpaste_helper(x,y)
|
#define _ompt_tokenpaste(x, y) _ompt_tokenpaste_helper(x, y)
|
||||||
#define ompt_event_implementation_status(e) _ompt_tokenpaste(e,_implemented)
|
#define ompt_event_implementation_status(e) _ompt_tokenpaste(e, _implemented)
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
| Specify whether an event may occur or not, and whether event callbacks
|
| Specify whether an event may occur or not, and whether event callbacks
|
||||||
|
|
@ -57,7 +56,6 @@
|
||||||
|
|
||||||
#define ompt_event_runtime_shutdown_implemented ompt_event_MAY_ALWAYS
|
#define ompt_event_runtime_shutdown_implemented ompt_event_MAY_ALWAYS
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
| Optional Events (blame shifting)
|
| Optional Events (blame shifting)
|
||||||
+--------------------------------------------------------------------------*/
|
+--------------------------------------------------------------------------*/
|
||||||
|
|
@ -75,12 +73,12 @@
|
||||||
#define ompt_event_wait_taskgroup_end_implemented ompt_event_UNIMPLEMENTED
|
#define ompt_event_wait_taskgroup_end_implemented ompt_event_UNIMPLEMENTED
|
||||||
|
|
||||||
#define ompt_event_release_lock_implemented ompt_event_MAY_ALWAYS_BLAME
|
#define ompt_event_release_lock_implemented ompt_event_MAY_ALWAYS_BLAME
|
||||||
#define ompt_event_release_nest_lock_last_implemented ompt_event_MAY_ALWAYS_BLAME
|
#define ompt_event_release_nest_lock_last_implemented \
|
||||||
|
ompt_event_MAY_ALWAYS_BLAME
|
||||||
#define ompt_event_release_critical_implemented ompt_event_MAY_ALWAYS_BLAME
|
#define ompt_event_release_critical_implemented ompt_event_MAY_ALWAYS_BLAME
|
||||||
#define ompt_event_release_atomic_implemented ompt_event_MAY_ALWAYS_BLAME
|
#define ompt_event_release_atomic_implemented ompt_event_MAY_ALWAYS_BLAME
|
||||||
#define ompt_event_release_ordered_implemented ompt_event_MAY_ALWAYS_BLAME
|
#define ompt_event_release_ordered_implemented ompt_event_MAY_ALWAYS_BLAME
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
| Optional Events (synchronous events)
|
| Optional Events (synchronous events)
|
||||||
+--------------------------------------------------------------------------*/
|
+--------------------------------------------------------------------------*/
|
||||||
|
|
@ -119,7 +117,8 @@
|
||||||
#define ompt_event_taskgroup_begin_implemented ompt_event_UNIMPLEMENTED
|
#define ompt_event_taskgroup_begin_implemented ompt_event_UNIMPLEMENTED
|
||||||
#define ompt_event_taskgroup_end_implemented ompt_event_UNIMPLEMENTED
|
#define ompt_event_taskgroup_end_implemented ompt_event_UNIMPLEMENTED
|
||||||
|
|
||||||
#define ompt_event_release_nest_lock_prev_implemented ompt_event_MAY_ALWAYS_TRACE
|
#define ompt_event_release_nest_lock_prev_implemented \
|
||||||
|
ompt_event_MAY_ALWAYS_TRACE
|
||||||
#define ompt_event_wait_lock_implemented ompt_event_UNIMPLEMENTED
|
#define ompt_event_wait_lock_implemented ompt_event_UNIMPLEMENTED
|
||||||
#define ompt_event_wait_nest_lock_implemented ompt_event_UNIMPLEMENTED
|
#define ompt_event_wait_nest_lock_implemented ompt_event_UNIMPLEMENTED
|
||||||
#define ompt_event_wait_critical_implemented ompt_event_UNIMPLEMENTED
|
#define ompt_event_wait_critical_implemented ompt_event_UNIMPLEMENTED
|
||||||
|
|
@ -127,8 +126,10 @@
|
||||||
#define ompt_event_wait_ordered_implemented ompt_event_MAY_ALWAYS_TRACE
|
#define ompt_event_wait_ordered_implemented ompt_event_MAY_ALWAYS_TRACE
|
||||||
|
|
||||||
#define ompt_event_acquired_lock_implemented ompt_event_MAY_ALWAYS_TRACE
|
#define ompt_event_acquired_lock_implemented ompt_event_MAY_ALWAYS_TRACE
|
||||||
#define ompt_event_acquired_nest_lock_first_implemented ompt_event_MAY_ALWAYS_TRACE
|
#define ompt_event_acquired_nest_lock_first_implemented \
|
||||||
#define ompt_event_acquired_nest_lock_next_implemented ompt_event_MAY_ALWAYS_TRACE
|
ompt_event_MAY_ALWAYS_TRACE
|
||||||
|
#define ompt_event_acquired_nest_lock_next_implemented \
|
||||||
|
ompt_event_MAY_ALWAYS_TRACE
|
||||||
#define ompt_event_acquired_critical_implemented ompt_event_UNIMPLEMENTED
|
#define ompt_event_acquired_critical_implemented ompt_event_UNIMPLEMENTED
|
||||||
#define ompt_event_acquired_atomic_implemented ompt_event_MAY_ALWAYS_TRACE
|
#define ompt_event_acquired_atomic_implemented ompt_event_MAY_ALWAYS_TRACE
|
||||||
#define ompt_event_acquired_ordered_implemented ompt_event_MAY_ALWAYS_TRACE
|
#define ompt_event_acquired_ordered_implemented ompt_event_MAY_ALWAYS_TRACE
|
||||||
|
|
@ -142,11 +143,11 @@
|
||||||
#define ompt_event_flush_implemented ompt_event_UNIMPLEMENTED
|
#define ompt_event_flush_implemented ompt_event_UNIMPLEMENTED
|
||||||
|
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
# define ompt_event_task_dependences_implemented ompt_event_MAY_ALWAYS_TRACE
|
#define ompt_event_task_dependences_implemented ompt_event_MAY_ALWAYS_TRACE
|
||||||
# define ompt_event_task_dependence_pair_implemented ompt_event_MAY_ALWAYS_TRACE
|
#define ompt_event_task_dependence_pair_implemented ompt_event_MAY_ALWAYS_TRACE
|
||||||
#else
|
#else
|
||||||
# define ompt_event_task_dependences_implemented ompt_event_UNIMPLEMENTED
|
#define ompt_event_task_dependences_implemented ompt_event_UNIMPLEMENTED
|
||||||
# define ompt_event_task_dependence_pair_implemented ompt_event_UNIMPLEMENTED
|
#define ompt_event_task_dependence_pair_implemented ompt_event_UNIMPLEMENTED
|
||||||
#endif /* OMP_40_ENABLED */
|
#endif /* OMP_40_ENABLED */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* ompt include files
|
* ompt include files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "ompt-specific.cpp"
|
#include "ompt-specific.cpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* macros
|
* macros
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
@ -34,7 +30,6 @@
|
||||||
#define OMPT_STR_MATCH(haystack, needle) (!strcasecmp(haystack, needle))
|
#define OMPT_STR_MATCH(haystack, needle) (!strcasecmp(haystack, needle))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* types
|
* types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
@ -44,7 +39,6 @@ typedef struct {
|
||||||
ompt_state_t state_id;
|
ompt_state_t state_id;
|
||||||
} ompt_state_info_t;
|
} ompt_state_info_t;
|
||||||
|
|
||||||
|
|
||||||
enum tool_setting_e {
|
enum tool_setting_e {
|
||||||
omp_tool_error,
|
omp_tool_error,
|
||||||
omp_tool_unset,
|
omp_tool_unset,
|
||||||
|
|
@ -52,14 +46,9 @@ enum tool_setting_e {
|
||||||
omp_tool_enabled
|
omp_tool_enabled
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef void (*ompt_initialize_t)(ompt_function_lookup_t ompt_fn_lookup,
|
||||||
typedef void (*ompt_initialize_t) (
|
|
||||||
ompt_function_lookup_t ompt_fn_lookup,
|
|
||||||
const char *version,
|
const char *version,
|
||||||
unsigned int ompt_version
|
unsigned int ompt_version);
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* global variables
|
* global variables
|
||||||
|
|
@ -68,7 +57,7 @@ typedef void (*ompt_initialize_t) (
|
||||||
int ompt_enabled = 0;
|
int ompt_enabled = 0;
|
||||||
|
|
||||||
ompt_state_info_t ompt_state_info[] = {
|
ompt_state_info_t ompt_state_info[] = {
|
||||||
#define ompt_state_macro(state, code) { # state, state },
|
#define ompt_state_macro(state, code) {#state, state},
|
||||||
FOREACH_OMPT_STATE(ompt_state_macro)
|
FOREACH_OMPT_STATE(ompt_state_macro)
|
||||||
#undef ompt_state_macro
|
#undef ompt_state_macro
|
||||||
};
|
};
|
||||||
|
|
@ -77,8 +66,6 @@ ompt_callbacks_t ompt_callbacks;
|
||||||
|
|
||||||
static ompt_initialize_t ompt_initialize_fn = NULL;
|
static ompt_initialize_t ompt_initialize_fn = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* forward declarations
|
* forward declarations
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
@ -87,7 +74,6 @@ static ompt_interface_fn_t ompt_fn_lookup(const char *s);
|
||||||
|
|
||||||
OMPT_API_ROUTINE ompt_thread_id_t ompt_get_thread_id(void);
|
OMPT_API_ROUTINE ompt_thread_id_t ompt_get_thread_id(void);
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* initialization and finalization (private operations)
|
* initialization and finalization (private operations)
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
@ -102,9 +88,7 @@ OMPT_API_ROUTINE ompt_thread_id_t ompt_get_thread_id(void);
|
||||||
* NULL is returned and OMPT won't be enabled */
|
* NULL is returned and OMPT won't be enabled */
|
||||||
#if OMPT_HAVE_WEAK_ATTRIBUTE
|
#if OMPT_HAVE_WEAK_ATTRIBUTE
|
||||||
_OMP_EXTERN
|
_OMP_EXTERN
|
||||||
__attribute__ (( weak ))
|
__attribute__((weak)) ompt_initialize_t ompt_tool() {
|
||||||
ompt_initialize_t ompt_tool()
|
|
||||||
{
|
|
||||||
#if OMPT_DEBUG
|
#if OMPT_DEBUG
|
||||||
printf("ompt_tool() is called from the RTL\n");
|
printf("ompt_tool() is called from the RTL\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -120,20 +104,18 @@ ompt_initialize_t ompt_tool()
|
||||||
// The number of loaded modules to start enumeration with EnumProcessModules()
|
// The number of loaded modules to start enumeration with EnumProcessModules()
|
||||||
#define NUM_MODULES 128
|
#define NUM_MODULES 128
|
||||||
|
|
||||||
static
|
static ompt_initialize_t ompt_tool_windows() {
|
||||||
ompt_initialize_t ompt_tool_windows()
|
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
DWORD needed, new_size;
|
DWORD needed, new_size;
|
||||||
HMODULE *modules;
|
HMODULE *modules;
|
||||||
HANDLE process = GetCurrentProcess();
|
HANDLE process = GetCurrentProcess();
|
||||||
modules = (HMODULE*)malloc( NUM_MODULES * sizeof(HMODULE) );
|
modules = (HMODULE *)malloc(NUM_MODULES * sizeof(HMODULE));
|
||||||
ompt_initialize_t (*ompt_tool_p)() = NULL;
|
ompt_initialize_t (*ompt_tool_p)() = NULL;
|
||||||
|
|
||||||
#if OMPT_DEBUG
|
#if OMPT_DEBUG
|
||||||
printf("ompt_tool_windows(): looking for ompt_tool\n");
|
printf("ompt_tool_windows(): looking for ompt_tool\n");
|
||||||
#endif
|
#endif
|
||||||
if (!EnumProcessModules( process, modules, NUM_MODULES * sizeof(HMODULE),
|
if (!EnumProcessModules(process, modules, NUM_MODULES * sizeof(HMODULE),
|
||||||
&needed)) {
|
&needed)) {
|
||||||
// Regardless of the error reason use the stub initialization function
|
// Regardless of the error reason use the stub initialization function
|
||||||
free(modules);
|
free(modules);
|
||||||
|
|
@ -145,7 +127,7 @@ ompt_initialize_t ompt_tool_windows()
|
||||||
#if OMPT_DEBUG
|
#if OMPT_DEBUG
|
||||||
printf("ompt_tool_windows(): resize buffer to %d bytes\n", needed);
|
printf("ompt_tool_windows(): resize buffer to %d bytes\n", needed);
|
||||||
#endif
|
#endif
|
||||||
modules = (HMODULE*)realloc( modules, needed );
|
modules = (HMODULE *)realloc(modules, needed);
|
||||||
// If resizing failed use the stub function.
|
// If resizing failed use the stub function.
|
||||||
if (!EnumProcessModules(process, modules, needed, &needed)) {
|
if (!EnumProcessModules(process, modules, needed, &needed)) {
|
||||||
free(modules);
|
free(modules);
|
||||||
|
|
@ -158,8 +140,7 @@ ompt_initialize_t ompt_tool_windows()
|
||||||
#if OMPT_DEBUG
|
#if OMPT_DEBUG
|
||||||
TCHAR modName[MAX_PATH];
|
TCHAR modName[MAX_PATH];
|
||||||
if (GetModuleFileName(modules[i], modName, MAX_PATH))
|
if (GetModuleFileName(modules[i], modName, MAX_PATH))
|
||||||
printf("ompt_tool_windows(): ompt_tool found in module %s\n",
|
printf("ompt_tool_windows(): ompt_tool found in module %s\n", modName);
|
||||||
modName);
|
|
||||||
#endif
|
#endif
|
||||||
free(modules);
|
free(modules);
|
||||||
return ompt_tool_p();
|
return ompt_tool_p();
|
||||||
|
|
@ -177,17 +158,17 @@ ompt_initialize_t ompt_tool_windows()
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# error Either __attribute__((weak)) or psapi.dll are required for OMPT support
|
#error Either __attribute__((weak)) or psapi.dll are required for OMPT support
|
||||||
#endif // OMPT_HAVE_WEAK_ATTRIBUTE
|
#endif // OMPT_HAVE_WEAK_ATTRIBUTE
|
||||||
|
|
||||||
void ompt_pre_init()
|
void ompt_pre_init() {
|
||||||
{
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// Execute the pre-initialization logic only once.
|
// Execute the pre-initialization logic only once.
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
static int ompt_pre_initialized = 0;
|
static int ompt_pre_initialized = 0;
|
||||||
|
|
||||||
if (ompt_pre_initialized) return;
|
if (ompt_pre_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
ompt_pre_initialized = 1;
|
ompt_pre_initialized = 1;
|
||||||
|
|
||||||
|
|
@ -207,7 +188,7 @@ void ompt_pre_init()
|
||||||
#if OMPT_DEBUG
|
#if OMPT_DEBUG
|
||||||
printf("ompt_pre_init(): tool_setting = %d\n", tool_setting);
|
printf("ompt_pre_init(): tool_setting = %d\n", tool_setting);
|
||||||
#endif
|
#endif
|
||||||
switch(tool_setting) {
|
switch (tool_setting) {
|
||||||
case omp_tool_disabled:
|
case omp_tool_disabled:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -220,10 +201,10 @@ void ompt_pre_init()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case omp_tool_error:
|
case omp_tool_error:
|
||||||
fprintf(stderr,
|
fprintf(stderr, "Warning: OMP_TOOL has invalid value \"%s\".\n"
|
||||||
"Warning: OMP_TOOL has invalid value \"%s\".\n"
|
|
||||||
" legal values are (NULL,\"\",\"disabled\","
|
" legal values are (NULL,\"\",\"disabled\","
|
||||||
"\"enabled\").\n", ompt_env_var);
|
"\"enabled\").\n",
|
||||||
|
ompt_env_var);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#if OMPT_DEBUG
|
#if OMPT_DEBUG
|
||||||
|
|
@ -231,15 +212,14 @@ void ompt_pre_init()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ompt_post_init() {
|
||||||
void ompt_post_init()
|
|
||||||
{
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// Execute the post-initialization logic only once.
|
// Execute the post-initialization logic only once.
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
static int ompt_post_initialized = 0;
|
static int ompt_post_initialized = 0;
|
||||||
|
|
||||||
if (ompt_post_initialized) return;
|
if (ompt_post_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
ompt_post_initialized = 1;
|
ompt_post_initialized = 1;
|
||||||
|
|
||||||
|
|
@ -255,17 +235,15 @@ void ompt_post_init()
|
||||||
ompt_set_thread_state(root_thread, ompt_state_overhead);
|
ompt_set_thread_state(root_thread, ompt_state_overhead);
|
||||||
|
|
||||||
if (ompt_callbacks.ompt_callback(ompt_event_thread_begin)) {
|
if (ompt_callbacks.ompt_callback(ompt_event_thread_begin)) {
|
||||||
ompt_callbacks.ompt_callback(ompt_event_thread_begin)
|
ompt_callbacks.ompt_callback(ompt_event_thread_begin)(
|
||||||
(ompt_thread_initial, ompt_get_thread_id());
|
ompt_thread_initial, ompt_get_thread_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
ompt_set_thread_state(root_thread, ompt_state_work_serial);
|
ompt_set_thread_state(root_thread, ompt_state_work_serial);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ompt_fini() {
|
||||||
void ompt_fini()
|
|
||||||
{
|
|
||||||
if (ompt_enabled) {
|
if (ompt_enabled) {
|
||||||
if (ompt_callbacks.ompt_callback(ompt_event_runtime_shutdown)) {
|
if (ompt_callbacks.ompt_callback(ompt_event_runtime_shutdown)) {
|
||||||
ompt_callbacks.ompt_callback(ompt_event_runtime_shutdown)();
|
ompt_callbacks.ompt_callback(ompt_event_runtime_shutdown)();
|
||||||
|
|
@ -275,7 +253,6 @@ void ompt_fini()
|
||||||
ompt_enabled = 0;
|
ompt_enabled = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* interface operations
|
* interface operations
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
@ -285,15 +262,14 @@ void ompt_fini()
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
OMPT_API_ROUTINE int ompt_enumerate_state(int current_state, int *next_state,
|
OMPT_API_ROUTINE int ompt_enumerate_state(int current_state, int *next_state,
|
||||||
const char **next_state_name)
|
const char **next_state_name) {
|
||||||
{
|
|
||||||
const static int len = sizeof(ompt_state_info) / sizeof(ompt_state_info_t);
|
const static int len = sizeof(ompt_state_info) / sizeof(ompt_state_info_t);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (i = 0; i < len - 1; i++) {
|
for (i = 0; i < len - 1; i++) {
|
||||||
if (ompt_state_info[i].state_id == current_state) {
|
if (ompt_state_info[i].state_id == current_state) {
|
||||||
*next_state = ompt_state_info[i+1].state_id;
|
*next_state = ompt_state_info[i + 1].state_id;
|
||||||
*next_state_name = ompt_state_info[i+1].state_name;
|
*next_state_name = ompt_state_info[i + 1].state_name;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -301,20 +277,17 @@ OMPT_API_ROUTINE int ompt_enumerate_state(int current_state, int *next_state,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* callbacks
|
* callbacks
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
OMPT_API_ROUTINE int ompt_set_callback(ompt_event_t evid, ompt_callback_t cb)
|
OMPT_API_ROUTINE int ompt_set_callback(ompt_event_t evid, ompt_callback_t cb) {
|
||||||
{
|
|
||||||
switch (evid) {
|
switch (evid) {
|
||||||
|
|
||||||
#define ompt_event_macro(event_name, callback_type, event_id) \
|
#define ompt_event_macro(event_name, callback_type, event_id) \
|
||||||
case event_name: \
|
case event_name: \
|
||||||
if (ompt_event_implementation_status(event_name)) { \
|
if (ompt_event_implementation_status(event_name)) { \
|
||||||
ompt_callbacks.ompt_callback(event_name) = (callback_type) cb; \
|
ompt_callbacks.ompt_callback(event_name) = (callback_type)cb; \
|
||||||
} \
|
} \
|
||||||
return ompt_event_implementation_status(event_name);
|
return ompt_event_implementation_status(event_name);
|
||||||
|
|
||||||
|
|
@ -322,20 +295,19 @@ OMPT_API_ROUTINE int ompt_set_callback(ompt_event_t evid, ompt_callback_t cb)
|
||||||
|
|
||||||
#undef ompt_event_macro
|
#undef ompt_event_macro
|
||||||
|
|
||||||
default: return ompt_set_result_registration_error;
|
default:
|
||||||
|
return ompt_set_result_registration_error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OMPT_API_ROUTINE int ompt_get_callback(ompt_event_t evid, ompt_callback_t *cb) {
|
||||||
OMPT_API_ROUTINE int ompt_get_callback(ompt_event_t evid, ompt_callback_t *cb)
|
|
||||||
{
|
|
||||||
switch (evid) {
|
switch (evid) {
|
||||||
|
|
||||||
#define ompt_event_macro(event_name, callback_type, event_id) \
|
#define ompt_event_macro(event_name, callback_type, event_id) \
|
||||||
case event_name: \
|
case event_name: \
|
||||||
if (ompt_event_implementation_status(event_name)) { \
|
if (ompt_event_implementation_status(event_name)) { \
|
||||||
ompt_callback_t mycb = \
|
ompt_callback_t mycb = \
|
||||||
(ompt_callback_t) ompt_callbacks.ompt_callback(event_name); \
|
(ompt_callback_t)ompt_callbacks.ompt_callback(event_name); \
|
||||||
if (mycb) { \
|
if (mycb) { \
|
||||||
*cb = mycb; \
|
*cb = mycb; \
|
||||||
return ompt_get_callback_success; \
|
return ompt_get_callback_success; \
|
||||||
|
|
@ -347,35 +319,28 @@ OMPT_API_ROUTINE int ompt_get_callback(ompt_event_t evid, ompt_callback_t *cb)
|
||||||
|
|
||||||
#undef ompt_event_macro
|
#undef ompt_event_macro
|
||||||
|
|
||||||
default: return ompt_get_callback_failure;
|
default:
|
||||||
|
return ompt_get_callback_failure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* parallel regions
|
* parallel regions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
OMPT_API_ROUTINE ompt_parallel_id_t ompt_get_parallel_id(int ancestor_level)
|
OMPT_API_ROUTINE ompt_parallel_id_t ompt_get_parallel_id(int ancestor_level) {
|
||||||
{
|
|
||||||
return __ompt_get_parallel_id_internal(ancestor_level);
|
return __ompt_get_parallel_id_internal(ancestor_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OMPT_API_ROUTINE int ompt_get_parallel_team_size(int ancestor_level) {
|
||||||
OMPT_API_ROUTINE int ompt_get_parallel_team_size(int ancestor_level)
|
|
||||||
{
|
|
||||||
return __ompt_get_parallel_team_size_internal(ancestor_level);
|
return __ompt_get_parallel_team_size_internal(ancestor_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OMPT_API_ROUTINE void *ompt_get_parallel_function(int ancestor_level) {
|
||||||
OMPT_API_ROUTINE void *ompt_get_parallel_function(int ancestor_level)
|
|
||||||
{
|
|
||||||
return __ompt_get_parallel_function_internal(ancestor_level);
|
return __ompt_get_parallel_function_internal(ancestor_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OMPT_API_ROUTINE ompt_state_t ompt_get_state(ompt_wait_id_t *ompt_wait_id) {
|
||||||
OMPT_API_ROUTINE ompt_state_t ompt_get_state(ompt_wait_id_t *ompt_wait_id)
|
|
||||||
{
|
|
||||||
ompt_state_t thread_state = __ompt_get_state_internal(ompt_wait_id);
|
ompt_state_t thread_state = __ompt_get_state_internal(ompt_wait_id);
|
||||||
|
|
||||||
if (thread_state == ompt_state_undefined) {
|
if (thread_state == ompt_state_undefined) {
|
||||||
|
|
@ -385,48 +350,34 @@ OMPT_API_ROUTINE ompt_state_t ompt_get_state(ompt_wait_id_t *ompt_wait_id)
|
||||||
return thread_state;
|
return thread_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* threads
|
* threads
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
OMPT_API_ROUTINE void *ompt_get_idle_frame() {
|
||||||
OMPT_API_ROUTINE void *ompt_get_idle_frame()
|
|
||||||
{
|
|
||||||
return __ompt_get_idle_frame_internal();
|
return __ompt_get_idle_frame_internal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* tasks
|
* tasks
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
OMPT_API_ROUTINE ompt_thread_id_t ompt_get_thread_id(void) {
|
||||||
OMPT_API_ROUTINE ompt_thread_id_t ompt_get_thread_id(void)
|
|
||||||
{
|
|
||||||
return __ompt_get_thread_id_internal();
|
return __ompt_get_thread_id_internal();
|
||||||
}
|
}
|
||||||
|
|
||||||
OMPT_API_ROUTINE ompt_task_id_t ompt_get_task_id(int depth)
|
OMPT_API_ROUTINE ompt_task_id_t ompt_get_task_id(int depth) {
|
||||||
{
|
|
||||||
return __ompt_get_task_id_internal(depth);
|
return __ompt_get_task_id_internal(depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OMPT_API_ROUTINE ompt_frame_t *ompt_get_task_frame(int depth) {
|
||||||
OMPT_API_ROUTINE ompt_frame_t *ompt_get_task_frame(int depth)
|
|
||||||
{
|
|
||||||
return __ompt_get_task_frame_internal(depth);
|
return __ompt_get_task_frame_internal(depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OMPT_API_ROUTINE void *ompt_get_task_function(int depth) {
|
||||||
OMPT_API_ROUTINE void *ompt_get_task_function(int depth)
|
|
||||||
{
|
|
||||||
return __ompt_get_task_function_internal(depth);
|
return __ompt_get_task_function_internal(depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* placeholders
|
* placeholders
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
@ -440,43 +391,33 @@ OMPT_API_ROUTINE void *ompt_get_task_function(int depth)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
OMPT_API_PLACEHOLDER void ompt_idle(void) {
|
||||||
OMPT_API_PLACEHOLDER void ompt_idle(void)
|
|
||||||
{
|
|
||||||
// This function is a placeholder used to represent the calling context of
|
// This function is a placeholder used to represent the calling context of
|
||||||
// idle OpenMP worker threads. It is not meant to be invoked.
|
// idle OpenMP worker threads. It is not meant to be invoked.
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OMPT_API_PLACEHOLDER void ompt_overhead(void) {
|
||||||
OMPT_API_PLACEHOLDER void ompt_overhead(void)
|
|
||||||
{
|
|
||||||
// This function is a placeholder used to represent the OpenMP context of
|
// This function is a placeholder used to represent the OpenMP context of
|
||||||
// threads working in the OpenMP runtime. It is not meant to be invoked.
|
// threads working in the OpenMP runtime. It is not meant to be invoked.
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OMPT_API_PLACEHOLDER void ompt_barrier_wait(void) {
|
||||||
OMPT_API_PLACEHOLDER void ompt_barrier_wait(void)
|
|
||||||
{
|
|
||||||
// This function is a placeholder used to represent the OpenMP context of
|
// This function is a placeholder used to represent the OpenMP context of
|
||||||
// threads waiting for a barrier in the OpenMP runtime. It is not meant
|
// threads waiting for a barrier in the OpenMP runtime. It is not meant
|
||||||
// to be invoked.
|
// to be invoked.
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OMPT_API_PLACEHOLDER void ompt_task_wait(void) {
|
||||||
OMPT_API_PLACEHOLDER void ompt_task_wait(void)
|
|
||||||
{
|
|
||||||
// This function is a placeholder used to represent the OpenMP context of
|
// This function is a placeholder used to represent the OpenMP context of
|
||||||
// threads waiting for a task in the OpenMP runtime. It is not meant
|
// threads waiting for a task in the OpenMP runtime. It is not meant
|
||||||
// to be invoked.
|
// to be invoked.
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OMPT_API_PLACEHOLDER void ompt_mutex_wait(void) {
|
||||||
OMPT_API_PLACEHOLDER void ompt_mutex_wait(void)
|
|
||||||
{
|
|
||||||
// This function is a placeholder used to represent the OpenMP context of
|
// This function is a placeholder used to represent the OpenMP context of
|
||||||
// threads waiting for a mutex in the OpenMP runtime. It is not meant
|
// threads waiting for a mutex in the OpenMP runtime. It is not meant
|
||||||
// to be invoked.
|
// to be invoked.
|
||||||
|
|
@ -487,49 +428,39 @@ OMPT_API_PLACEHOLDER void ompt_mutex_wait(void)
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* compatability
|
* compatability
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
OMPT_API_ROUTINE int ompt_get_ompt_version()
|
OMPT_API_ROUTINE int ompt_get_ompt_version() { return OMPT_VERSION; }
|
||||||
{
|
|
||||||
return OMPT_VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* application-facing API
|
* application-facing API
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
| control
|
| control
|
||||||
---------------------------------------------------------------------------*/
|
---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
_OMP_EXTERN void ompt_control(uint64_t command, uint64_t modifier)
|
_OMP_EXTERN void ompt_control(uint64_t command, uint64_t modifier) {
|
||||||
{
|
|
||||||
if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_control)) {
|
if (ompt_enabled && ompt_callbacks.ompt_callback(ompt_event_control)) {
|
||||||
ompt_callbacks.ompt_callback(ompt_event_control)(command, modifier);
|
ompt_callbacks.ompt_callback(ompt_event_control)(command, modifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* API inquiry for tool
|
* API inquiry for tool
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static ompt_interface_fn_t ompt_fn_lookup(const char *s)
|
static ompt_interface_fn_t ompt_fn_lookup(const char *s) {
|
||||||
{
|
|
||||||
|
|
||||||
#define ompt_interface_fn(fn) \
|
#define ompt_interface_fn(fn) \
|
||||||
if (strcmp(s, #fn) == 0) return (ompt_interface_fn_t) fn;
|
if (strcmp(s, #fn) == 0) \
|
||||||
|
return (ompt_interface_fn_t)fn;
|
||||||
|
|
||||||
FOREACH_OMPT_INQUIRY_FN(ompt_interface_fn)
|
FOREACH_OMPT_INQUIRY_FN(ompt_interface_fn)
|
||||||
|
|
||||||
FOREACH_OMPT_PLACEHOLDER_FN(ompt_interface_fn)
|
FOREACH_OMPT_PLACEHOLDER_FN(ompt_interface_fn)
|
||||||
|
|
||||||
return (ompt_interface_fn_t) 0;
|
return (ompt_interface_fn_t)0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#ifndef __OMPT_INTERNAL_H__
|
#ifndef __OMPT_INTERNAL_H__
|
||||||
#define __OMPT_INTERNAL_H__
|
#define __OMPT_INTERNAL_H__
|
||||||
|
|
||||||
#include "ompt.h"
|
|
||||||
#include "ompt-event-specific.h"
|
#include "ompt-event-specific.h"
|
||||||
|
#include "ompt.h"
|
||||||
|
|
||||||
#define OMPT_VERSION 1
|
#define OMPT_VERSION 1
|
||||||
|
|
||||||
|
|
@ -11,23 +11,20 @@
|
||||||
#define OMPT_INVOKER(x) \
|
#define OMPT_INVOKER(x) \
|
||||||
((x == fork_context_gnu) ? ompt_invoker_program : ompt_invoker_runtime)
|
((x == fork_context_gnu) ? ompt_invoker_program : ompt_invoker_runtime)
|
||||||
|
|
||||||
|
#define ompt_callback(e) e##_callback
|
||||||
#define ompt_callback(e) e ## _callback
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct ompt_callbacks_s {
|
typedef struct ompt_callbacks_s {
|
||||||
#define ompt_event_macro(event, callback, eventid) callback ompt_callback(event);
|
#define ompt_event_macro(event, callback, eventid) \
|
||||||
|
callback ompt_callback(event);
|
||||||
|
|
||||||
FOREACH_OMPT_EVENT(ompt_event_macro)
|
FOREACH_OMPT_EVENT(ompt_event_macro)
|
||||||
|
|
||||||
#undef ompt_event_macro
|
#undef ompt_event_macro
|
||||||
} ompt_callbacks_t;
|
} ompt_callbacks_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ompt_frame_t frame;
|
ompt_frame_t frame;
|
||||||
void* function;
|
void *function;
|
||||||
ompt_task_id_t task_id;
|
ompt_task_id_t task_id;
|
||||||
#if OMP_40_ENABLED
|
#if OMP_40_ENABLED
|
||||||
int ndeps;
|
int ndeps;
|
||||||
|
|
@ -35,20 +32,17 @@ typedef struct {
|
||||||
#endif /* OMP_40_ENABLED */
|
#endif /* OMP_40_ENABLED */
|
||||||
} ompt_task_info_t;
|
} ompt_task_info_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ompt_parallel_id_t parallel_id;
|
ompt_parallel_id_t parallel_id;
|
||||||
void *microtask;
|
void *microtask;
|
||||||
} ompt_team_info_t;
|
} ompt_team_info_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct ompt_lw_taskteam_s {
|
typedef struct ompt_lw_taskteam_s {
|
||||||
ompt_team_info_t ompt_team_info;
|
ompt_team_info_t ompt_team_info;
|
||||||
ompt_task_info_t ompt_task_info;
|
ompt_task_info_t ompt_task_info;
|
||||||
struct ompt_lw_taskteam_s *parent;
|
struct ompt_lw_taskteam_s *parent;
|
||||||
} ompt_lw_taskteam_t;
|
} ompt_lw_taskteam_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct ompt_parallel_info_s {
|
typedef struct ompt_parallel_info_s {
|
||||||
ompt_task_id_t parent_task_id; /* id of parent task */
|
ompt_task_id_t parent_task_id; /* id of parent task */
|
||||||
ompt_parallel_id_t parallel_id; /* id of parallel region */
|
ompt_parallel_id_t parallel_id; /* id of parallel region */
|
||||||
|
|
@ -56,24 +50,22 @@ typedef struct ompt_parallel_info_s {
|
||||||
void *parallel_function; /* pointer to outlined function */
|
void *parallel_function; /* pointer to outlined function */
|
||||||
} ompt_parallel_info_t;
|
} ompt_parallel_info_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ompt_state_t state;
|
ompt_state_t state;
|
||||||
ompt_wait_id_t wait_id;
|
ompt_wait_id_t wait_id;
|
||||||
void *idle_frame;
|
void *idle_frame;
|
||||||
} ompt_thread_info_t;
|
} ompt_thread_info_t;
|
||||||
|
|
||||||
|
|
||||||
extern ompt_callbacks_t ompt_callbacks;
|
extern ompt_callbacks_t ompt_callbacks;
|
||||||
|
|
||||||
#if OMP_40_ENABLED && OMPT_SUPPORT && OMPT_TRACE
|
#if OMP_40_ENABLED && OMPT_SUPPORT && OMPT_TRACE
|
||||||
#if USE_FAST_MEMORY
|
#if USE_FAST_MEMORY
|
||||||
# define KMP_OMPT_DEPS_ALLOC __kmp_fast_allocate
|
#define KMP_OMPT_DEPS_ALLOC __kmp_fast_allocate
|
||||||
# define KMP_OMPT_DEPS_FREE __kmp_fast_free
|
#define KMP_OMPT_DEPS_FREE __kmp_fast_free
|
||||||
# else
|
#else
|
||||||
# define KMP_OMPT_DEPS_ALLOC __kmp_thread_malloc
|
#define KMP_OMPT_DEPS_ALLOC __kmp_thread_malloc
|
||||||
# define KMP_OMPT_DEPS_FREE __kmp_thread_free
|
#define KMP_OMPT_DEPS_FREE __kmp_thread_free
|
||||||
# endif
|
#endif
|
||||||
#endif /* OMP_40_ENABLED && OMPT_SUPPORT && OMPT_TRACE */
|
#endif /* OMP_40_ENABLED && OMPT_SUPPORT && OMPT_TRACE */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
// macros
|
// macros
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
#define GTID_TO_OMPT_THREAD_ID(id) ((ompt_thread_id_t) (id >=0) ? id + 1: 0)
|
#define GTID_TO_OMPT_THREAD_ID(id) ((ompt_thread_id_t)(id >= 0) ? id + 1 : 0)
|
||||||
|
|
||||||
#define LWT_FROM_TEAM(team) (team)->t.ompt_serialized_team_info;
|
#define LWT_FROM_TEAM(team) (team)->t.ompt_serialized_team_info;
|
||||||
|
|
||||||
|
|
@ -26,10 +26,10 @@
|
||||||
// when using fetch_and_add to generate the IDs, there isn't any reason to waste
|
// when using fetch_and_add to generate the IDs, there isn't any reason to waste
|
||||||
// bits for thread id.
|
// bits for thread id.
|
||||||
#if 0
|
#if 0
|
||||||
#define NEXT_ID(id_ptr,tid) \
|
#define NEXT_ID(id_ptr, tid) \
|
||||||
((KMP_TEST_THEN_INC64(id_ptr) << OMPT_THREAD_ID_BITS) | (tid))
|
((KMP_TEST_THEN_INC64(id_ptr) << OMPT_THREAD_ID_BITS) | (tid))
|
||||||
#else
|
#else
|
||||||
#define NEXT_ID(id_ptr,tid) (KMP_TEST_THEN_INC64((volatile kmp_int64 *)id_ptr))
|
#define NEXT_ID(id_ptr, tid) (KMP_TEST_THEN_INC64((volatile kmp_int64 *)id_ptr))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
@ -43,25 +43,25 @@
|
||||||
// kept consistent
|
// kept consistent
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
|
|
||||||
ompt_team_info_t *
|
ompt_team_info_t *__ompt_get_teaminfo(int depth, int *size) {
|
||||||
__ompt_get_teaminfo(int depth, int *size)
|
|
||||||
{
|
|
||||||
kmp_info_t *thr = ompt_get_thread();
|
kmp_info_t *thr = ompt_get_thread();
|
||||||
|
|
||||||
if (thr) {
|
if (thr) {
|
||||||
kmp_team *team = thr->th.th_team;
|
kmp_team *team = thr->th.th_team;
|
||||||
if (team == NULL) return NULL;
|
if (team == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
ompt_lw_taskteam_t *lwt = LWT_FROM_TEAM(team);
|
ompt_lw_taskteam_t *lwt = LWT_FROM_TEAM(team);
|
||||||
|
|
||||||
while(depth > 0) {
|
while (depth > 0) {
|
||||||
// next lightweight team (if any)
|
// next lightweight team (if any)
|
||||||
if (lwt) lwt = lwt->parent;
|
if (lwt)
|
||||||
|
lwt = lwt->parent;
|
||||||
|
|
||||||
// next heavyweight team (if any) after
|
// next heavyweight team (if any) after
|
||||||
// lightweight teams are exhausted
|
// lightweight teams are exhausted
|
||||||
if (!lwt && team) {
|
if (!lwt && team) {
|
||||||
team=team->t.t_parent;
|
team = team->t.t_parent;
|
||||||
if (team) {
|
if (team) {
|
||||||
lwt = LWT_FROM_TEAM(team);
|
lwt = LWT_FROM_TEAM(team);
|
||||||
}
|
}
|
||||||
|
|
@ -72,13 +72,15 @@ __ompt_get_teaminfo(int depth, int *size)
|
||||||
|
|
||||||
if (lwt) {
|
if (lwt) {
|
||||||
// lightweight teams have one task
|
// lightweight teams have one task
|
||||||
if (size) *size = 1;
|
if (size)
|
||||||
|
*size = 1;
|
||||||
|
|
||||||
// return team info for lightweight team
|
// return team info for lightweight team
|
||||||
return &lwt->ompt_team_info;
|
return &lwt->ompt_team_info;
|
||||||
} else if (team) {
|
} else if (team) {
|
||||||
// extract size from heavyweight team
|
// extract size from heavyweight team
|
||||||
if (size) *size = team->t.t_nproc;
|
if (size)
|
||||||
|
*size = team->t.t_nproc;
|
||||||
|
|
||||||
// return team info for heavyweight team
|
// return team info for heavyweight team
|
||||||
return &team->t.ompt_team_info;
|
return &team->t.ompt_team_info;
|
||||||
|
|
@ -88,10 +90,7 @@ __ompt_get_teaminfo(int depth, int *size)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ompt_task_info_t *__ompt_get_taskinfo(int depth) {
|
||||||
ompt_task_info_t *
|
|
||||||
__ompt_get_taskinfo(int depth)
|
|
||||||
{
|
|
||||||
ompt_task_info_t *info = NULL;
|
ompt_task_info_t *info = NULL;
|
||||||
kmp_info_t *thr = ompt_get_thread();
|
kmp_info_t *thr = ompt_get_thread();
|
||||||
|
|
||||||
|
|
@ -101,7 +100,8 @@ __ompt_get_taskinfo(int depth)
|
||||||
|
|
||||||
while (depth > 0) {
|
while (depth > 0) {
|
||||||
// next lightweight team (if any)
|
// next lightweight team (if any)
|
||||||
if (lwt) lwt = lwt->parent;
|
if (lwt)
|
||||||
|
lwt = lwt->parent;
|
||||||
|
|
||||||
// next heavyweight team (if any) after
|
// next heavyweight team (if any) after
|
||||||
// lightweight teams are exhausted
|
// lightweight teams are exhausted
|
||||||
|
|
@ -124,8 +124,6 @@ __ompt_get_taskinfo(int depth)
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
// interface operations
|
// interface operations
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
@ -134,34 +132,23 @@ __ompt_get_taskinfo(int depth)
|
||||||
// thread support
|
// thread support
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
|
|
||||||
ompt_parallel_id_t
|
ompt_parallel_id_t __ompt_thread_id_new() {
|
||||||
__ompt_thread_id_new()
|
|
||||||
{
|
|
||||||
static uint64_t ompt_thread_id = 1;
|
static uint64_t ompt_thread_id = 1;
|
||||||
return NEXT_ID(&ompt_thread_id, 0);
|
return NEXT_ID(&ompt_thread_id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void __ompt_thread_begin(ompt_thread_type_t thread_type, int gtid) {
|
||||||
__ompt_thread_begin(ompt_thread_type_t thread_type, int gtid)
|
|
||||||
{
|
|
||||||
ompt_callbacks.ompt_callback(ompt_event_thread_begin)(
|
ompt_callbacks.ompt_callback(ompt_event_thread_begin)(
|
||||||
thread_type, GTID_TO_OMPT_THREAD_ID(gtid));
|
thread_type, GTID_TO_OMPT_THREAD_ID(gtid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __ompt_thread_end(ompt_thread_type_t thread_type, int gtid) {
|
||||||
void
|
|
||||||
__ompt_thread_end(ompt_thread_type_t thread_type, int gtid)
|
|
||||||
{
|
|
||||||
ompt_callbacks.ompt_callback(ompt_event_thread_end)(
|
ompt_callbacks.ompt_callback(ompt_event_thread_end)(
|
||||||
thread_type, GTID_TO_OMPT_THREAD_ID(gtid));
|
thread_type, GTID_TO_OMPT_THREAD_ID(gtid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ompt_thread_id_t __ompt_get_thread_id_internal() {
|
||||||
ompt_thread_id_t
|
// FIXME: until we have a better way of assigning ids, use __kmp_get_gtid
|
||||||
__ompt_get_thread_id_internal()
|
|
||||||
{
|
|
||||||
// FIXME
|
|
||||||
// until we have a better way of assigning ids, use __kmp_get_gtid
|
|
||||||
// since the return value might be negative, we need to test that before
|
// since the return value might be negative, we need to test that before
|
||||||
// assigning it to an ompt_thread_id_t, which is unsigned.
|
// assigning it to an ompt_thread_id_t, which is unsigned.
|
||||||
int id = __kmp_get_gtid();
|
int id = __kmp_get_gtid();
|
||||||
|
|
@ -174,18 +161,14 @@ __ompt_get_thread_id_internal()
|
||||||
// state support
|
// state support
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
|
|
||||||
void
|
void __ompt_thread_assign_wait_id(void *variable) {
|
||||||
__ompt_thread_assign_wait_id(void *variable)
|
|
||||||
{
|
|
||||||
int gtid = __kmp_gtid_get_specific();
|
int gtid = __kmp_gtid_get_specific();
|
||||||
kmp_info_t *ti = ompt_get_thread_gtid(gtid);
|
kmp_info_t *ti = ompt_get_thread_gtid(gtid);
|
||||||
|
|
||||||
ti->th.ompt_thread_info.wait_id = (ompt_wait_id_t) variable;
|
ti->th.ompt_thread_info.wait_id = (ompt_wait_id_t)variable;
|
||||||
}
|
}
|
||||||
|
|
||||||
ompt_state_t
|
ompt_state_t __ompt_get_state_internal(ompt_wait_id_t *ompt_wait_id) {
|
||||||
__ompt_get_state_internal(ompt_wait_id_t *ompt_wait_id)
|
|
||||||
{
|
|
||||||
kmp_info_t *ti = ompt_get_thread();
|
kmp_info_t *ti = ompt_get_thread();
|
||||||
|
|
||||||
if (ti) {
|
if (ti) {
|
||||||
|
|
@ -200,65 +183,47 @@ __ompt_get_state_internal(ompt_wait_id_t *ompt_wait_id)
|
||||||
// idle frame support
|
// idle frame support
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
|
|
||||||
void *
|
void *__ompt_get_idle_frame_internal(void) {
|
||||||
__ompt_get_idle_frame_internal(void)
|
|
||||||
{
|
|
||||||
kmp_info_t *ti = ompt_get_thread();
|
kmp_info_t *ti = ompt_get_thread();
|
||||||
return ti ? ti->th.ompt_thread_info.idle_frame : NULL;
|
return ti ? ti->th.ompt_thread_info.idle_frame : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
// parallel region support
|
// parallel region support
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
|
|
||||||
ompt_parallel_id_t
|
ompt_parallel_id_t __ompt_parallel_id_new(int gtid) {
|
||||||
__ompt_parallel_id_new(int gtid)
|
|
||||||
{
|
|
||||||
static uint64_t ompt_parallel_id = 1;
|
static uint64_t ompt_parallel_id = 1;
|
||||||
return gtid >= 0 ? NEXT_ID(&ompt_parallel_id, gtid) : 0;
|
return gtid >= 0 ? NEXT_ID(&ompt_parallel_id, gtid) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *__ompt_get_parallel_function_internal(int depth) {
|
||||||
void *
|
|
||||||
__ompt_get_parallel_function_internal(int depth)
|
|
||||||
{
|
|
||||||
ompt_team_info_t *info = __ompt_get_teaminfo(depth, NULL);
|
ompt_team_info_t *info = __ompt_get_teaminfo(depth, NULL);
|
||||||
void *function = info ? info->microtask : NULL;
|
void *function = info ? info->microtask : NULL;
|
||||||
return function;
|
return function;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ompt_parallel_id_t __ompt_get_parallel_id_internal(int depth) {
|
||||||
ompt_parallel_id_t
|
|
||||||
__ompt_get_parallel_id_internal(int depth)
|
|
||||||
{
|
|
||||||
ompt_team_info_t *info = __ompt_get_teaminfo(depth, NULL);
|
ompt_team_info_t *info = __ompt_get_teaminfo(depth, NULL);
|
||||||
ompt_parallel_id_t id = info ? info->parallel_id : 0;
|
ompt_parallel_id_t id = info ? info->parallel_id : 0;
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int __ompt_get_parallel_team_size_internal(int depth) {
|
||||||
int
|
|
||||||
__ompt_get_parallel_team_size_internal(int depth)
|
|
||||||
{
|
|
||||||
// initialize the return value with the error value.
|
// initialize the return value with the error value.
|
||||||
// if there is a team at the specified depth, the default
|
// if there is a team at the specified depth, the default
|
||||||
// value will be overwritten the size of that team.
|
// value will be overwritten the size of that team.
|
||||||
int size = -1;
|
int size = -1;
|
||||||
(void) __ompt_get_teaminfo(depth, &size);
|
(void)__ompt_get_teaminfo(depth, &size);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
// lightweight task team support
|
// lightweight task team support
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
|
|
||||||
void
|
void __ompt_lw_taskteam_init(ompt_lw_taskteam_t *lwt, kmp_info_t *thr, int gtid,
|
||||||
__ompt_lw_taskteam_init(ompt_lw_taskteam_t *lwt, kmp_info_t *thr,
|
void *microtask, ompt_parallel_id_t ompt_pid) {
|
||||||
int gtid, void *microtask,
|
|
||||||
ompt_parallel_id_t ompt_pid)
|
|
||||||
{
|
|
||||||
lwt->ompt_team_info.parallel_id = ompt_pid;
|
lwt->ompt_team_info.parallel_id = ompt_pid;
|
||||||
lwt->ompt_team_info.microtask = microtask;
|
lwt->ompt_team_info.microtask = microtask;
|
||||||
lwt->ompt_task_info.task_id = 0;
|
lwt->ompt_task_info.task_id = 0;
|
||||||
|
|
@ -268,70 +233,50 @@ __ompt_lw_taskteam_init(ompt_lw_taskteam_t *lwt, kmp_info_t *thr,
|
||||||
lwt->parent = 0;
|
lwt->parent = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __ompt_lw_taskteam_link(ompt_lw_taskteam_t *lwt, kmp_info_t *thr) {
|
||||||
void
|
|
||||||
__ompt_lw_taskteam_link(ompt_lw_taskteam_t *lwt, kmp_info_t *thr)
|
|
||||||
{
|
|
||||||
ompt_lw_taskteam_t *my_parent = thr->th.th_team->t.ompt_serialized_team_info;
|
ompt_lw_taskteam_t *my_parent = thr->th.th_team->t.ompt_serialized_team_info;
|
||||||
lwt->parent = my_parent;
|
lwt->parent = my_parent;
|
||||||
thr->th.th_team->t.ompt_serialized_team_info = lwt;
|
thr->th.th_team->t.ompt_serialized_team_info = lwt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ompt_lw_taskteam_t *__ompt_lw_taskteam_unlink(kmp_info_t *thr) {
|
||||||
ompt_lw_taskteam_t *
|
|
||||||
__ompt_lw_taskteam_unlink(kmp_info_t *thr)
|
|
||||||
{
|
|
||||||
ompt_lw_taskteam_t *lwtask = thr->th.th_team->t.ompt_serialized_team_info;
|
ompt_lw_taskteam_t *lwtask = thr->th.th_team->t.ompt_serialized_team_info;
|
||||||
if (lwtask) thr->th.th_team->t.ompt_serialized_team_info = lwtask->parent;
|
if (lwtask)
|
||||||
|
thr->th.th_team->t.ompt_serialized_team_info = lwtask->parent;
|
||||||
return lwtask;
|
return lwtask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
// task support
|
// task support
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
|
|
||||||
ompt_task_id_t
|
ompt_task_id_t __ompt_task_id_new(int gtid) {
|
||||||
__ompt_task_id_new(int gtid)
|
|
||||||
{
|
|
||||||
static uint64_t ompt_task_id = 1;
|
static uint64_t ompt_task_id = 1;
|
||||||
return NEXT_ID(&ompt_task_id, gtid);
|
return NEXT_ID(&ompt_task_id, gtid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ompt_task_id_t __ompt_get_task_id_internal(int depth) {
|
||||||
ompt_task_id_t
|
|
||||||
__ompt_get_task_id_internal(int depth)
|
|
||||||
{
|
|
||||||
ompt_task_info_t *info = __ompt_get_taskinfo(depth);
|
ompt_task_info_t *info = __ompt_get_taskinfo(depth);
|
||||||
ompt_task_id_t task_id = info ? info->task_id : 0;
|
ompt_task_id_t task_id = info ? info->task_id : 0;
|
||||||
return task_id;
|
return task_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *__ompt_get_task_function_internal(int depth) {
|
||||||
void *
|
|
||||||
__ompt_get_task_function_internal(int depth)
|
|
||||||
{
|
|
||||||
ompt_task_info_t *info = __ompt_get_taskinfo(depth);
|
ompt_task_info_t *info = __ompt_get_taskinfo(depth);
|
||||||
void *function = info ? info->function : NULL;
|
void *function = info ? info->function : NULL;
|
||||||
return function;
|
return function;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ompt_frame_t *__ompt_get_task_frame_internal(int depth) {
|
||||||
ompt_frame_t *
|
|
||||||
__ompt_get_task_frame_internal(int depth)
|
|
||||||
{
|
|
||||||
ompt_task_info_t *info = __ompt_get_taskinfo(depth);
|
ompt_task_info_t *info = __ompt_get_taskinfo(depth);
|
||||||
ompt_frame_t *frame = info ? frame = &info->frame : NULL;
|
ompt_frame_t *frame = info ? frame = &info->frame : NULL;
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
// team support
|
// team support
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
|
|
||||||
void
|
void __ompt_team_assign_id(kmp_team_t *team, ompt_parallel_id_t ompt_pid) {
|
||||||
__ompt_team_assign_id(kmp_team_t *team, ompt_parallel_id_t ompt_pid)
|
|
||||||
{
|
|
||||||
team->t.ompt_team_info.parallel_id = ompt_pid;
|
team->t.ompt_team_info.parallel_id = ompt_pid;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@
|
||||||
|
|
||||||
typedef kmp_info_t ompt_thread_t;
|
typedef kmp_info_t ompt_thread_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* forward declarations
|
* forward declarations
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
@ -24,7 +22,7 @@ void __ompt_lw_taskteam_init(ompt_lw_taskteam_t *lwt, ompt_thread_t *thr,
|
||||||
|
|
||||||
void __ompt_lw_taskteam_link(ompt_lw_taskteam_t *lwt, ompt_thread_t *thr);
|
void __ompt_lw_taskteam_link(ompt_lw_taskteam_t *lwt, ompt_thread_t *thr);
|
||||||
|
|
||||||
ompt_lw_taskteam_t * __ompt_lw_taskteam_unlink(ompt_thread_t *thr);
|
ompt_lw_taskteam_t *__ompt_lw_taskteam_unlink(ompt_thread_t *thr);
|
||||||
|
|
||||||
ompt_parallel_id_t __ompt_parallel_id_new(int gtid);
|
ompt_parallel_id_t __ompt_parallel_id_new(int gtid);
|
||||||
ompt_task_id_t __ompt_task_id_new(int gtid);
|
ompt_task_id_t __ompt_task_id_new(int gtid);
|
||||||
|
|
@ -43,8 +41,6 @@ ompt_task_id_t __ompt_get_task_id_internal(int depth);
|
||||||
|
|
||||||
ompt_frame_t *__ompt_get_task_frame_internal(int depth);
|
ompt_frame_t *__ompt_get_task_frame_internal(int depth);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* macros
|
* macros
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
@ -53,37 +49,24 @@ ompt_frame_t *__ompt_get_task_frame_internal(int depth);
|
||||||
#define OMPT_HAVE_PSAPI KMP_HAVE_PSAPI
|
#define OMPT_HAVE_PSAPI KMP_HAVE_PSAPI
|
||||||
#define OMPT_STR_MATCH(haystack, needle) __kmp_str_match(haystack, 0, needle)
|
#define OMPT_STR_MATCH(haystack, needle) __kmp_str_match(haystack, 0, needle)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
// inline functions
|
// inline functions
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
inline ompt_thread_t *
|
inline ompt_thread_t *ompt_get_thread_gtid(int gtid) {
|
||||||
ompt_get_thread_gtid(int gtid)
|
|
||||||
{
|
|
||||||
return (gtid >= 0) ? __kmp_thread_from_gtid(gtid) : NULL;
|
return (gtid >= 0) ? __kmp_thread_from_gtid(gtid) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline ompt_thread_t *ompt_get_thread() {
|
||||||
inline ompt_thread_t *
|
|
||||||
ompt_get_thread()
|
|
||||||
{
|
|
||||||
int gtid = __kmp_get_gtid();
|
int gtid = __kmp_get_gtid();
|
||||||
return ompt_get_thread_gtid(gtid);
|
return ompt_get_thread_gtid(gtid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void ompt_set_thread_state(ompt_thread_t *thread, ompt_state_t state) {
|
||||||
inline void
|
|
||||||
ompt_set_thread_state(ompt_thread_t *thread, ompt_state_t state)
|
|
||||||
{
|
|
||||||
thread->th.ompt_thread_info.state = state;
|
thread->th.ompt_thread_info.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const char *ompt_get_runtime_version() {
|
||||||
inline const char *
|
|
||||||
ompt_get_runtime_version()
|
|
||||||
{
|
|
||||||
return &__kmp_version_lib_ver[KMP_VERSION_MAGIC_LEN];
|
return &__kmp_version_lib_ver[KMP_VERSION_MAGIC_LEN];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
* race detection in OpenMP programs.
|
* race detection in OpenMP programs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
|
|
@ -20,44 +19,90 @@
|
||||||
typedef unsigned long uptr;
|
typedef unsigned long uptr;
|
||||||
typedef signed long sptr;
|
typedef signed long sptr;
|
||||||
|
|
||||||
extern "C" __attribute__((weak)) void AnnotateHappensBefore(const char *f, int l, uptr addr) {}
|
extern "C" __attribute__((weak)) void AnnotateHappensBefore(const char *f,
|
||||||
extern "C" __attribute__((weak)) void AnnotateHappensAfter(const char *f, int l, uptr addr) {}
|
int l, uptr addr) {}
|
||||||
extern "C" __attribute__((weak)) void AnnotateCondVarSignal(const char *f, int l, uptr cv) {}
|
extern "C" __attribute__((weak)) void AnnotateHappensAfter(const char *f, int l,
|
||||||
extern "C" __attribute__((weak)) void AnnotateCondVarSignalAll(const char *f, int l, uptr cv) {}
|
uptr addr) {}
|
||||||
extern "C" __attribute__((weak)) void AnnotateMutexIsNotPHB(const char *f, int l, uptr mu) {}
|
extern "C" __attribute__((weak)) void AnnotateCondVarSignal(const char *f,
|
||||||
extern "C" __attribute__((weak)) void AnnotateCondVarWait(const char *f, int l, uptr cv, uptr lock) {}
|
int l, uptr cv) {}
|
||||||
extern "C" __attribute__((weak)) void AnnotateRWLockCreate(const char *f, int l, uptr m) {}
|
extern "C" __attribute__((weak)) void AnnotateCondVarSignalAll(const char *f,
|
||||||
extern "C" __attribute__((weak)) void AnnotateRWLockCreateStatic(const char *f, int l, uptr m) {}
|
int l, uptr cv) {
|
||||||
extern "C" __attribute__((weak)) void AnnotateRWLockDestroy(const char *f, int l, uptr m) {}
|
}
|
||||||
extern "C" __attribute__((weak)) void AnnotateRWLockAcquired(const char *f, int l, uptr m, uptr is_w) {}
|
extern "C" __attribute__((weak)) void AnnotateMutexIsNotPHB(const char *f,
|
||||||
extern "C" __attribute__((weak)) void AnnotateRWLockReleased(const char *f, int l, uptr m, uptr is_w) {}
|
int l, uptr mu) {}
|
||||||
extern "C" __attribute__((weak)) void AnnotateTraceMemory(const char *f, int l, uptr mem) {}
|
extern "C" __attribute__((weak)) void AnnotateCondVarWait(const char *f, int l,
|
||||||
extern "C" __attribute__((weak)) void AnnotateFlushState(const char *f, int l) {}
|
uptr cv, uptr lock) {}
|
||||||
extern "C" __attribute__((weak)) void AnnotateNewMemory(const char *f, int l, uptr mem, uptr size) {}
|
extern "C" __attribute__((weak)) void AnnotateRWLockCreate(const char *f, int l,
|
||||||
extern "C" __attribute__((weak)) void AnnotateNoOp(const char *f, int l, uptr mem) {}
|
uptr m) {}
|
||||||
extern "C" __attribute__((weak)) void AnnotateFlushExpectedRaces(const char *f, int l) {}
|
extern "C" __attribute__((weak)) void
|
||||||
extern "C" __attribute__((weak)) void AnnotateEnableRaceDetection( const char *f, int l, int enable) {}
|
AnnotateRWLockCreateStatic(const char *f, int l, uptr m) {}
|
||||||
extern "C" __attribute__((weak)) void AnnotateMutexIsUsedAsCondVar( const char *f, int l, uptr mu) {}
|
extern "C" __attribute__((weak)) void AnnotateRWLockDestroy(const char *f,
|
||||||
extern "C" __attribute__((weak)) void AnnotatePCQGet( const char *f, int l, uptr pcq) {}
|
int l, uptr m) {}
|
||||||
extern "C" __attribute__((weak)) void AnnotatePCQPut( const char *f, int l, uptr pcq) {}
|
extern "C" __attribute__((weak)) void
|
||||||
extern "C" __attribute__((weak)) void AnnotatePCQDestroy( const char *f, int l, uptr pcq) {}
|
AnnotateRWLockAcquired(const char *f, int l, uptr m, uptr is_w) {}
|
||||||
extern "C" __attribute__((weak)) void AnnotatePCQCreate( const char *f, int l, uptr pcq) {}
|
extern "C" __attribute__((weak)) void
|
||||||
extern "C" __attribute__((weak)) void AnnotateExpectRace( const char *f, int l, uptr mem, char *desc) {}
|
AnnotateRWLockReleased(const char *f, int l, uptr m, uptr is_w) {}
|
||||||
extern "C" __attribute__((weak)) void AnnotateBenignRaceSized( const char *f, int l, uptr mem, uptr size, char *desc) {}
|
extern "C" __attribute__((weak)) void AnnotateTraceMemory(const char *f, int l,
|
||||||
extern "C" __attribute__((weak)) void AnnotateBenignRace( const char *f, int l, uptr mem, char *desc) {}
|
uptr mem) {}
|
||||||
extern "C" __attribute__((weak)) void AnnotateIgnoreReadsBegin(const char *f, int l) {}
|
extern "C" __attribute__((weak)) void AnnotateFlushState(const char *f, int l) {
|
||||||
extern "C" __attribute__((weak)) void AnnotateIgnoreReadsEnd(const char *f, int l) {}
|
}
|
||||||
extern "C" __attribute__((weak)) void AnnotateIgnoreWritesBegin(const char *f, int l) {}
|
extern "C" __attribute__((weak)) void AnnotateNewMemory(const char *f, int l,
|
||||||
extern "C" __attribute__((weak)) void AnnotateIgnoreWritesEnd(const char *f, int l) {}
|
uptr mem, uptr size) {}
|
||||||
extern "C" __attribute__((weak)) void AnnotateIgnoreSyncBegin(const char *f, int l) {}
|
extern "C" __attribute__((weak)) void AnnotateNoOp(const char *f, int l,
|
||||||
extern "C" __attribute__((weak)) void AnnotateIgnoreSyncEnd(const char *f, int l) {}
|
uptr mem) {}
|
||||||
extern "C" __attribute__((weak)) void AnnotatePublishMemoryRange( const char *f, int l, uptr addr, uptr size) {}
|
extern "C" __attribute__((weak)) void AnnotateFlushExpectedRaces(const char *f,
|
||||||
extern "C" __attribute__((weak)) void AnnotateUnpublishMemoryRange( const char *f, int l, uptr addr, uptr size) {}
|
int l) {}
|
||||||
extern "C" __attribute__((weak)) void AnnotateThreadName( const char *f, int l, char *name) {}
|
extern "C" __attribute__((weak)) void
|
||||||
extern "C" __attribute__((weak)) void WTFAnnotateHappensBefore(const char *f, int l, uptr addr) {}
|
AnnotateEnableRaceDetection(const char *f, int l, int enable) {}
|
||||||
extern "C" __attribute__((weak)) void WTFAnnotateHappensAfter(const char *f, int l, uptr addr) {}
|
extern "C" __attribute__((weak)) void
|
||||||
extern "C" __attribute__((weak)) void WTFAnnotateBenignRaceSized( const char *f, int l, uptr mem, uptr sz, char *desc) {}
|
AnnotateMutexIsUsedAsCondVar(const char *f, int l, uptr mu) {}
|
||||||
extern "C" __attribute__((weak)) int RunningOnValgrind() {return 0;}
|
extern "C" __attribute__((weak)) void AnnotatePCQGet(const char *f, int l,
|
||||||
extern "C" __attribute__((weak)) double ValgrindSlowdown(void) {return 0;}
|
uptr pcq) {}
|
||||||
extern "C" __attribute__((weak)) const char __attribute__((weak))* ThreadSanitizerQuery(const char *query) {return 0;}
|
extern "C" __attribute__((weak)) void AnnotatePCQPut(const char *f, int l,
|
||||||
extern "C" __attribute__((weak)) void AnnotateMemoryIsInitialized(const char *f, int l, uptr mem, uptr sz) {}
|
uptr pcq) {}
|
||||||
|
extern "C" __attribute__((weak)) void AnnotatePCQDestroy(const char *f, int l,
|
||||||
|
uptr pcq) {}
|
||||||
|
extern "C" __attribute__((weak)) void AnnotatePCQCreate(const char *f, int l,
|
||||||
|
uptr pcq) {}
|
||||||
|
extern "C" __attribute__((weak)) void AnnotateExpectRace(const char *f, int l,
|
||||||
|
uptr mem, char *desc) {
|
||||||
|
}
|
||||||
|
extern "C" __attribute__((weak)) void
|
||||||
|
AnnotateBenignRaceSized(const char *f, int l, uptr mem, uptr size, char *desc) {
|
||||||
|
}
|
||||||
|
extern "C" __attribute__((weak)) void AnnotateBenignRace(const char *f, int l,
|
||||||
|
uptr mem, char *desc) {
|
||||||
|
}
|
||||||
|
extern "C" __attribute__((weak)) void AnnotateIgnoreReadsBegin(const char *f,
|
||||||
|
int l) {}
|
||||||
|
extern "C" __attribute__((weak)) void AnnotateIgnoreReadsEnd(const char *f,
|
||||||
|
int l) {}
|
||||||
|
extern "C" __attribute__((weak)) void AnnotateIgnoreWritesBegin(const char *f,
|
||||||
|
int l) {}
|
||||||
|
extern "C" __attribute__((weak)) void AnnotateIgnoreWritesEnd(const char *f,
|
||||||
|
int l) {}
|
||||||
|
extern "C" __attribute__((weak)) void AnnotateIgnoreSyncBegin(const char *f,
|
||||||
|
int l) {}
|
||||||
|
extern "C" __attribute__((weak)) void AnnotateIgnoreSyncEnd(const char *f,
|
||||||
|
int l) {}
|
||||||
|
extern "C" __attribute__((weak)) void
|
||||||
|
AnnotatePublishMemoryRange(const char *f, int l, uptr addr, uptr size) {}
|
||||||
|
extern "C" __attribute__((weak)) void
|
||||||
|
AnnotateUnpublishMemoryRange(const char *f, int l, uptr addr, uptr size) {}
|
||||||
|
extern "C" __attribute__((weak)) void AnnotateThreadName(const char *f, int l,
|
||||||
|
char *name) {}
|
||||||
|
extern "C" __attribute__((weak)) void
|
||||||
|
WTFAnnotateHappensBefore(const char *f, int l, uptr addr) {}
|
||||||
|
extern "C" __attribute__((weak)) void
|
||||||
|
WTFAnnotateHappensAfter(const char *f, int l, uptr addr) {}
|
||||||
|
extern "C" __attribute__((weak)) void
|
||||||
|
WTFAnnotateBenignRaceSized(const char *f, int l, uptr mem, uptr sz,
|
||||||
|
char *desc) {}
|
||||||
|
extern "C" __attribute__((weak)) int RunningOnValgrind() { return 0; }
|
||||||
|
extern "C" __attribute__((weak)) double ValgrindSlowdown(void) { return 0; }
|
||||||
|
extern "C" __attribute__((weak)) const char __attribute__((weak)) *
|
||||||
|
ThreadSanitizerQuery(const char *query) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
extern "C" __attribute__((weak)) void
|
||||||
|
AnnotateMemoryIsInitialized(const char *f, int l, uptr mem, uptr sz) {}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
* race detection in OpenMP programs.
|
* race detection in OpenMP programs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
|
|
@ -44,30 +43,32 @@ void AnnotateFlushState(const char *f, int l);
|
||||||
void AnnotateNewMemory(const char *f, int l, uptr mem, uptr size);
|
void AnnotateNewMemory(const char *f, int l, uptr mem, uptr size);
|
||||||
void AnnotateNoOp(const char *f, int l, uptr mem);
|
void AnnotateNoOp(const char *f, int l, uptr mem);
|
||||||
void AnnotateFlushExpectedRaces(const char *f, int l);
|
void AnnotateFlushExpectedRaces(const char *f, int l);
|
||||||
void AnnotateEnableRaceDetection( const char *f, int l, int enable);
|
void AnnotateEnableRaceDetection(const char *f, int l, int enable);
|
||||||
void AnnotateMutexIsUsedAsCondVar( const char *f, int l, uptr mu);
|
void AnnotateMutexIsUsedAsCondVar(const char *f, int l, uptr mu);
|
||||||
void AnnotatePCQGet( const char *f, int l, uptr pcq);
|
void AnnotatePCQGet(const char *f, int l, uptr pcq);
|
||||||
void AnnotatePCQPut( const char *f, int l, uptr pcq);
|
void AnnotatePCQPut(const char *f, int l, uptr pcq);
|
||||||
void AnnotatePCQDestroy( const char *f, int l, uptr pcq);
|
void AnnotatePCQDestroy(const char *f, int l, uptr pcq);
|
||||||
void AnnotatePCQCreate( const char *f, int l, uptr pcq);
|
void AnnotatePCQCreate(const char *f, int l, uptr pcq);
|
||||||
void AnnotateExpectRace( const char *f, int l, uptr mem, char *desc);
|
void AnnotateExpectRace(const char *f, int l, uptr mem, char *desc);
|
||||||
void AnnotateBenignRaceSized( const char *f, int l, uptr mem, uptr size, char *desc);
|
void AnnotateBenignRaceSized(const char *f, int l, uptr mem, uptr size,
|
||||||
void AnnotateBenignRace( const char *f, int l, uptr mem, char *desc);
|
char *desc);
|
||||||
|
void AnnotateBenignRace(const char *f, int l, uptr mem, char *desc);
|
||||||
void AnnotateIgnoreReadsBegin(const char *f, int l);
|
void AnnotateIgnoreReadsBegin(const char *f, int l);
|
||||||
void AnnotateIgnoreReadsEnd(const char *f, int l);
|
void AnnotateIgnoreReadsEnd(const char *f, int l);
|
||||||
void AnnotateIgnoreWritesBegin(const char *f, int l);
|
void AnnotateIgnoreWritesBegin(const char *f, int l);
|
||||||
void AnnotateIgnoreWritesEnd(const char *f, int l);
|
void AnnotateIgnoreWritesEnd(const char *f, int l);
|
||||||
void AnnotateIgnoreSyncBegin(const char *f, int l);
|
void AnnotateIgnoreSyncBegin(const char *f, int l);
|
||||||
void AnnotateIgnoreSyncEnd(const char *f, int l);
|
void AnnotateIgnoreSyncEnd(const char *f, int l);
|
||||||
void AnnotatePublishMemoryRange( const char *f, int l, uptr addr, uptr size);
|
void AnnotatePublishMemoryRange(const char *f, int l, uptr addr, uptr size);
|
||||||
void AnnotateUnpublishMemoryRange( const char *f, int l, uptr addr, uptr size);
|
void AnnotateUnpublishMemoryRange(const char *f, int l, uptr addr, uptr size);
|
||||||
void AnnotateThreadName( const char *f, int l, char *name);
|
void AnnotateThreadName(const char *f, int l, char *name);
|
||||||
void WTFAnnotateHappensBefore(const char *f, int l, uptr addr);
|
void WTFAnnotateHappensBefore(const char *f, int l, uptr addr);
|
||||||
void WTFAnnotateHappensAfter(const char *f, int l, uptr addr);
|
void WTFAnnotateHappensAfter(const char *f, int l, uptr addr);
|
||||||
void WTFAnnotateBenignRaceSized( const char *f, int l, uptr mem, uptr sz, char *desc);
|
void WTFAnnotateBenignRaceSized(const char *f, int l, uptr mem, uptr sz,
|
||||||
|
char *desc);
|
||||||
int RunningOnValgrind();
|
int RunningOnValgrind();
|
||||||
double ValgrindSlowdown(void);
|
double ValgrindSlowdown(void);
|
||||||
const char * ThreadSanitizerQuery(const char *query);
|
const char *ThreadSanitizerQuery(const char *query);
|
||||||
void AnnotateMemoryIsInitialized(const char *f, int l, uptr mem, uptr sz);
|
void AnnotateMemoryIsInitialized(const char *f, int l, uptr mem, uptr sz);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
@ -75,17 +76,27 @@ void AnnotateMemoryIsInitialized(const char *f, int l, uptr mem, uptr sz);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TSAN_SUPPORT
|
#ifdef TSAN_SUPPORT
|
||||||
#define ANNOTATE_HAPPENS_AFTER(addr) AnnotateHappensAfter(__FILE__, __LINE__, (uptr)addr)
|
#define ANNOTATE_HAPPENS_AFTER(addr) \
|
||||||
#define ANNOTATE_HAPPENS_BEFORE(addr) AnnotateHappensBefore(__FILE__, __LINE__, (uptr)addr)
|
AnnotateHappensAfter(__FILE__, __LINE__, (uptr)addr)
|
||||||
#define ANNOTATE_IGNORE_WRITES_BEGIN() AnnotateIgnoreWritesBegin(__FILE__, __LINE__)
|
#define ANNOTATE_HAPPENS_BEFORE(addr) \
|
||||||
|
AnnotateHappensBefore(__FILE__, __LINE__, (uptr)addr)
|
||||||
|
#define ANNOTATE_IGNORE_WRITES_BEGIN() \
|
||||||
|
AnnotateIgnoreWritesBegin(__FILE__, __LINE__)
|
||||||
#define ANNOTATE_IGNORE_WRITES_END() AnnotateIgnoreWritesEnd(__FILE__, __LINE__)
|
#define ANNOTATE_IGNORE_WRITES_END() AnnotateIgnoreWritesEnd(__FILE__, __LINE__)
|
||||||
#define ANNOTATE_RWLOCK_CREATE(lck) AnnotateRWLockCreate(__FILE__, __LINE__, (uptr)lck)
|
#define ANNOTATE_RWLOCK_CREATE(lck) \
|
||||||
#define ANNOTATE_RWLOCK_RELEASED(lck) AnnotateRWLockAcquired(__FILE__, __LINE__, (uptr)lck, 1)
|
AnnotateRWLockCreate(__FILE__, __LINE__, (uptr)lck)
|
||||||
#define ANNOTATE_RWLOCK_ACQUIRED(lck) AnnotateRWLockReleased(__FILE__, __LINE__, (uptr)lck, 1)
|
#define ANNOTATE_RWLOCK_RELEASED(lck) \
|
||||||
#define ANNOTATE_BARRIER_BEGIN(addr) AnnotateHappensBefore(__FILE__, __LINE__, (uptr)addr)
|
AnnotateRWLockAcquired(__FILE__, __LINE__, (uptr)lck, 1)
|
||||||
#define ANNOTATE_BARRIER_END(addr) AnnotateHappensAfter(__FILE__, __LINE__, (uptr)addr)
|
#define ANNOTATE_RWLOCK_ACQUIRED(lck) \
|
||||||
#define ANNOTATE_REDUCE_AFTER(addr) AnnotateHappensAfter(__FILE__, __LINE__, (uptr)addr)
|
AnnotateRWLockReleased(__FILE__, __LINE__, (uptr)lck, 1)
|
||||||
#define ANNOTATE_REDUCE_BEFORE(addr) AnnotateHappensBefore(__FILE__, __LINE__, (uptr)addr)
|
#define ANNOTATE_BARRIER_BEGIN(addr) \
|
||||||
|
AnnotateHappensBefore(__FILE__, __LINE__, (uptr)addr)
|
||||||
|
#define ANNOTATE_BARRIER_END(addr) \
|
||||||
|
AnnotateHappensAfter(__FILE__, __LINE__, (uptr)addr)
|
||||||
|
#define ANNOTATE_REDUCE_AFTER(addr) \
|
||||||
|
AnnotateHappensAfter(__FILE__, __LINE__, (uptr)addr)
|
||||||
|
#define ANNOTATE_REDUCE_BEFORE(addr) \
|
||||||
|
AnnotateHappensBefore(__FILE__, __LINE__, (uptr)addr)
|
||||||
#else
|
#else
|
||||||
#define ANNOTATE_HAPPENS_AFTER(addr)
|
#define ANNOTATE_HAPPENS_AFTER(addr)
|
||||||
#define ANNOTATE_HAPPENS_BEFORE(addr)
|
#define ANNOTATE_HAPPENS_BEFORE(addr)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
|
||||||
|
|
||||||
# if KMP_MIC
|
# if KMP_MIC
|
||||||
//
|
|
||||||
// the 'delay r16/r32/r64' should be used instead of the 'pause'.
|
// the 'delay r16/r32/r64' should be used instead of the 'pause'.
|
||||||
// The delay operation has the effect of removing the current thread from
|
// The delay operation has the effect of removing the current thread from
|
||||||
// the round-robin HT mechanism, and therefore speeds up the issue rate of
|
// the round-robin HT mechanism, and therefore speeds up the issue rate of
|
||||||
|
|
@ -70,9 +69,10 @@
|
||||||
KMP_PREFIX_UNDERSCORE($0):
|
KMP_PREFIX_UNDERSCORE($0):
|
||||||
.endmacro
|
.endmacro
|
||||||
# else // KMP_OS_DARWIN
|
# else // KMP_OS_DARWIN
|
||||||
# define KMP_PREFIX_UNDERSCORE(x) x // no extra underscore for Linux* OS symbols
|
# define KMP_PREFIX_UNDERSCORE(x) x //no extra underscore for Linux* OS symbols
|
||||||
// Format labels so that they don't override function names in gdb's backtraces
|
// Format labels so that they don't override function names in gdb's backtraces
|
||||||
// MIC assembler doesn't accept .L syntax, the L works fine there (as well as on OS X*)
|
// MIC assembler doesn't accept .L syntax, the L works fine there (as well as
|
||||||
|
// on OS X*)
|
||||||
# if KMP_MIC
|
# if KMP_MIC
|
||||||
# define KMP_LABEL(x) L_##x // local label
|
# define KMP_LABEL(x) L_##x // local label
|
||||||
# else
|
# else
|
||||||
|
|
@ -163,12 +163,10 @@ KMP_PREFIX_UNDERSCORE(\proc):
|
||||||
|
|
||||||
#ifdef KMP_GOMP_COMPAT
|
#ifdef KMP_GOMP_COMPAT
|
||||||
|
|
||||||
//
|
|
||||||
// Support for unnamed common blocks.
|
// Support for unnamed common blocks.
|
||||||
//
|
//
|
||||||
// Because the symbol ".gomp_critical_user_" contains a ".", we have to
|
// Because the symbol ".gomp_critical_user_" contains a ".", we have to
|
||||||
// put this stuff in assembly.
|
// put this stuff in assembly.
|
||||||
//
|
|
||||||
|
|
||||||
# if KMP_ARCH_X86
|
# if KMP_ARCH_X86
|
||||||
# if KMP_OS_DARWIN
|
# if KMP_OS_DARWIN
|
||||||
|
|
@ -221,14 +219,12 @@ __kmp_unnamed_critical_addr:
|
||||||
// microtasking routines specifically written for IA-32 architecture
|
// microtasking routines specifically written for IA-32 architecture
|
||||||
// running Linux* OS
|
// running Linux* OS
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
//
|
|
||||||
|
|
||||||
.ident "Intel Corporation"
|
.ident "Intel Corporation"
|
||||||
.data
|
.data
|
||||||
ALIGN 4
|
ALIGN 4
|
||||||
// void
|
// void
|
||||||
// __kmp_x86_pause( void );
|
// __kmp_x86_pause( void );
|
||||||
//
|
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_x86_pause
|
PROC __kmp_x86_pause
|
||||||
|
|
@ -238,10 +234,9 @@ __kmp_unnamed_critical_addr:
|
||||||
|
|
||||||
DEBUG_INFO __kmp_x86_pause
|
DEBUG_INFO __kmp_x86_pause
|
||||||
|
|
||||||
//
|
|
||||||
// void
|
// void
|
||||||
// __kmp_x86_cpuid( int mode, int mode2, void *cpuid_buffer );
|
// __kmp_x86_cpuid( int mode, int mode2, void *cpuid_buffer );
|
||||||
//
|
|
||||||
PROC __kmp_x86_cpuid
|
PROC __kmp_x86_cpuid
|
||||||
|
|
||||||
pushl %ebp
|
pushl %ebp
|
||||||
|
|
@ -275,10 +270,8 @@ __kmp_unnamed_critical_addr:
|
||||||
# if !KMP_ASM_INTRINS
|
# if !KMP_ASM_INTRINS
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// kmp_int32
|
// kmp_int32
|
||||||
// __kmp_test_then_add32( volatile kmp_int32 *p, kmp_int32 d );
|
// __kmp_test_then_add32( volatile kmp_int32 *p, kmp_int32 d );
|
||||||
//
|
|
||||||
|
|
||||||
PROC __kmp_test_then_add32
|
PROC __kmp_test_then_add32
|
||||||
|
|
||||||
|
|
@ -291,7 +284,6 @@ __kmp_unnamed_critical_addr:
|
||||||
DEBUG_INFO __kmp_test_then_add32
|
DEBUG_INFO __kmp_test_then_add32
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_xchg_fixed8
|
// FUNCTION __kmp_xchg_fixed8
|
||||||
//
|
//
|
||||||
// kmp_int32
|
// kmp_int32
|
||||||
|
|
@ -302,7 +294,6 @@ __kmp_unnamed_critical_addr:
|
||||||
// d: 8(%esp)
|
// d: 8(%esp)
|
||||||
//
|
//
|
||||||
// return: %al
|
// return: %al
|
||||||
|
|
||||||
PROC __kmp_xchg_fixed8
|
PROC __kmp_xchg_fixed8
|
||||||
|
|
||||||
movl 4(%esp), %ecx // "p"
|
movl 4(%esp), %ecx // "p"
|
||||||
|
|
@ -316,7 +307,6 @@ __kmp_unnamed_critical_addr:
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_xchg_fixed16
|
// FUNCTION __kmp_xchg_fixed16
|
||||||
//
|
//
|
||||||
// kmp_int16
|
// kmp_int16
|
||||||
|
|
@ -326,7 +316,6 @@ __kmp_unnamed_critical_addr:
|
||||||
// p: 4(%esp)
|
// p: 4(%esp)
|
||||||
// d: 8(%esp)
|
// d: 8(%esp)
|
||||||
// return: %ax
|
// return: %ax
|
||||||
|
|
||||||
PROC __kmp_xchg_fixed16
|
PROC __kmp_xchg_fixed16
|
||||||
|
|
||||||
movl 4(%esp), %ecx // "p"
|
movl 4(%esp), %ecx // "p"
|
||||||
|
|
@ -340,7 +329,6 @@ __kmp_unnamed_critical_addr:
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_xchg_fixed32
|
// FUNCTION __kmp_xchg_fixed32
|
||||||
//
|
//
|
||||||
// kmp_int32
|
// kmp_int32
|
||||||
|
|
@ -351,7 +339,6 @@ __kmp_unnamed_critical_addr:
|
||||||
// d: 8(%esp)
|
// d: 8(%esp)
|
||||||
//
|
//
|
||||||
// return: %eax
|
// return: %eax
|
||||||
|
|
||||||
PROC __kmp_xchg_fixed32
|
PROC __kmp_xchg_fixed32
|
||||||
|
|
||||||
movl 4(%esp), %ecx // "p"
|
movl 4(%esp), %ecx // "p"
|
||||||
|
|
@ -364,11 +351,8 @@ __kmp_unnamed_critical_addr:
|
||||||
DEBUG_INFO __kmp_xchg_fixed32
|
DEBUG_INFO __kmp_xchg_fixed32
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// kmp_int8
|
// kmp_int8
|
||||||
// __kmp_compare_and_store8( volatile kmp_int8 *p, kmp_int8 cv, kmp_int8 sv );
|
// __kmp_compare_and_store8( volatile kmp_int8 *p, kmp_int8 cv, kmp_int8 sv );
|
||||||
//
|
|
||||||
|
|
||||||
PROC __kmp_compare_and_store8
|
PROC __kmp_compare_and_store8
|
||||||
|
|
||||||
movl 4(%esp), %ecx
|
movl 4(%esp), %ecx
|
||||||
|
|
@ -382,11 +366,8 @@ __kmp_unnamed_critical_addr:
|
||||||
|
|
||||||
DEBUG_INFO __kmp_compare_and_store8
|
DEBUG_INFO __kmp_compare_and_store8
|
||||||
|
|
||||||
//
|
|
||||||
// kmp_int16
|
// kmp_int16
|
||||||
// __kmp_compare_and_store16( volatile kmp_int16 *p, kmp_int16 cv, kmp_int16 sv );
|
// __kmp_compare_and_store16(volatile kmp_int16 *p, kmp_int16 cv, kmp_int16 sv);
|
||||||
//
|
|
||||||
|
|
||||||
PROC __kmp_compare_and_store16
|
PROC __kmp_compare_and_store16
|
||||||
|
|
||||||
movl 4(%esp), %ecx
|
movl 4(%esp), %ecx
|
||||||
|
|
@ -400,11 +381,8 @@ __kmp_unnamed_critical_addr:
|
||||||
|
|
||||||
DEBUG_INFO __kmp_compare_and_store16
|
DEBUG_INFO __kmp_compare_and_store16
|
||||||
|
|
||||||
//
|
|
||||||
// kmp_int32
|
// kmp_int32
|
||||||
// __kmp_compare_and_store32( volatile kmp_int32 *p, kmp_int32 cv, kmp_int32 sv );
|
// __kmp_compare_and_store32(volatile kmp_int32 *p, kmp_int32 cv, kmp_int32 sv);
|
||||||
//
|
|
||||||
|
|
||||||
PROC __kmp_compare_and_store32
|
PROC __kmp_compare_and_store32
|
||||||
|
|
||||||
movl 4(%esp), %ecx
|
movl 4(%esp), %ecx
|
||||||
|
|
@ -418,10 +396,8 @@ __kmp_unnamed_critical_addr:
|
||||||
|
|
||||||
DEBUG_INFO __kmp_compare_and_store32
|
DEBUG_INFO __kmp_compare_and_store32
|
||||||
|
|
||||||
//
|
|
||||||
// kmp_int32
|
// kmp_int32
|
||||||
// __kmp_compare_and_store64( volatile kmp_int64 *p, kmp_int64 cv, kmp_int64 sv );
|
// __kmp_compare_and_store64(volatile kmp_int64 *p, kmp_int64 cv, kmp_int64 s );
|
||||||
//
|
|
||||||
PROC __kmp_compare_and_store64
|
PROC __kmp_compare_and_store64
|
||||||
|
|
||||||
pushl %ebp
|
pushl %ebp
|
||||||
|
|
@ -445,11 +421,8 @@ __kmp_unnamed_critical_addr:
|
||||||
|
|
||||||
DEBUG_INFO __kmp_compare_and_store64
|
DEBUG_INFO __kmp_compare_and_store64
|
||||||
|
|
||||||
//
|
|
||||||
// kmp_int8
|
// kmp_int8
|
||||||
// __kmp_compare_and_store_ret8( volatile kmp_int8 *p, kmp_int8 cv, kmp_int8 sv );
|
// __kmp_compare_and_store_ret8(volatile kmp_int8 *p, kmp_int8 cv, kmp_int8 sv);
|
||||||
//
|
|
||||||
|
|
||||||
PROC __kmp_compare_and_store_ret8
|
PROC __kmp_compare_and_store_ret8
|
||||||
|
|
||||||
movl 4(%esp), %ecx
|
movl 4(%esp), %ecx
|
||||||
|
|
@ -461,11 +434,9 @@ __kmp_unnamed_critical_addr:
|
||||||
|
|
||||||
DEBUG_INFO __kmp_compare_and_store_ret8
|
DEBUG_INFO __kmp_compare_and_store_ret8
|
||||||
|
|
||||||
//
|
|
||||||
// kmp_int16
|
// kmp_int16
|
||||||
// __kmp_compare_and_store_ret16( volatile kmp_int16 *p, kmp_int16 cv, kmp_int16 sv );
|
// __kmp_compare_and_store_ret16(volatile kmp_int16 *p, kmp_int16 cv,
|
||||||
//
|
// kmp_int16 sv);
|
||||||
|
|
||||||
PROC __kmp_compare_and_store_ret16
|
PROC __kmp_compare_and_store_ret16
|
||||||
|
|
||||||
movl 4(%esp), %ecx
|
movl 4(%esp), %ecx
|
||||||
|
|
@ -477,11 +448,9 @@ __kmp_unnamed_critical_addr:
|
||||||
|
|
||||||
DEBUG_INFO __kmp_compare_and_store_ret16
|
DEBUG_INFO __kmp_compare_and_store_ret16
|
||||||
|
|
||||||
//
|
|
||||||
// kmp_int32
|
// kmp_int32
|
||||||
// __kmp_compare_and_store_ret32( volatile kmp_int32 *p, kmp_int32 cv, kmp_int32 sv );
|
// __kmp_compare_and_store_ret32(volatile kmp_int32 *p, kmp_int32 cv,
|
||||||
//
|
// kmp_int32 sv);
|
||||||
|
|
||||||
PROC __kmp_compare_and_store_ret32
|
PROC __kmp_compare_and_store_ret32
|
||||||
|
|
||||||
movl 4(%esp), %ecx
|
movl 4(%esp), %ecx
|
||||||
|
|
@ -493,10 +462,9 @@ __kmp_unnamed_critical_addr:
|
||||||
|
|
||||||
DEBUG_INFO __kmp_compare_and_store_ret32
|
DEBUG_INFO __kmp_compare_and_store_ret32
|
||||||
|
|
||||||
//
|
|
||||||
// kmp_int64
|
// kmp_int64
|
||||||
// __kmp_compare_and_store_ret64( volatile kmp_int64 *p, kmp_int64 cv, kmp_int64 sv );
|
// __kmp_compare_and_store_ret64(volatile kmp_int64 *p, kmp_int64 cv,
|
||||||
//
|
// kmp_int64 sv);
|
||||||
PROC __kmp_compare_and_store_ret64
|
PROC __kmp_compare_and_store_ret64
|
||||||
|
|
||||||
pushl %ebp
|
pushl %ebp
|
||||||
|
|
@ -520,7 +488,6 @@ __kmp_unnamed_critical_addr:
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_xchg_real32
|
// FUNCTION __kmp_xchg_real32
|
||||||
//
|
//
|
||||||
// kmp_real32
|
// kmp_real32
|
||||||
|
|
@ -531,8 +498,6 @@ __kmp_unnamed_critical_addr:
|
||||||
// data: 8(%esp)
|
// data: 8(%esp)
|
||||||
//
|
//
|
||||||
// return: %eax
|
// return: %eax
|
||||||
|
|
||||||
|
|
||||||
PROC __kmp_xchg_real32
|
PROC __kmp_xchg_real32
|
||||||
|
|
||||||
pushl %ebp
|
pushl %ebp
|
||||||
|
|
@ -565,7 +530,6 @@ __kmp_unnamed_critical_addr:
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_load_x87_fpu_control_word
|
// FUNCTION __kmp_load_x87_fpu_control_word
|
||||||
//
|
//
|
||||||
// void
|
// void
|
||||||
|
|
@ -573,8 +537,6 @@ __kmp_unnamed_critical_addr:
|
||||||
//
|
//
|
||||||
// parameters:
|
// parameters:
|
||||||
// p: 4(%esp)
|
// p: 4(%esp)
|
||||||
//
|
|
||||||
|
|
||||||
PROC __kmp_load_x87_fpu_control_word
|
PROC __kmp_load_x87_fpu_control_word
|
||||||
|
|
||||||
movl 4(%esp), %eax
|
movl 4(%esp), %eax
|
||||||
|
|
@ -585,7 +547,6 @@ __kmp_unnamed_critical_addr:
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_store_x87_fpu_control_word
|
// FUNCTION __kmp_store_x87_fpu_control_word
|
||||||
//
|
//
|
||||||
// void
|
// void
|
||||||
|
|
@ -593,8 +554,6 @@ __kmp_unnamed_critical_addr:
|
||||||
//
|
//
|
||||||
// parameters:
|
// parameters:
|
||||||
// p: 4(%esp)
|
// p: 4(%esp)
|
||||||
//
|
|
||||||
|
|
||||||
PROC __kmp_store_x87_fpu_control_word
|
PROC __kmp_store_x87_fpu_control_word
|
||||||
|
|
||||||
movl 4(%esp), %eax
|
movl 4(%esp), %eax
|
||||||
|
|
@ -605,14 +564,10 @@ __kmp_unnamed_critical_addr:
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_clear_x87_fpu_status_word
|
// FUNCTION __kmp_clear_x87_fpu_status_word
|
||||||
//
|
//
|
||||||
// void
|
// void
|
||||||
// __kmp_clear_x87_fpu_status_word();
|
// __kmp_clear_x87_fpu_status_word();
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
PROC __kmp_clear_x87_fpu_status_word
|
PROC __kmp_clear_x87_fpu_status_word
|
||||||
|
|
||||||
fnclex
|
fnclex
|
||||||
|
|
@ -622,7 +577,6 @@ __kmp_unnamed_critical_addr:
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// typedef void (*microtask_t)( int *gtid, int *tid, ... );
|
// typedef void (*microtask_t)( int *gtid, int *tid, ... );
|
||||||
//
|
//
|
||||||
// int
|
// int
|
||||||
|
|
@ -714,7 +668,6 @@ KMP_LABEL(invoke_3):
|
||||||
DEBUG_INFO __kmp_hardware_timestamp
|
DEBUG_INFO __kmp_hardware_timestamp
|
||||||
// -- End __kmp_hardware_timestamp
|
// -- End __kmp_hardware_timestamp
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
#endif /* KMP_ARCH_X86 */
|
#endif /* KMP_ARCH_X86 */
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -732,9 +685,9 @@ KMP_LABEL(invoke_3):
|
||||||
.data
|
.data
|
||||||
ALIGN 4
|
ALIGN 4
|
||||||
|
|
||||||
// To prevent getting our code into .data section .text added to every routine definition for x86_64.
|
// To prevent getting our code into .data section .text added to every routine
|
||||||
|
// definition for x86_64.
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_x86_cpuid
|
// FUNCTION __kmp_x86_cpuid
|
||||||
//
|
//
|
||||||
// void
|
// void
|
||||||
|
|
@ -744,7 +697,6 @@ KMP_LABEL(invoke_3):
|
||||||
// mode: %edi
|
// mode: %edi
|
||||||
// mode2: %esi
|
// mode2: %esi
|
||||||
// cpuid_buffer: %rdx
|
// cpuid_buffer: %rdx
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_x86_cpuid
|
PROC __kmp_x86_cpuid
|
||||||
|
|
||||||
|
|
@ -774,7 +726,6 @@ KMP_LABEL(invoke_3):
|
||||||
# if !KMP_ASM_INTRINS
|
# if !KMP_ASM_INTRINS
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_test_then_add32
|
// FUNCTION __kmp_test_then_add32
|
||||||
//
|
//
|
||||||
// kmp_int32
|
// kmp_int32
|
||||||
|
|
@ -785,7 +736,6 @@ KMP_LABEL(invoke_3):
|
||||||
// d: %esi
|
// d: %esi
|
||||||
//
|
//
|
||||||
// return: %eax
|
// return: %eax
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_test_then_add32
|
PROC __kmp_test_then_add32
|
||||||
|
|
||||||
|
|
@ -798,7 +748,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_test_then_add64
|
// FUNCTION __kmp_test_then_add64
|
||||||
//
|
//
|
||||||
// kmp_int64
|
// kmp_int64
|
||||||
|
|
@ -808,7 +757,6 @@ KMP_LABEL(invoke_3):
|
||||||
// p: %rdi
|
// p: %rdi
|
||||||
// d: %rsi
|
// d: %rsi
|
||||||
// return: %rax
|
// return: %rax
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_test_then_add64
|
PROC __kmp_test_then_add64
|
||||||
|
|
||||||
|
|
@ -821,7 +769,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_xchg_fixed8
|
// FUNCTION __kmp_xchg_fixed8
|
||||||
//
|
//
|
||||||
// kmp_int32
|
// kmp_int32
|
||||||
|
|
@ -832,7 +779,6 @@ KMP_LABEL(invoke_3):
|
||||||
// d: %sil
|
// d: %sil
|
||||||
//
|
//
|
||||||
// return: %al
|
// return: %al
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_xchg_fixed8
|
PROC __kmp_xchg_fixed8
|
||||||
|
|
||||||
|
|
@ -846,7 +792,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_xchg_fixed16
|
// FUNCTION __kmp_xchg_fixed16
|
||||||
//
|
//
|
||||||
// kmp_int16
|
// kmp_int16
|
||||||
|
|
@ -856,7 +801,6 @@ KMP_LABEL(invoke_3):
|
||||||
// p: %rdi
|
// p: %rdi
|
||||||
// d: %si
|
// d: %si
|
||||||
// return: %ax
|
// return: %ax
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_xchg_fixed16
|
PROC __kmp_xchg_fixed16
|
||||||
|
|
||||||
|
|
@ -870,7 +814,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_xchg_fixed32
|
// FUNCTION __kmp_xchg_fixed32
|
||||||
//
|
//
|
||||||
// kmp_int32
|
// kmp_int32
|
||||||
|
|
@ -881,7 +824,6 @@ KMP_LABEL(invoke_3):
|
||||||
// d: %esi
|
// d: %esi
|
||||||
//
|
//
|
||||||
// return: %eax
|
// return: %eax
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_xchg_fixed32
|
PROC __kmp_xchg_fixed32
|
||||||
|
|
||||||
|
|
@ -895,7 +837,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_xchg_fixed64
|
// FUNCTION __kmp_xchg_fixed64
|
||||||
//
|
//
|
||||||
// kmp_int64
|
// kmp_int64
|
||||||
|
|
@ -905,7 +846,6 @@ KMP_LABEL(invoke_3):
|
||||||
// p: %rdi
|
// p: %rdi
|
||||||
// d: %rsi
|
// d: %rsi
|
||||||
// return: %rax
|
// return: %rax
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_xchg_fixed64
|
PROC __kmp_xchg_fixed64
|
||||||
|
|
||||||
|
|
@ -919,7 +859,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_compare_and_store8
|
// FUNCTION __kmp_compare_and_store8
|
||||||
//
|
//
|
||||||
// kmp_int8
|
// kmp_int8
|
||||||
|
|
@ -931,7 +870,6 @@ KMP_LABEL(invoke_3):
|
||||||
// sv: %edx
|
// sv: %edx
|
||||||
//
|
//
|
||||||
// return: %eax
|
// return: %eax
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_compare_and_store8
|
PROC __kmp_compare_and_store8
|
||||||
|
|
||||||
|
|
@ -946,7 +884,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_compare_and_store16
|
// FUNCTION __kmp_compare_and_store16
|
||||||
//
|
//
|
||||||
// kmp_int16
|
// kmp_int16
|
||||||
|
|
@ -958,7 +895,6 @@ KMP_LABEL(invoke_3):
|
||||||
// sv: %dx
|
// sv: %dx
|
||||||
//
|
//
|
||||||
// return: %eax
|
// return: %eax
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_compare_and_store16
|
PROC __kmp_compare_and_store16
|
||||||
|
|
||||||
|
|
@ -973,7 +909,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_compare_and_store32
|
// FUNCTION __kmp_compare_and_store32
|
||||||
//
|
//
|
||||||
// kmp_int32
|
// kmp_int32
|
||||||
|
|
@ -985,7 +920,6 @@ KMP_LABEL(invoke_3):
|
||||||
// sv: %edx
|
// sv: %edx
|
||||||
//
|
//
|
||||||
// return: %eax
|
// return: %eax
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_compare_and_store32
|
PROC __kmp_compare_and_store32
|
||||||
|
|
||||||
|
|
@ -1000,7 +934,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_compare_and_store64
|
// FUNCTION __kmp_compare_and_store64
|
||||||
//
|
//
|
||||||
// kmp_int32
|
// kmp_int32
|
||||||
|
|
@ -1011,7 +944,6 @@ KMP_LABEL(invoke_3):
|
||||||
// cv: %rsi
|
// cv: %rsi
|
||||||
// sv: %rdx
|
// sv: %rdx
|
||||||
// return: %eax
|
// return: %eax
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_compare_and_store64
|
PROC __kmp_compare_and_store64
|
||||||
|
|
||||||
|
|
@ -1025,7 +957,6 @@ KMP_LABEL(invoke_3):
|
||||||
DEBUG_INFO __kmp_compare_and_store64
|
DEBUG_INFO __kmp_compare_and_store64
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_compare_and_store_ret8
|
// FUNCTION __kmp_compare_and_store_ret8
|
||||||
//
|
//
|
||||||
// kmp_int8
|
// kmp_int8
|
||||||
|
|
@ -1037,7 +968,6 @@ KMP_LABEL(invoke_3):
|
||||||
// sv: %edx
|
// sv: %edx
|
||||||
//
|
//
|
||||||
// return: %eax
|
// return: %eax
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_compare_and_store_ret8
|
PROC __kmp_compare_and_store_ret8
|
||||||
|
|
||||||
|
|
@ -1050,7 +980,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_compare_and_store_ret16
|
// FUNCTION __kmp_compare_and_store_ret16
|
||||||
//
|
//
|
||||||
// kmp_int16
|
// kmp_int16
|
||||||
|
|
@ -1062,7 +991,6 @@ KMP_LABEL(invoke_3):
|
||||||
// sv: %dx
|
// sv: %dx
|
||||||
//
|
//
|
||||||
// return: %eax
|
// return: %eax
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_compare_and_store_ret16
|
PROC __kmp_compare_and_store_ret16
|
||||||
|
|
||||||
|
|
@ -1075,7 +1003,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_compare_and_store_ret32
|
// FUNCTION __kmp_compare_and_store_ret32
|
||||||
//
|
//
|
||||||
// kmp_int32
|
// kmp_int32
|
||||||
|
|
@ -1087,7 +1014,6 @@ KMP_LABEL(invoke_3):
|
||||||
// sv: %edx
|
// sv: %edx
|
||||||
//
|
//
|
||||||
// return: %eax
|
// return: %eax
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_compare_and_store_ret32
|
PROC __kmp_compare_and_store_ret32
|
||||||
|
|
||||||
|
|
@ -1100,7 +1026,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_compare_and_store_ret64
|
// FUNCTION __kmp_compare_and_store_ret64
|
||||||
//
|
//
|
||||||
// kmp_int64
|
// kmp_int64
|
||||||
|
|
@ -1111,7 +1036,6 @@ KMP_LABEL(invoke_3):
|
||||||
// cv: %rsi
|
// cv: %rsi
|
||||||
// sv: %rdx
|
// sv: %rdx
|
||||||
// return: %eax
|
// return: %eax
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_compare_and_store_ret64
|
PROC __kmp_compare_and_store_ret64
|
||||||
|
|
||||||
|
|
@ -1130,7 +1054,6 @@ KMP_LABEL(invoke_3):
|
||||||
# if !KMP_ASM_INTRINS
|
# if !KMP_ASM_INTRINS
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_xchg_real32
|
// FUNCTION __kmp_xchg_real32
|
||||||
//
|
//
|
||||||
// kmp_real32
|
// kmp_real32
|
||||||
|
|
@ -1141,7 +1064,6 @@ KMP_LABEL(invoke_3):
|
||||||
// data: %xmm0 (lower 4 bytes)
|
// data: %xmm0 (lower 4 bytes)
|
||||||
//
|
//
|
||||||
// return: %xmm0 (lower 4 bytes)
|
// return: %xmm0 (lower 4 bytes)
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_xchg_real32
|
PROC __kmp_xchg_real32
|
||||||
|
|
||||||
|
|
@ -1158,7 +1080,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_xchg_real64
|
// FUNCTION __kmp_xchg_real64
|
||||||
//
|
//
|
||||||
// kmp_real64
|
// kmp_real64
|
||||||
|
|
@ -1168,8 +1089,6 @@ KMP_LABEL(invoke_3):
|
||||||
// addr: %rdi
|
// addr: %rdi
|
||||||
// data: %xmm0 (lower 8 bytes)
|
// data: %xmm0 (lower 8 bytes)
|
||||||
// return: %xmm0 (lower 8 bytes)
|
// return: %xmm0 (lower 8 bytes)
|
||||||
//
|
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_xchg_real64
|
PROC __kmp_xchg_real64
|
||||||
|
|
||||||
|
|
@ -1190,7 +1109,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_load_x87_fpu_control_word
|
// FUNCTION __kmp_load_x87_fpu_control_word
|
||||||
//
|
//
|
||||||
// void
|
// void
|
||||||
|
|
@ -1198,8 +1116,6 @@ KMP_LABEL(invoke_3):
|
||||||
//
|
//
|
||||||
// parameters:
|
// parameters:
|
||||||
// p: %rdi
|
// p: %rdi
|
||||||
//
|
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_load_x87_fpu_control_word
|
PROC __kmp_load_x87_fpu_control_word
|
||||||
|
|
||||||
|
|
@ -1210,7 +1126,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_store_x87_fpu_control_word
|
// FUNCTION __kmp_store_x87_fpu_control_word
|
||||||
//
|
//
|
||||||
// void
|
// void
|
||||||
|
|
@ -1218,8 +1133,6 @@ KMP_LABEL(invoke_3):
|
||||||
//
|
//
|
||||||
// parameters:
|
// parameters:
|
||||||
// p: %rdi
|
// p: %rdi
|
||||||
//
|
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_store_x87_fpu_control_word
|
PROC __kmp_store_x87_fpu_control_word
|
||||||
|
|
||||||
|
|
@ -1230,14 +1143,10 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_clear_x87_fpu_status_word
|
// FUNCTION __kmp_clear_x87_fpu_status_word
|
||||||
//
|
//
|
||||||
// void
|
// void
|
||||||
// __kmp_clear_x87_fpu_status_word();
|
// __kmp_clear_x87_fpu_status_word();
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_clear_x87_fpu_status_word
|
PROC __kmp_clear_x87_fpu_status_word
|
||||||
|
|
||||||
|
|
@ -1256,7 +1165,6 @@ KMP_LABEL(invoke_3):
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// typedef void (*microtask_t)( int *gtid, int *tid, ... );
|
// typedef void (*microtask_t)( int *gtid, int *tid, ... );
|
||||||
//
|
//
|
||||||
// int
|
// int
|
||||||
|
|
@ -1267,8 +1175,7 @@ KMP_LABEL(invoke_3):
|
||||||
// return 1;
|
// return 1;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// note:
|
// note: at call to pkfn must have %rsp 128-byte aligned for compiler
|
||||||
// at call to pkfn must have %rsp 128-byte aligned for compiler
|
|
||||||
//
|
//
|
||||||
// parameters:
|
// parameters:
|
||||||
// %rdi: pkfn
|
// %rdi: pkfn
|
||||||
|
|
@ -1291,8 +1198,6 @@ KMP_LABEL(invoke_3):
|
||||||
// %rbx: used to hold pkfn address, and zero constant, callee-save
|
// %rbx: used to hold pkfn address, and zero constant, callee-save
|
||||||
//
|
//
|
||||||
// return: %eax (always 1/TRUE)
|
// return: %eax (always 1/TRUE)
|
||||||
//
|
|
||||||
|
|
||||||
__gtid = -16
|
__gtid = -16
|
||||||
__tid = -24
|
__tid = -24
|
||||||
|
|
||||||
|
|
@ -1442,13 +1347,10 @@ KMP_LABEL(kmp_1_exit):
|
||||||
// -- End __kmp_hardware_timestamp
|
// -- End __kmp_hardware_timestamp
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// FUNCTION __kmp_bsr32
|
// FUNCTION __kmp_bsr32
|
||||||
//
|
//
|
||||||
// int
|
// int
|
||||||
// __kmp_bsr32( int );
|
// __kmp_bsr32( int );
|
||||||
//
|
|
||||||
|
|
||||||
.text
|
.text
|
||||||
PROC __kmp_bsr32
|
PROC __kmp_bsr32
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -42,13 +42,10 @@ endif
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_x86_pause
|
; FUNCTION ___kmp_x86_pause
|
||||||
;
|
;
|
||||||
; void
|
; void
|
||||||
; __kmp_x86_pause( void )
|
; __kmp_x86_pause( void )
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_x86_pause
|
PUBLIC ___kmp_x86_pause
|
||||||
_p$ = 4
|
_p$ = 4
|
||||||
_d$ = 8
|
_d$ = 8
|
||||||
|
|
@ -64,13 +61,10 @@ ___kmp_x86_pause ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_x86_cpuid
|
; FUNCTION ___kmp_x86_cpuid
|
||||||
;
|
;
|
||||||
; void
|
; void
|
||||||
; __kmp_x86_cpuid( int mode, int mode2, struct kmp_cpuid *p );
|
; __kmp_x86_cpuid( int mode, int mode2, struct kmp_cpuid *p );
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_x86_cpuid
|
PUBLIC ___kmp_x86_cpuid
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -115,13 +109,10 @@ ___kmp_x86_cpuid ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_test_then_add32
|
; FUNCTION ___kmp_test_then_add32
|
||||||
;
|
;
|
||||||
; kmp_int32
|
; kmp_int32
|
||||||
; __kmp_test_then_add32( volatile kmp_int32 *p, kmp_int32 d );
|
; __kmp_test_then_add32( volatile kmp_int32 *p, kmp_int32 d );
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_test_then_add32
|
PUBLIC ___kmp_test_then_add32
|
||||||
_p$ = 4
|
_p$ = 4
|
||||||
_d$ = 8
|
_d$ = 8
|
||||||
|
|
@ -138,13 +129,10 @@ ___kmp_test_then_add32 ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_compare_and_store8
|
; FUNCTION ___kmp_compare_and_store8
|
||||||
;
|
;
|
||||||
; kmp_int8
|
; kmp_int8
|
||||||
; __kmp_compare_and_store8( volatile kmp_int8 *p, kmp_int8 cv, kmp_int8 sv );
|
; __kmp_compare_and_store8( volatile kmp_int8 *p, kmp_int8 cv, kmp_int8 sv );
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_compare_and_store8
|
PUBLIC ___kmp_compare_and_store8
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -166,13 +154,10 @@ ___kmp_compare_and_store8 ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_compare_and_store16
|
; FUNCTION ___kmp_compare_and_store16
|
||||||
;
|
;
|
||||||
; kmp_int16
|
; kmp_int16
|
||||||
; __kmp_compare_and_store16( volatile kmp_int16 *p, kmp_int16 cv, kmp_int16 sv );
|
; __kmp_compare_and_store16( volatile kmp_int16 *p, kmp_int16 cv, kmp_int16 sv );
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_compare_and_store16
|
PUBLIC ___kmp_compare_and_store16
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -194,13 +179,10 @@ ___kmp_compare_and_store16 ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_compare_and_store32
|
; FUNCTION ___kmp_compare_and_store32
|
||||||
;
|
;
|
||||||
; kmp_int32
|
; kmp_int32
|
||||||
; __kmp_compare_and_store32( volatile kmp_int32 *p, kmp_int32 cv, kmp_int32 sv );
|
; __kmp_compare_and_store32( volatile kmp_int32 *p, kmp_int32 cv, kmp_int32 sv );
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_compare_and_store32
|
PUBLIC ___kmp_compare_and_store32
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -222,13 +204,10 @@ ___kmp_compare_and_store32 ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_compare_and_store64
|
; FUNCTION ___kmp_compare_and_store64
|
||||||
;
|
;
|
||||||
; kmp_int32
|
; kmp_int32
|
||||||
; __kmp_compare_and_store64( volatile kmp_int64 *p, kmp_int64 cv, kmp_int64 sv );
|
; __kmp_compare_and_store64( volatile kmp_int64 *p, kmp_int64 cv, kmp_int64 sv );
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_compare_and_store64
|
PUBLIC ___kmp_compare_and_store64
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -262,13 +241,10 @@ ___kmp_compare_and_store64 ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_xchg_fixed8
|
; FUNCTION ___kmp_xchg_fixed8
|
||||||
;
|
;
|
||||||
; kmp_int8
|
; kmp_int8
|
||||||
; __kmp_xchg_fixed8( volatile kmp_int8 *p, kmp_int8 d );
|
; __kmp_xchg_fixed8( volatile kmp_int8 *p, kmp_int8 d );
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_xchg_fixed8
|
PUBLIC ___kmp_xchg_fixed8
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -286,13 +262,10 @@ ___kmp_xchg_fixed8 ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_xchg_fixed16
|
; FUNCTION ___kmp_xchg_fixed16
|
||||||
;
|
;
|
||||||
; kmp_int16
|
; kmp_int16
|
||||||
; __kmp_xchg_fixed16( volatile kmp_int16 *p, kmp_int16 d );
|
; __kmp_xchg_fixed16( volatile kmp_int16 *p, kmp_int16 d );
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_xchg_fixed16
|
PUBLIC ___kmp_xchg_fixed16
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -310,13 +283,10 @@ ___kmp_xchg_fixed16 ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_xchg_fixed32
|
; FUNCTION ___kmp_xchg_fixed32
|
||||||
;
|
;
|
||||||
; kmp_int32
|
; kmp_int32
|
||||||
; __kmp_xchg_fixed32( volatile kmp_int32 *p, kmp_int32 d );
|
; __kmp_xchg_fixed32( volatile kmp_int32 *p, kmp_int32 d );
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_xchg_fixed32
|
PUBLIC ___kmp_xchg_fixed32
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -335,13 +305,10 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_xchg_real32
|
; FUNCTION ___kmp_xchg_real32
|
||||||
;
|
;
|
||||||
; kmp_real32
|
; kmp_real32
|
||||||
; __kmp_xchg_real32( volatile kmp_real32 *p, kmp_real32 d );
|
; __kmp_xchg_real32( volatile kmp_real32 *p, kmp_real32 d );
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_xchg_real32
|
PUBLIC ___kmp_xchg_real32
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -378,13 +345,10 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_compare_and_store_ret8
|
; FUNCTION ___kmp_compare_and_store_ret8
|
||||||
;
|
;
|
||||||
; kmp_int8
|
; kmp_int8
|
||||||
; __kmp_compare_and_store_ret8( volatile kmp_int8 *p, kmp_int8 cv, kmp_int8 sv );
|
; __kmp_compare_and_store_ret8( volatile kmp_int8 *p, kmp_int8 cv, kmp_int8 sv );
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_compare_and_store_ret8
|
PUBLIC ___kmp_compare_and_store_ret8
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -404,13 +368,10 @@ ___kmp_compare_and_store_ret8 ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_compare_and_store_ret16
|
; FUNCTION ___kmp_compare_and_store_ret16
|
||||||
;
|
;
|
||||||
; kmp_int16
|
; kmp_int16
|
||||||
; __kmp_compare_and_store_ret16( volatile kmp_int16 *p, kmp_int16 cv, kmp_int16 sv );
|
; __kmp_compare_and_store_ret16( volatile kmp_int16 *p, kmp_int16 cv, kmp_int16 sv );
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_compare_and_store_ret16
|
PUBLIC ___kmp_compare_and_store_ret16
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -430,13 +391,10 @@ ___kmp_compare_and_store_ret16 ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_compare_and_store_ret32
|
; FUNCTION ___kmp_compare_and_store_ret32
|
||||||
;
|
;
|
||||||
; kmp_int32
|
; kmp_int32
|
||||||
; __kmp_compare_and_store_ret32( volatile kmp_int32 *p, kmp_int32 cv, kmp_int32 sv );
|
; __kmp_compare_and_store_ret32( volatile kmp_int32 *p, kmp_int32 cv, kmp_int32 sv );
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_compare_and_store_ret32
|
PUBLIC ___kmp_compare_and_store_ret32
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -456,13 +414,10 @@ ___kmp_compare_and_store_ret32 ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_compare_and_store_ret64
|
; FUNCTION ___kmp_compare_and_store_ret64
|
||||||
;
|
;
|
||||||
; kmp_int64
|
; kmp_int64
|
||||||
; __kmp_compare_and_store_ret64( volatile kmp_int64 *p, kmp_int64 cv, kmp_int64 sv );
|
; __kmp_compare_and_store_ret64( volatile kmp_int64 *p, kmp_int64 cv, kmp_int64 sv );
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_compare_and_store_ret64
|
PUBLIC ___kmp_compare_and_store_ret64
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -494,7 +449,6 @@ ___kmp_compare_and_store_ret64 ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_load_x87_fpu_control_word
|
; FUNCTION ___kmp_load_x87_fpu_control_word
|
||||||
;
|
;
|
||||||
; void
|
; void
|
||||||
|
|
@ -502,7 +456,6 @@ _TEXT ENDS
|
||||||
;
|
;
|
||||||
; parameters:
|
; parameters:
|
||||||
; p: 4(%esp)
|
; p: 4(%esp)
|
||||||
|
|
||||||
PUBLIC ___kmp_load_x87_fpu_control_word
|
PUBLIC ___kmp_load_x87_fpu_control_word
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -518,7 +471,6 @@ ___kmp_load_x87_fpu_control_word ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_store_x87_fpu_control_word
|
; FUNCTION ___kmp_store_x87_fpu_control_word
|
||||||
;
|
;
|
||||||
; void
|
; void
|
||||||
|
|
@ -526,7 +478,6 @@ _TEXT ENDS
|
||||||
;
|
;
|
||||||
; parameters:
|
; parameters:
|
||||||
; p: 4(%esp)
|
; p: 4(%esp)
|
||||||
|
|
||||||
PUBLIC ___kmp_store_x87_fpu_control_word
|
PUBLIC ___kmp_store_x87_fpu_control_word
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -542,13 +493,10 @@ ___kmp_store_x87_fpu_control_word ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_clear_x87_fpu_status_word
|
; FUNCTION ___kmp_clear_x87_fpu_status_word
|
||||||
;
|
;
|
||||||
; void
|
; void
|
||||||
; __kmp_clear_x87_fpu_status_word();
|
; __kmp_clear_x87_fpu_status_word();
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_clear_x87_fpu_status_word
|
PUBLIC ___kmp_clear_x87_fpu_status_word
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -563,7 +511,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_invoke_microtask
|
; FUNCTION ___kmp_invoke_microtask
|
||||||
;
|
;
|
||||||
; typedef void (*microtask_t)( int *gtid, int *tid, ... );
|
; typedef void (*microtask_t)( int *gtid, int *tid, ... );
|
||||||
|
|
@ -572,8 +519,6 @@ _TEXT ENDS
|
||||||
; __kmp_invoke_microtask( microtask_t pkfn,
|
; __kmp_invoke_microtask( microtask_t pkfn,
|
||||||
; int gtid, int tid,
|
; int gtid, int tid,
|
||||||
; int argc, void *p_argv[] )
|
; int argc, void *p_argv[] )
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC ___kmp_invoke_microtask
|
PUBLIC ___kmp_invoke_microtask
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -677,7 +622,6 @@ endif
|
||||||
ifdef _M_AMD64
|
ifdef _M_AMD64
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_x86_cpuid
|
; FUNCTION __kmp_x86_cpuid
|
||||||
;
|
;
|
||||||
; void
|
; void
|
||||||
|
|
@ -687,7 +631,6 @@ ifdef _M_AMD64
|
||||||
; mode: ecx
|
; mode: ecx
|
||||||
; mode2: edx
|
; mode2: edx
|
||||||
; cpuid_buffer: r8
|
; cpuid_buffer: r8
|
||||||
|
|
||||||
PUBLIC __kmp_x86_cpuid
|
PUBLIC __kmp_x86_cpuid
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -722,7 +665,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_test_then_add32
|
; FUNCTION __kmp_test_then_add32
|
||||||
;
|
;
|
||||||
; kmp_int32
|
; kmp_int32
|
||||||
|
|
@ -733,7 +675,6 @@ _TEXT ENDS
|
||||||
; d: edx
|
; d: edx
|
||||||
;
|
;
|
||||||
; return: eax
|
; return: eax
|
||||||
|
|
||||||
PUBLIC __kmp_test_then_add32
|
PUBLIC __kmp_test_then_add32
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -748,7 +689,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_test_then_add64
|
; FUNCTION __kmp_test_then_add64
|
||||||
;
|
;
|
||||||
; kmp_int32
|
; kmp_int32
|
||||||
|
|
@ -759,7 +699,6 @@ _TEXT ENDS
|
||||||
; d: rdx
|
; d: rdx
|
||||||
;
|
;
|
||||||
; return: rax
|
; return: rax
|
||||||
|
|
||||||
PUBLIC __kmp_test_then_add64
|
PUBLIC __kmp_test_then_add64
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -774,7 +713,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_compare_and_store8
|
; FUNCTION __kmp_compare_and_store8
|
||||||
;
|
;
|
||||||
; kmp_int8
|
; kmp_int8
|
||||||
|
|
@ -785,7 +723,6 @@ _TEXT ENDS
|
||||||
; sv: r8d
|
; sv: r8d
|
||||||
;
|
;
|
||||||
; return: eax
|
; return: eax
|
||||||
|
|
||||||
PUBLIC __kmp_compare_and_store8
|
PUBLIC __kmp_compare_and_store8
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -804,7 +741,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_compare_and_store16
|
; FUNCTION __kmp_compare_and_store16
|
||||||
;
|
;
|
||||||
; kmp_int16
|
; kmp_int16
|
||||||
|
|
@ -815,7 +751,6 @@ _TEXT ENDS
|
||||||
; sv: r8d
|
; sv: r8d
|
||||||
;
|
;
|
||||||
; return: eax
|
; return: eax
|
||||||
|
|
||||||
PUBLIC __kmp_compare_and_store16
|
PUBLIC __kmp_compare_and_store16
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -834,7 +769,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_compare_and_store32
|
; FUNCTION __kmp_compare_and_store32
|
||||||
;
|
;
|
||||||
; kmp_int32
|
; kmp_int32
|
||||||
|
|
@ -845,7 +779,6 @@ _TEXT ENDS
|
||||||
; sv: r8d
|
; sv: r8d
|
||||||
;
|
;
|
||||||
; return: eax
|
; return: eax
|
||||||
|
|
||||||
PUBLIC __kmp_compare_and_store32
|
PUBLIC __kmp_compare_and_store32
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -864,7 +797,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_compare_and_store64
|
; FUNCTION __kmp_compare_and_store64
|
||||||
;
|
;
|
||||||
; kmp_int32
|
; kmp_int32
|
||||||
|
|
@ -875,7 +807,6 @@ _TEXT ENDS
|
||||||
; sv: r8
|
; sv: r8
|
||||||
;
|
;
|
||||||
; return: eax
|
; return: eax
|
||||||
|
|
||||||
PUBLIC __kmp_compare_and_store64
|
PUBLIC __kmp_compare_and_store64
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -894,7 +825,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_xchg_fixed8
|
; FUNCTION ___kmp_xchg_fixed8
|
||||||
;
|
;
|
||||||
; kmp_int8
|
; kmp_int8
|
||||||
|
|
@ -905,7 +835,6 @@ _TEXT ENDS
|
||||||
; d: dl
|
; d: dl
|
||||||
;
|
;
|
||||||
; return: al
|
; return: al
|
||||||
|
|
||||||
PUBLIC __kmp_xchg_fixed8
|
PUBLIC __kmp_xchg_fixed8
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -921,7 +850,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_xchg_fixed16
|
; FUNCTION ___kmp_xchg_fixed16
|
||||||
;
|
;
|
||||||
; kmp_int16
|
; kmp_int16
|
||||||
|
|
@ -932,7 +860,6 @@ _TEXT ENDS
|
||||||
; d: dx
|
; d: dx
|
||||||
;
|
;
|
||||||
; return: ax
|
; return: ax
|
||||||
|
|
||||||
PUBLIC __kmp_xchg_fixed16
|
PUBLIC __kmp_xchg_fixed16
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -948,7 +875,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_xchg_fixed32
|
; FUNCTION ___kmp_xchg_fixed32
|
||||||
;
|
;
|
||||||
; kmp_int32
|
; kmp_int32
|
||||||
|
|
@ -959,7 +885,6 @@ _TEXT ENDS
|
||||||
; d: edx
|
; d: edx
|
||||||
;
|
;
|
||||||
; return: eax
|
; return: eax
|
||||||
|
|
||||||
PUBLIC __kmp_xchg_fixed32
|
PUBLIC __kmp_xchg_fixed32
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -974,7 +899,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION ___kmp_xchg_fixed64
|
; FUNCTION ___kmp_xchg_fixed64
|
||||||
;
|
;
|
||||||
; kmp_int64
|
; kmp_int64
|
||||||
|
|
@ -985,7 +909,6 @@ _TEXT ENDS
|
||||||
; d: rdx
|
; d: rdx
|
||||||
;
|
;
|
||||||
; return: rax
|
; return: rax
|
||||||
|
|
||||||
PUBLIC __kmp_xchg_fixed64
|
PUBLIC __kmp_xchg_fixed64
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -1000,7 +923,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_compare_and_store_ret8
|
; FUNCTION __kmp_compare_and_store_ret8
|
||||||
;
|
;
|
||||||
; kmp_int8
|
; kmp_int8
|
||||||
|
|
@ -1011,7 +933,6 @@ _TEXT ENDS
|
||||||
; sv: r8d
|
; sv: r8d
|
||||||
;
|
;
|
||||||
; return: eax
|
; return: eax
|
||||||
|
|
||||||
PUBLIC __kmp_compare_and_store_ret8
|
PUBLIC __kmp_compare_and_store_ret8
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -1030,7 +951,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_compare_and_store_ret16
|
; FUNCTION __kmp_compare_and_store_ret16
|
||||||
;
|
;
|
||||||
; kmp_int16
|
; kmp_int16
|
||||||
|
|
@ -1041,7 +961,6 @@ _TEXT ENDS
|
||||||
; sv: r8d
|
; sv: r8d
|
||||||
;
|
;
|
||||||
; return: eax
|
; return: eax
|
||||||
|
|
||||||
PUBLIC __kmp_compare_and_store_ret16
|
PUBLIC __kmp_compare_and_store_ret16
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -1058,7 +977,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_compare_and_store_ret32
|
; FUNCTION __kmp_compare_and_store_ret32
|
||||||
;
|
;
|
||||||
; kmp_int32
|
; kmp_int32
|
||||||
|
|
@ -1069,7 +987,6 @@ _TEXT ENDS
|
||||||
; sv: r8d
|
; sv: r8d
|
||||||
;
|
;
|
||||||
; return: eax
|
; return: eax
|
||||||
|
|
||||||
PUBLIC __kmp_compare_and_store_ret32
|
PUBLIC __kmp_compare_and_store_ret32
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -1086,7 +1003,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_compare_and_store_ret64
|
; FUNCTION __kmp_compare_and_store_ret64
|
||||||
;
|
;
|
||||||
; kmp_int64
|
; kmp_int64
|
||||||
|
|
@ -1097,7 +1013,6 @@ _TEXT ENDS
|
||||||
; sv: r8
|
; sv: r8
|
||||||
;
|
;
|
||||||
; return: rax
|
; return: rax
|
||||||
|
|
||||||
PUBLIC __kmp_compare_and_store_ret64
|
PUBLIC __kmp_compare_and_store_ret64
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -1114,7 +1029,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_compare_and_store_loop8
|
; FUNCTION __kmp_compare_and_store_loop8
|
||||||
;
|
;
|
||||||
; kmp_int8
|
; kmp_int8
|
||||||
|
|
@ -1125,7 +1039,6 @@ _TEXT ENDS
|
||||||
; sv: r8d
|
; sv: r8d
|
||||||
;
|
;
|
||||||
; return: al
|
; return: al
|
||||||
|
|
||||||
PUBLIC __kmp_compare_and_store_loop8
|
PUBLIC __kmp_compare_and_store_loop8
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -1153,7 +1066,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_xchg_real32
|
; FUNCTION __kmp_xchg_real32
|
||||||
;
|
;
|
||||||
; kmp_real32
|
; kmp_real32
|
||||||
|
|
@ -1164,7 +1076,6 @@ _TEXT ENDS
|
||||||
; d: xmm1 (lower 4 bytes)
|
; d: xmm1 (lower 4 bytes)
|
||||||
;
|
;
|
||||||
; return: xmm0 (lower 4 bytes)
|
; return: xmm0 (lower 4 bytes)
|
||||||
|
|
||||||
PUBLIC __kmp_xchg_real32
|
PUBLIC __kmp_xchg_real32
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -1182,7 +1093,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_xchg_real64
|
; FUNCTION __kmp_xchg_real64
|
||||||
;
|
;
|
||||||
; kmp_real64
|
; kmp_real64
|
||||||
|
|
@ -1193,7 +1103,6 @@ _TEXT ENDS
|
||||||
; d: xmm1 (lower 8 bytes)
|
; d: xmm1 (lower 8 bytes)
|
||||||
;
|
;
|
||||||
; return: xmm0 (lower 8 bytes)
|
; return: xmm0 (lower 8 bytes)
|
||||||
|
|
||||||
PUBLIC __kmp_xchg_real64
|
PUBLIC __kmp_xchg_real64
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -1210,7 +1119,6 @@ __kmp_xchg_real64 ENDP
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_load_x87_fpu_control_word
|
; FUNCTION __kmp_load_x87_fpu_control_word
|
||||||
;
|
;
|
||||||
; void
|
; void
|
||||||
|
|
@ -1218,8 +1126,6 @@ _TEXT ENDS
|
||||||
;
|
;
|
||||||
; parameters:
|
; parameters:
|
||||||
; p: rcx
|
; p: rcx
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC __kmp_load_x87_fpu_control_word
|
PUBLIC __kmp_load_x87_fpu_control_word
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -1233,7 +1139,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_store_x87_fpu_control_word
|
; FUNCTION __kmp_store_x87_fpu_control_word
|
||||||
;
|
;
|
||||||
; void
|
; void
|
||||||
|
|
@ -1241,8 +1146,6 @@ _TEXT ENDS
|
||||||
;
|
;
|
||||||
; parameters:
|
; parameters:
|
||||||
; p: rcx
|
; p: rcx
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC __kmp_store_x87_fpu_control_word
|
PUBLIC __kmp_store_x87_fpu_control_word
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -1256,13 +1159,10 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_clear_x87_fpu_status_word
|
; FUNCTION __kmp_clear_x87_fpu_status_word
|
||||||
;
|
;
|
||||||
; void
|
; void
|
||||||
; __kmp_clear_x87_fpu_status_word()
|
; __kmp_clear_x87_fpu_status_word()
|
||||||
;
|
|
||||||
|
|
||||||
PUBLIC __kmp_clear_x87_fpu_status_word
|
PUBLIC __kmp_clear_x87_fpu_status_word
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
|
|
@ -1276,7 +1176,6 @@ _TEXT ENDS
|
||||||
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------
|
;------------------------------------------------------------------------
|
||||||
;
|
|
||||||
; FUNCTION __kmp_invoke_microtask
|
; FUNCTION __kmp_invoke_microtask
|
||||||
;
|
;
|
||||||
; typedef void (*microtask_t)( int *gtid, int *tid, ... );
|
; typedef void (*microtask_t)( int *gtid, int *tid, ... );
|
||||||
|
|
@ -1307,8 +1206,6 @@ _TEXT ENDS
|
||||||
; r10: used to hold pkfn function pointer argument
|
; r10: used to hold pkfn function pointer argument
|
||||||
;
|
;
|
||||||
; return: eax (always 1/TRUE)
|
; return: eax (always 1/TRUE)
|
||||||
;
|
|
||||||
|
|
||||||
$_pkfn = 16
|
$_pkfn = 16
|
||||||
$_gtid = 24
|
$_gtid = 24
|
||||||
$_tid = 32
|
$_tid = 32
|
||||||
|
|
|
||||||
|
|
@ -17,139 +17,114 @@
|
||||||
|
|
||||||
#if (KMP_ARCH_X86 || KMP_ARCH_X86_64)
|
#if (KMP_ARCH_X86 || KMP_ARCH_X86_64)
|
||||||
/* Only 32-bit "add-exchange" instruction on IA-32 architecture causes us to
|
/* Only 32-bit "add-exchange" instruction on IA-32 architecture causes us to
|
||||||
* use compare_and_store for these routines
|
use compare_and_store for these routines */
|
||||||
*/
|
|
||||||
|
|
||||||
kmp_int8
|
kmp_int8 __kmp_test_then_or8(volatile kmp_int8 *p, kmp_int8 d) {
|
||||||
__kmp_test_then_or8( volatile kmp_int8 *p, kmp_int8 d )
|
|
||||||
{
|
|
||||||
kmp_int8 old_value, new_value;
|
kmp_int8 old_value, new_value;
|
||||||
|
|
||||||
old_value = TCR_1( *p );
|
old_value = TCR_1(*p);
|
||||||
new_value = old_value | d;
|
new_value = old_value | d;
|
||||||
|
|
||||||
while ( ! __kmp_compare_and_store8 ( p, old_value, new_value ) )
|
while (!__kmp_compare_and_store8(p, old_value, new_value)) {
|
||||||
{
|
|
||||||
KMP_CPU_PAUSE();
|
KMP_CPU_PAUSE();
|
||||||
old_value = TCR_1( *p );
|
old_value = TCR_1(*p);
|
||||||
new_value = old_value | d;
|
new_value = old_value | d;
|
||||||
}
|
}
|
||||||
return old_value;
|
return old_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
kmp_int8
|
kmp_int8 __kmp_test_then_and8(volatile kmp_int8 *p, kmp_int8 d) {
|
||||||
__kmp_test_then_and8( volatile kmp_int8 *p, kmp_int8 d )
|
|
||||||
{
|
|
||||||
kmp_int8 old_value, new_value;
|
kmp_int8 old_value, new_value;
|
||||||
|
|
||||||
old_value = TCR_1( *p );
|
old_value = TCR_1(*p);
|
||||||
new_value = old_value & d;
|
new_value = old_value & d;
|
||||||
|
|
||||||
while ( ! __kmp_compare_and_store8 ( p, old_value, new_value ) )
|
while (!__kmp_compare_and_store8(p, old_value, new_value)) {
|
||||||
{
|
|
||||||
KMP_CPU_PAUSE();
|
KMP_CPU_PAUSE();
|
||||||
old_value = TCR_1( *p );
|
old_value = TCR_1(*p);
|
||||||
new_value = old_value & d;
|
new_value = old_value & d;
|
||||||
}
|
}
|
||||||
return old_value;
|
return old_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
kmp_int32
|
kmp_int32 __kmp_test_then_or32(volatile kmp_int32 *p, kmp_int32 d) {
|
||||||
__kmp_test_then_or32( volatile kmp_int32 *p, kmp_int32 d )
|
|
||||||
{
|
|
||||||
kmp_int32 old_value, new_value;
|
kmp_int32 old_value, new_value;
|
||||||
|
|
||||||
old_value = TCR_4( *p );
|
old_value = TCR_4(*p);
|
||||||
new_value = old_value | d;
|
new_value = old_value | d;
|
||||||
|
|
||||||
while ( ! __kmp_compare_and_store32 ( p, old_value, new_value ) )
|
while (!__kmp_compare_and_store32(p, old_value, new_value)) {
|
||||||
{
|
|
||||||
KMP_CPU_PAUSE();
|
KMP_CPU_PAUSE();
|
||||||
old_value = TCR_4( *p );
|
old_value = TCR_4(*p);
|
||||||
new_value = old_value | d;
|
new_value = old_value | d;
|
||||||
}
|
}
|
||||||
return old_value;
|
return old_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
kmp_int32
|
kmp_int32 __kmp_test_then_and32(volatile kmp_int32 *p, kmp_int32 d) {
|
||||||
__kmp_test_then_and32( volatile kmp_int32 *p, kmp_int32 d )
|
|
||||||
{
|
|
||||||
kmp_int32 old_value, new_value;
|
kmp_int32 old_value, new_value;
|
||||||
|
|
||||||
old_value = TCR_4( *p );
|
old_value = TCR_4(*p);
|
||||||
new_value = old_value & d;
|
new_value = old_value & d;
|
||||||
|
|
||||||
while ( ! __kmp_compare_and_store32 ( p, old_value, new_value ) )
|
while (!__kmp_compare_and_store32(p, old_value, new_value)) {
|
||||||
{
|
|
||||||
KMP_CPU_PAUSE();
|
KMP_CPU_PAUSE();
|
||||||
old_value = TCR_4( *p );
|
old_value = TCR_4(*p);
|
||||||
new_value = old_value & d;
|
new_value = old_value & d;
|
||||||
}
|
}
|
||||||
return old_value;
|
return old_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
kmp_int8
|
kmp_int8 __kmp_test_then_add8(volatile kmp_int8 *p, kmp_int8 d) {
|
||||||
__kmp_test_then_add8( volatile kmp_int8 *p, kmp_int8 d )
|
|
||||||
{
|
|
||||||
kmp_int64 old_value, new_value;
|
kmp_int64 old_value, new_value;
|
||||||
|
|
||||||
old_value = TCR_1( *p );
|
old_value = TCR_1(*p);
|
||||||
new_value = old_value + d;
|
new_value = old_value + d;
|
||||||
while ( ! __kmp_compare_and_store8 ( p, old_value, new_value ) )
|
while (!__kmp_compare_and_store8(p, old_value, new_value)) {
|
||||||
{
|
|
||||||
KMP_CPU_PAUSE();
|
KMP_CPU_PAUSE();
|
||||||
old_value = TCR_1( *p );
|
old_value = TCR_1(*p);
|
||||||
new_value = old_value + d;
|
new_value = old_value + d;
|
||||||
}
|
}
|
||||||
return old_value;
|
return old_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if KMP_ARCH_X86
|
#if KMP_ARCH_X86
|
||||||
kmp_int64
|
kmp_int64 __kmp_test_then_add64(volatile kmp_int64 *p, kmp_int64 d) {
|
||||||
__kmp_test_then_add64( volatile kmp_int64 *p, kmp_int64 d )
|
|
||||||
{
|
|
||||||
kmp_int64 old_value, new_value;
|
kmp_int64 old_value, new_value;
|
||||||
|
|
||||||
old_value = TCR_8( *p );
|
old_value = TCR_8(*p);
|
||||||
new_value = old_value + d;
|
new_value = old_value + d;
|
||||||
while ( ! __kmp_compare_and_store64 ( p, old_value, new_value ) )
|
while (!__kmp_compare_and_store64(p, old_value, new_value)) {
|
||||||
{
|
|
||||||
KMP_CPU_PAUSE();
|
KMP_CPU_PAUSE();
|
||||||
old_value = TCR_8( *p );
|
old_value = TCR_8(*p);
|
||||||
new_value = old_value + d;
|
new_value = old_value + d;
|
||||||
}
|
}
|
||||||
return old_value;
|
return old_value;
|
||||||
}
|
}
|
||||||
#endif /* KMP_ARCH_X86 */
|
#endif /* KMP_ARCH_X86 */
|
||||||
|
|
||||||
kmp_int64
|
kmp_int64 __kmp_test_then_or64(volatile kmp_int64 *p, kmp_int64 d) {
|
||||||
__kmp_test_then_or64( volatile kmp_int64 *p, kmp_int64 d )
|
|
||||||
{
|
|
||||||
kmp_int64 old_value, new_value;
|
kmp_int64 old_value, new_value;
|
||||||
|
|
||||||
old_value = TCR_8( *p );
|
old_value = TCR_8(*p);
|
||||||
new_value = old_value | d;
|
new_value = old_value | d;
|
||||||
while ( ! __kmp_compare_and_store64 ( p, old_value, new_value ) )
|
while (!__kmp_compare_and_store64(p, old_value, new_value)) {
|
||||||
{
|
|
||||||
KMP_CPU_PAUSE();
|
KMP_CPU_PAUSE();
|
||||||
old_value = TCR_8( *p );
|
old_value = TCR_8(*p);
|
||||||
new_value = old_value | d;
|
new_value = old_value | d;
|
||||||
}
|
}
|
||||||
|
|
||||||
return old_value;
|
return old_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
kmp_int64
|
kmp_int64 __kmp_test_then_and64(volatile kmp_int64 *p, kmp_int64 d) {
|
||||||
__kmp_test_then_and64( volatile kmp_int64 *p, kmp_int64 d )
|
|
||||||
{
|
|
||||||
kmp_int64 old_value, new_value;
|
kmp_int64 old_value, new_value;
|
||||||
|
|
||||||
old_value = TCR_8( *p );
|
old_value = TCR_8(*p);
|
||||||
new_value = old_value & d;
|
new_value = old_value & d;
|
||||||
while ( ! __kmp_compare_and_store64 ( p, old_value, new_value ) )
|
while (!__kmp_compare_and_store64(p, old_value, new_value)) {
|
||||||
{
|
|
||||||
KMP_CPU_PAUSE();
|
KMP_CPU_PAUSE();
|
||||||
old_value = TCR_8( *p );
|
old_value = TCR_8(*p);
|
||||||
new_value = old_value & d;
|
new_value = old_value & d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -157,7 +132,3 @@ __kmp_test_then_and64( volatile kmp_int64 *p, kmp_int64 d )
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* KMP_ARCH_X86 || KMP_ARCH_X86_64 */
|
#endif /* KMP_ARCH_X86 || KMP_ARCH_X86_64 */
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue