Skip to content

Commit ac828c9

Browse files
committed
add a control to find unique log and report file names
Also, consistently use the spelling "file name" vs. "filename".
1 parent 6c290af commit ac828c9

File tree

15 files changed

+207
-103
lines changed

15 files changed

+207
-103
lines changed

docs/FAQ.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ The most likely cause of this issue is an application that loads and unloads the
154154
When this occurs, the report file will only contain data collected between the last time the OpenCL Intercept Layer was loaded and unloaded, which could be no data at all.
155155
156156
To determine if this issue is occurring, and to work around the issue if it is occurring, set the `AppendFiles` control.
157-
`AppendFiles` causes logs and reports to append to an existing file instead of overwriting the file each time the OpenCL Intercept Layer is unloaded, preserving log or report data even when the OpenCL Intercept Layer is loaded and unloaded multiple times.
157+
`AppendFiles` causes logs and reports to append to an existing file instead of overwriting the file each time the OpenCL Intercept Layer is loaded, preserving log or report data even when the OpenCL Intercept Layer is loaded and unloaded multiple times.
158+
159+
For another option, set the `UniqueFiles` control.
160+
`UniqueFiles` will find a unique file name for each log and report file instead of overwriting the file each time the OpenCL Intercept Layer is loaded.
158161
159162
## How can I debug or analyze multiple instances of an application?
160163

docs/controls.md

Lines changed: 18 additions & 14 deletions
Large diffs are not rendered by default.

docs/injecting_programs.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,23 @@ that this is a subdirectory of the dump directory.
4343
If the application compiles programs deterministically the program(s) or program
4444
options can be copied unchanged. If the application compiles programs
4545
non-deterministically, you may need rename the programs to modify to remove the
46-
program number or compile count from the filename.
46+
program number or compile count from the file name.
4747

4848
The Intercept Layer for OpenCL Applications searches for program source filenames
4949
to inject in this order:
5050

51-
* `CLI_<program number>_<hash>_source.cl` - This is the default filename dumped
51+
* `CLI_<program number>_<hash>_source.cl` - This is the default file name dumped
5252
by DumpProgramSource.
53-
* `CLI_<hash>_source.cl` - This is the default filename with the program number
53+
* `CLI_<hash>_source.cl` - This is the default file name with the program number
5454
removed, so the order the application calls clCreateProgramWithSource() does
5555
not matter.
5656

5757
The Intercept Layer for OpenCL Applications searches for program option filenames
5858
to inject in this order:
5959

60-
* `CLI_<program number>_<hash>_<count>_options.txt` - This is the default filename
60+
* `CLI_<program number>_<hash>_<count>_options.txt` - This is the default file name
6161
dumped by DumpProgramSource.
62-
* `CLI_<hash>_<count>_options.txt` - This is the default filename with the program
62+
* `CLI_<hash>_<count>_options.txt` - This is the default file name with the program
6363
number removed, so the order the application calls clCreateProgramWithSource()
6464
does not matter.
6565
* `CLI_<hash>_options.txt` - This has both the program number and compile count

intercept/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ set(CLINTERCEPT_SOURCE_FILES
7979
src/main.cpp
8080
src/objtracker.cpp
8181
src/objtracker.h
82+
src/utils.cpp
83+
src/utils.h
8284
"${CMAKE_CURRENT_BINARY_DIR}/git_version.cpp"
8385
)
8486
source_group(Source FILES

intercept/OS/OS_linux.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Services : public Services_Common
4242
size_t& length ) const;
4343

4444
bool ExecuteCommand(
45-
const std::string& filename ) const;
45+
const std::string& fileName ) const;
4646
bool StartAubCapture(
4747
const std::string& fileName,
4848
uint64_t delay ) const;

intercept/OS/OS_mac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Services : public Services_Common
3636
size_t& length ) const;
3737

3838
bool ExecuteCommand(
39-
const std::string& filename ) const;
39+
const std::string& fileName ) const;
4040
bool StartAubCapture(
4141
const std::string& fileName,
4242
uint64_t delay ) const;

intercept/OS/OS_windows.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Services : public Services_Common
3737
size_t& length ) const;
3838

3939
bool ExecuteCommand(
40-
const std::string& filename ) const;
40+
const std::string& fileName ) const;
4141
bool StartAubCapture(
4242
const std::string& fileName,
4343
uint64_t delay ) const;

intercept/mdapi/intercept_mdapi.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "common.h"
1111
#include "intercept.h"
12+
#include "utils.h"
1213

1314
#define CL_PROFILING_COMMAND_PERFCOUNTERS_INTEL 0x407F
1415

@@ -202,12 +203,16 @@ void CLIntercept::initCustomPerfCounters()
202203
std::string fileName = "";
203204
OS().GetDumpDirectoryName( sc_DumpDirectoryName, fileName );
204205
fileName += '/';
205-
fileName += sc_DumpPerfCountersFileNamePrefix;
206+
fileName += sc_PerfCountersFileNamePrefix;
206207
fileName += "_";
207208
fileName += metricSetSymbolName;
208209
fileName += ".csv";
209210

210211
OS().MakeDumpDirectories( fileName );
212+
if( m_Config.UniqueFiles )
213+
{
214+
fileName = Utils::GetUniqueFileName(fileName);
215+
}
211216

212217
m_MetricDump.open( fileName.c_str(), std::ios::out | std::ios::binary );
213218

intercept/scripts/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
from collections import defaultdict
1616

1717
def get_image_metadata(idx: int):
18-
filename = f"./Image_MetaData_{idx}.txt"
19-
with open(filename) as metadata:
18+
fileName = f"./Image_MetaData_{idx}.txt"
19+
with open(fileName) as metadata:
2020
lines = metadata.readlines()
2121

2222
image_type = int(lines[8])

0 commit comments

Comments
 (0)